diff options
author | Anders Carlsson <andersca@mac.com> | 2009-10-16 02:35:04 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-10-16 02:35:04 +0000 |
commit | ebeaf2031c968143c531bfe232d7507f20c57347 (patch) | |
tree | 495356a7dc7028d739c21b79d9ce8bbde83efea4 /lib | |
parent | 5a3ce9b10c164d9bf75a70d429e55d4e171a9a9e (diff) |
Add a ToVoid cast kind and start using it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84241 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/Expr.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 0e4a29f916..fa999ffe35 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -426,6 +426,8 @@ const char *CastExpr::getCastKindName() const { return "IntegralToPointer"; case CastExpr::CK_PointerToIntegral: return "PointerToIntegral"; + case CastExpr::CK_ToVoid: + return "ToVoid"; } assert(0 && "Unhandled cast kind!"); diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index d818a5027e..279f50b9a7 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -3157,7 +3157,11 @@ bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *&castExpr, // 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())) { |