[cfe-commits] r88893 - /cfe/trunk/lib/Sema/SemaCXXCast.cpp

Eli Friedman eli.friedman at gmail.com
Sun Nov 15 21:44:20 PST 2009


Author: efriedma
Date: Sun Nov 15 23:44:20 2009
New Revision: 88893

URL: http://llvm.org/viewvc/llvm-project?rev=88893&view=rev
Log:
Set the cast kind for a few more code paths.


Modified:
    cfe/trunk/lib/Sema/SemaCXXCast.cpp

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXCast.cpp Sun Nov 15 23:44:20 2009
@@ -388,8 +388,10 @@
   // This test is outside everything else because it's the only case where
   // a non-lvalue-reference target type does not lead to decay.
   // C++ 5.2.9p4: Any expression can be explicitly converted to type "cv void".
-  if (DestType->isVoidType())
+  if (DestType->isVoidType()) {
+    Kind = CastExpr::CK_ToVoid;
     return;
+  }
 
   if (!DestType->isLValueReferenceType() && !DestType->isRecordType())
     Self.DefaultFunctionArrayConversion(SrcExpr);
@@ -473,8 +475,10 @@
   if (DestType->isEnumeralType()) {
     if (SrcType->isComplexType() || SrcType->isVectorType()) {
       // Fall through - these cannot be converted.
-    } else if (SrcType->isArithmeticType() || SrcType->isEnumeralType())
+    } else if (SrcType->isArithmeticType() || SrcType->isEnumeralType()) {
+      Kind = CastExpr::CK_IntegralCast;
       return TC_Success;
+    }
   }
 
   // Reverse pointer upcast. C++ 4.10p3 specifies pointer upcast.
@@ -507,6 +511,7 @@
             msg = diag::err_bad_cxx_cast_const_away;
             return TC_Failed;
           }
+          Kind = CastExpr::CK_BitCast;
           return TC_Success;
         }
       }
@@ -857,6 +862,7 @@
     return TC_NotApplicable;
 
   // The conversion is possible, so commit to it.
+  Kind = CastExpr::CK_NoOp;
   msg = 0;
   return Self.PerformImplicitConversion(SrcExpr, DestType, ICS, "casting",
                                         /*IgnoreBaseAccess*/CStyle) ?





More information about the cfe-commits mailing list