summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-11-13 23:19:36 +0000
committerReid Kleckner <reid@kleckner.net>2014-11-13 23:19:36 +0000
commit92493e5e96b86f4976499eacc9233461ade1de8d (patch)
tree1b7e018d157b55138928f51c1bb77c3ae48b397a /clang/lib/Sema/SemaExpr.cpp
parent29d880bdc709a2b8587818d0e5ca0fd3568c7b12 (diff)
downloadbcm5719-llvm-92493e5e96b86f4976499eacc9233461ade1de8d.tar.gz
bcm5719-llvm-92493e5e96b86f4976499eacc9233461ade1de8d.zip
-Wsentinel: Suggest nullptr in C++11 instead of NULL
llvm-svn: 221945
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index dda9d88abac..de080117b49 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -398,8 +398,8 @@ void Sema::DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc,
if (sentinelExpr->isValueDependent()) return;
if (Context.isSentinelNullExpr(sentinelExpr)) return;
- // Pick a reasonable string to insert. Optimistically use 'nil' or
- // 'NULL' if those are actually defined in the context. Only use
+ // Pick a reasonable string to insert. Optimistically use 'nil', 'nullptr',
+ // or 'NULL' if those are actually defined in the context. Only use
// 'nil' for ObjC methods, where it's much more likely that the
// variadic arguments form a list of object pointers.
SourceLocation MissingNilLoc
@@ -408,6 +408,8 @@ void Sema::DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc,
if (calleeType == CT_Method &&
PP.getIdentifierInfo("nil")->hasMacroDefinition())
NullValue = "nil";
+ else if (getLangOpts().CPlusPlus11)
+ NullValue = "nullptr";
else if (PP.getIdentifierInfo("NULL")->hasMacroDefinition())
NullValue = "NULL";
else
OpenPOWER on IntegriCloud