]> granicus.if.org Git - clang/commitdiff
Make StmtDumper::VisitCXXFunctionalCastExpr dump the attached cast kind. Fix the...
authorEli Friedman <eli.friedman@gmail.com>
Fri, 2 Sep 2011 17:38:59 +0000 (17:38 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Fri, 2 Sep 2011 17:38:59 +0000 (17:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139011 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/StmtDumper.cpp
lib/Sema/SemaCXXCast.cpp

index ce4ae8e77326c19816a636b50a4f8a4273ce5b06..473837b330bb221da36ba02f6fd9d95284fedc9f 100644 (file)
@@ -557,7 +557,8 @@ void StmtDumper::VisitCXXThisExpr(CXXThisExpr *Node) {
 
 void StmtDumper::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *Node) {
   DumpExpr(Node);
-  OS << " functional cast to " << Node->getTypeAsWritten().getAsString();
+  OS << " functional cast to " << Node->getTypeAsWritten().getAsString()
+     << " <" << Node->getCastKindName() << ">";
 }
 
 void StmtDumper::VisitCXXConstructExpr(CXXConstructExpr *Node) {
index 2c6b8e748bc57188a12939be8fb53b8ad1d1bedb..708433f62caa343f829efbbaef8de5f9bcc67d1e 100644 (file)
@@ -815,11 +815,12 @@ static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr,
   // The same goes for reverse floating point promotion/conversion and
   // floating-integral conversions. Again, only floating->enum is relevant.
   if (DestType->isEnumeralType()) {
-    if (SrcType->isComplexType() || SrcType->isVectorType()) {
-      // Fall through - these cannot be converted.
-    } else if (SrcType->isArithmeticType() || SrcType->isEnumeralType()) {
+    if (SrcType->isIntegralOrEnumerationType()) {
       Kind = CK_IntegralCast;
       return TC_Success;
+    } else if (SrcType->isRealFloatingType())   {
+      Kind = CK_FloatingToIntegral;
+      return TC_Success;
     }
   }