[cfe-commits] r84241 - in /cfe/trunk: include/clang/AST/Expr.h lib/AST/Expr.cpp lib/Sema/SemaExpr.cpp

Anders Carlsson andersca at mac.com
Thu Oct 15 19:35:05 PDT 2009


Author: andersca
Date: Thu Oct 15 21:35:04 2009
New Revision: 84241

URL: http://llvm.org/viewvc/llvm-project?rev=84241&view=rev
Log:
Add a ToVoid cast kind and start using it.

Modified:
    cfe/trunk/include/clang/AST/Expr.h
    cfe/trunk/lib/AST/Expr.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=84241&r1=84240&r2=84241&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Thu Oct 15 21:35:04 2009
@@ -1399,7 +1399,10 @@
     CK_IntegralToPointer,
     
     /// CK_PointerToIntegral - Pointer to integral
-    CK_PointerToIntegral
+    CK_PointerToIntegral,
+    
+    /// CK_ToVoid - Cast to void.
+    CK_ToVoid
   };
 
 private:

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=84241&r1=84240&r2=84241&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Thu Oct 15 21:35:04 2009
@@ -426,6 +426,8 @@
     return "IntegralToPointer";
   case CastExpr::CK_PointerToIntegral:
     return "PointerToIntegral";
+  case CastExpr::CK_ToVoid:
+    return "ToVoid";
   }
 
   assert(0 && "Unhandled cast kind!");

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=84241&r1=84240&r2=84241&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Oct 15 21:35:04 2009
@@ -3157,7 +3157,11 @@
   // type needs to be scalar.
   if (castType->isVoidType()) {
     // Cast to void allows any expr type.
-  } else if (!castType->isScalarType() && !castType->isVectorType()) {
+    Kind = CastExpr::CK_ToVoid;
+    return false;
+  }
+  
+  if (!castType->isScalarType() && !castType->isVectorType()) {
     if (Context.getCanonicalType(castType).getUnqualifiedType() ==
         Context.getCanonicalType(castExpr->getType().getUnqualifiedType()) &&
         (castType->isStructureType() || castType->isUnionType())) {





More information about the cfe-commits mailing list