summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-10-09 00:17:57 +0000
committerEric Fiselier <eric@efcs.ca>2015-10-09 00:17:57 +0000
commit18677d51e04af0b4a11212047dbbeefdd0231869 (patch)
tree9829d5ec07c89a8bfaeecf56ef346f3f416458a9 /clang/lib/Sema
parentebef256269997b5466d387c2a8b0ce93b34142eb (diff)
downloadbcm5719-llvm-18677d51e04af0b4a11212047dbbeefdd0231869.tar.gz
bcm5719-llvm-18677d51e04af0b4a11212047dbbeefdd0231869.zip
Skip NonNull sema checks in unevaluated contexts.
Summary: Currently when a function annotated with __attribute__((nonnull)) is called in an unevaluated context with a null argument a -Wnonnull warning is emitted. This warning seems like a false positive unless the call expression is potentially evaluated. Change this behavior so that the non-null warnings use DiagRuntimeBehavior so they wont emit when they won't be evaluated. Reviewers: majnemer, rsmith Subscribers: mclow.lists, cfe-commits Differential Revision: http://reviews.llvm.org/D13408 llvm-svn: 249787
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 599a0e4be21..a8d882a635e 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -1151,7 +1151,8 @@ static void CheckNonNullArgument(Sema &S,
const Expr *ArgExpr,
SourceLocation CallSiteLoc) {
if (CheckNonNullExpr(S, ArgExpr))
- S.Diag(CallSiteLoc, diag::warn_null_arg) << ArgExpr->getSourceRange();
+ S.DiagRuntimeBehavior(CallSiteLoc, ArgExpr,
+ S.PDiag(diag::warn_null_arg) << ArgExpr->getSourceRange());
}
bool Sema::GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx) {
OpenPOWER on IntegriCloud