diff options
author | Anders Carlsson <andersca@mac.com> | 2010-11-05 15:21:33 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-11-05 15:21:33 +0000 |
commit | 343e6ffa70459b1afdb488c69fb651434a5016c0 (patch) | |
tree | a160e0b44d0b29c51e481e7352bddcfd2df84820 /lib | |
parent | bf44c3b099602c9c967f1b20995919fb4ef39a51 (diff) |
Expressions of type std::nullptr_t can be used as sentinels.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118276 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 6df818cd7a..9ac4ce88d1 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -193,6 +193,10 @@ void Sema::DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc, if (!sentinelExpr) return; if (sentinelExpr->isTypeDependent()) return; if (sentinelExpr->isValueDependent()) return; + + // nullptr_t is always treated as null. + if (sentinelExpr->getType()->isNullPtrType()) return; + if (sentinelExpr->getType()->isAnyPointerType() && sentinelExpr->IgnoreParenCasts()->isNullPointerConstant(Context, Expr::NPC_ValueDependentIsNull)) |