aboutsummaryrefslogtreecommitdiff
path: root/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
commit5a24980d059cd9fbe8375a4c549313101ad20698 (patch)
tree438eb46b0e55cae7bd828e7d914440cc4f607664 /lib/Sema/SemaChecking.cpp
parent1e905da74dbfd353d77dfc548fc9d6ff420d515a (diff)
Handle CK_NullToPointer casts in -Wtype-safety properly. Fixes PR14249.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167358 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r--lib/Sema/SemaChecking.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 6a39ff003c..4a5e8e05c7 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/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();