aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-02-03 05:58:16 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-02-03 05:58:16 +0000
commit8deabc133c121f6c5561d0b2171a41cb2c29b2ce (patch)
tree3d2b0078b45d100de8f0e55ff0c46c7cfd8f60c5 /lib/Sema/SemaExpr.cpp
parentd603bd12680c832d81f98568223ce0171e16a967 (diff)
Move isSentinelNullExpr() from Sema to ASTContext to make it more widely
available. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149675 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp20
1 files changed, 1 insertions, 19 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 175c0c1648..df17297e47 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -249,7 +249,7 @@ void Sema::DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc,
Expr *sentinelExpr = args[numArgs - numArgsAfterSentinel - 1];
if (!sentinelExpr) return;
if (sentinelExpr->isValueDependent()) return;
- if (isSentinelNullExpr(sentinelExpr)) 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
@@ -279,24 +279,6 @@ SourceRange Sema::getExprRange(Expr *E) const {
return E ? E->getSourceRange() : SourceRange();
}
-bool Sema::isSentinelNullExpr(const Expr *E) const {
- if (!E)
- return false;
-
- // nullptr_t is always treated as null.
- if (E->getType()->isNullPtrType()) return true;
-
- if (E->getType()->isAnyPointerType() &&
- E->IgnoreParenCasts()->isNullPointerConstant(Context,
- Expr::NPC_ValueDependentIsNull))
- return true;
-
- // Unfortunately, __null has type 'int'.
- if (isa<GNUNullExpr>(E)) return true;
-
- return false;
-}
-
//===----------------------------------------------------------------------===//
// Standard Promotions and Conversions
//===----------------------------------------------------------------------===//