Added transfer function support for casting to "void".
llvm-svn: 47333
diff --git a/clang/Analysis/GRExprEngine.cpp b/clang/Analysis/GRExprEngine.cpp
index 8df9e5f..6d45bea 100644
--- a/clang/Analysis/GRExprEngine.cpp
+++ b/clang/Analysis/GRExprEngine.cpp
@@ -449,8 +449,9 @@
QualType T = CastE->getType();
- // Check for redundant casts.
- if (E->getType() == T ||
+ // Check for redundant casts or casting to "void"
+ if (T->isVoidType() ||
+ E->getType() == T ||
(T->isPointerType() && E->getType()->isFunctionType())) {
Dst.Add(Pred);
return;
diff --git a/clang/Analysis/ValueState.cpp b/clang/Analysis/ValueState.cpp
index 9638646..5796238 100644
--- a/clang/Analysis/ValueState.cpp
+++ b/clang/Analysis/ValueState.cpp
@@ -252,6 +252,10 @@
case Stmt::ImplicitCastExprClass: {
ImplicitCastExpr* C = cast<ImplicitCastExpr>(E);
QualType CT = C->getType();
+
+ if (CT->isVoidType())
+ return UnknownVal();
+
QualType ST = C->getSubExpr()->getType();
if (CT == ST || (CT->isPointerType() && ST->isFunctionType())) {
@@ -266,6 +270,9 @@
QualType CT = C->getType();
QualType ST = C->getSubExpr()->getType();
+ if (CT->isVoidType())
+ return UnknownVal();
+
if (CT == ST || (CT->isPointerType() && ST->isFunctionType())) {
E = C->getSubExpr();
continue;