summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2012-11-03 16:07:49 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2012-11-03 16:07:49 +0000
commit5ac744e006f843ac624387c0d3c43ae7068a84a2 (patch)
treede87ef08b902eb26e51b4f473011c74cbd4cf99e /clang/lib/Sema/SemaChecking.cpp
parent941ab0fb6f6205ac83140ba3e961b136c9162779 (diff)
downloadbcm5719-llvm-5ac744e006f843ac624387c0d3c43ae7068a84a2.tar.gz
bcm5719-llvm-5ac744e006f843ac624387c0d3c43ae7068a84a2.zip
Handle CK_NullToPointer casts in -Wtype-safety properly. Fixes PR14249.
llvm-svn: 167358
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 6a39ff003c0..4a5e8e05c71 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6189,7 +6189,9 @@ void Sema::CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr,
if (IsPointerAttr) {
// Skip implicit cast of pointer to `void *' (as a function argument).
if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(ArgumentExpr))
- if (ICE->getType()->isVoidPointerType())
+ if (ICE->getType()->isVoidPointerType() &&
+ ICE->getCastKind() != CK_NullToPointer &&
+ ICE->getCastKind() != CK_NullToMemberPointer)
ArgumentExpr = ICE->getSubExpr();
}
QualType ArgumentType = ArgumentExpr->getType();
OpenPOWER on IntegriCloud