Reapply my previous asmprinter changes now with more testing and two
[oota-llvm.git] / include / llvm / Support / Casting.h
index 5132b4ec2885d04a0f4c37ba53bb0575b3758eac..48988f8a6bb8354c71326e634364acbb2895b4b2 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -15,6 +15,8 @@
 #ifndef LLVM_SUPPORT_CASTING_H
 #define LLVM_SUPPORT_CASTING_H
 
+#include <cassert>
+
 namespace llvm {
 
 //===----------------------------------------------------------------------===//
@@ -219,7 +221,7 @@ inline typename cast_retty<X, Y*>::ret_type cast_or_null(Y *Val) {
 //
 
 template <class X, class Y>
-inline typename cast_retty<X, Y>::ret_type dyn_cast(Val) {
+inline typename cast_retty<X, Y>::ret_type dyn_cast(const Y &Val) {
   return isa<X>(Val) ? cast<X, Y>(Val) : 0;
 }
 
@@ -227,13 +229,13 @@ inline typename cast_retty<X, Y>::ret_type dyn_cast(Y Val) {
 // value is accepted.
 //
 template <class X, class Y>
-inline typename cast_retty<X, Y>::ret_type dyn_cast_or_null(Val) {
+inline typename cast_retty<X, Y>::ret_type dyn_cast_or_null(const Y &Val) {
   return (Val && isa<X>(Val)) ? cast<X, Y>(Val) : 0;
 }
 
 
 #ifdef DEBUG_CAST_OPERATORS
-#include <iostream>
+#include "llvm/Support/Streams.h"
 
 struct bar {
   bar() {}