forked from OSchip/llvm-project
Make StmtDumper::VisitCXXFunctionalCastExpr dump the attached cast kind. Fix the cast kind for a cast from floating-point to enum type. (The difference isn't actually visible, but that's just because IRGen is overly forgiving.) Per report by Enea Zaffanella on cfe-dev.
llvm-svn: 139011
This commit is contained in:
parent
4a31ba3bae
commit
29538899ef
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue