Added LLVM notice.
[oota-llvm.git] / include / Support / Casting.h
index ba0a99a5598a69c2cd4bedb258e4cdc53c6f0189..065919c1792a87c71cc491e3c464cb4418f1eeca 100644 (file)
@@ -1,4 +1,11 @@
-//===-- Support/Casting.h - Allow flexible, checked, casts -------*- C++ -*--=//
+//===-- Support/Casting.h - Allow flexible, checked, casts ------*- C++ -*-===//
+// 
+//                     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 defines the isa<X>(), cast<X>(), dyn_cast<X>(), cast_or_null<X>(),
 // and dyn_cast_or_null<X>() templates.
@@ -8,8 +15,6 @@
 #ifndef SUPPORT_CASTING_H
 #define SUPPORT_CASTING_H
 
-#include <assert.h>
-
 //===----------------------------------------------------------------------===//
 //                          isa<x> Support Templates
 //===----------------------------------------------------------------------===//
@@ -64,7 +69,7 @@ struct isa_impl_wrap<To, const FromTy, const FromTy> {
 };
 
 // isa_impl_cl - Use class partial specialization to transform types to a single
-// cannonical form for isa_impl.
+// canonical form for isa_impl.
 //
 template<typename FromCl>
 struct isa_impl_cl {
@@ -186,7 +191,7 @@ template<class To, class FromTy> struct cast_convert_val<To,FromTy,FromTy> {
 //
 template <class X, class Y>
 inline typename cast_retty<X, Y>::ret_type cast(const Y &Val) {
-  assert(isa<X>(Val) && "cast<Ty>() argument of uncompatible type!");
+  assert(isa<X>(Val) && "cast<Ty>() argument of incompatible type!");
   return cast_convert_val<X, Y,
                           typename simplify_type<Y>::SimpleType>::doit(Val);
 }
@@ -197,7 +202,7 @@ inline typename cast_retty<X, Y>::ret_type cast(const Y &Val) {
 template <class X, class Y>
 inline typename cast_retty<X, Y*>::ret_type cast_or_null(Y *Val) {
   if (Val == 0) return 0;
-  assert(isa<X>(Val) && "cast_or_null<Ty>() argument of uncompatible type!");
+  assert(isa<X>(Val) && "cast_or_null<Ty>() argument of incompatible type!");
   return cast<X>(Val);
 }
 
@@ -207,7 +212,7 @@ inline typename cast_retty<X, Y*>::ret_type cast_or_null(Y *Val) {
 // be used to test for a type as well as cast if successful.  This should be
 // used in the context of an if statement like this:
 //
-//  if (const Instruction *I = dyn_cast<const Instruction>(myVal)) { ... }
+//  if (const Instruction *I = dyn_cast<Instruction>(myVal)) { ... }
 //
 
 template <class X, class Y>
@@ -219,8 +224,8 @@ 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(Y *Val) {
-  return (Val && isa<X>(Val)) ? cast<X, Y*>(Val) : 0;
+inline typename cast_retty<X, Y>::ret_type dyn_cast_or_null(Y Val) {
+  return (Val && isa<X>(Val)) ? cast<X, Y>(Val) : 0;
 }