diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-11-16 05:44:20 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-11-16 05:44:20 +0000 |
commit | 05d9d7aa2d5dcb92ff434143803cdaf70a21c9f9 (patch) | |
tree | 1f76937052d7e6a7b30caa9cda8e8d9ee06e5b9a | |
parent | 8dfa2b3a5b818aa888d21eed8585e3d1b9d3506b (diff) |
Set the cast kind for a few more code paths.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88893 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaCXXCast.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index 2ccad80bdc..3d68e6a109 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/lib/Sema/SemaCXXCast.cpp @@ -388,8 +388,10 @@ CheckStaticCast(Sema &Self, Expr *&SrcExpr, QualType DestType, // 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 @@ static TryCastResult TryStaticCast(Sema &Self, Expr *&SrcExpr, 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 @@ static TryCastResult TryStaticCast(Sema &Self, Expr *&SrcExpr, msg = diag::err_bad_cxx_cast_const_away; return TC_Failed; } + Kind = CastExpr::CK_BitCast; return TC_Success; } } @@ -857,6 +862,7 @@ TryStaticImplicitCast(Sema &Self, Expr *&SrcExpr, QualType DestType, 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) ? |