aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-03-08 04:07:54 +0000
committerJohn McCall <rjmccall@apple.com>2011-03-08 04:07:54 +0000
commitd45e4b767458104d7e842e253cd03df01ccba3f4 (patch)
tree452929aa40ace39e347f379d0fd1127ae7f1bcf1
parent30900dafbe972f4802c2663262b4393edab0d1cd (diff)
Update the check for a NULL macro to use Preprocessor::getSpelling().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127217 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index f97d1a8f12..c4218c3365 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -5261,11 +5261,9 @@ bool Sema::DiagnoseConditionalForNull(Expr *LHS, Expr *RHS,
// In this case, check to make sure that we got here from a "NULL"
// string in the source code.
NullExpr = NullExpr->IgnoreParenImpCasts();
- SourceManager& SM = Context.getSourceManager();
- SourceLocation Loc = SM.getInstantiationLoc(NullExpr->getExprLoc());
- unsigned Len =
- Lexer::MeasureTokenLength(Loc, SM, Context.getLangOptions());
- if (Len != 4 || memcmp(SM.getCharacterData(Loc), "NULL", 4))
+ SourceLocation Loc =
+ getSourceManager().getInstantiationLoc(NullExpr->getExprLoc());
+ if (getPreprocessor().getSpelling(Loc) != "NULL")
return false;
}