mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
Add a ToVoid cast kind and start using it.
llvm-svn: 84241
This commit is contained in:
@@ -1399,7 +1399,10 @@ public:
|
||||
CK_IntegralToPointer,
|
||||
|
||||
/// CK_PointerToIntegral - Pointer to integral
|
||||
CK_PointerToIntegral
|
||||
CK_PointerToIntegral,
|
||||
|
||||
/// CK_ToVoid - Cast to void.
|
||||
CK_ToVoid
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
@@ -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!");
|
||||
|
||||
@@ -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())) {
|
||||
|
||||
Reference in New Issue
Block a user