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
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index d5dff50..67f493c 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -1399,7 +1399,10 @@
CK_IntegralToPointer,
/// CK_PointerToIntegral - Pointer to integral
- CK_PointerToIntegral
+ CK_PointerToIntegral,
+
+ /// CK_ToVoid - Cast to void.
+ CK_ToVoid
};
private:
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 0e4a29f..fa999ff 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -426,6 +426,8 @@
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 d818a50..279f50b 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3157,7 +3157,11 @@
// 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())) {