[cfe-commits] r127217 - /cfe/trunk/lib/Sema/SemaExpr.cpp

John McCall rjmccall at apple.com
Mon Mar 7 20:07:54 PST 2011


Author: rjmccall
Date: Mon Mar  7 22:07:54 2011
New Revision: 127217

URL: http://llvm.org/viewvc/llvm-project?rev=127217&view=rev
Log:
Update the check for a NULL macro to use Preprocessor::getSpelling().


Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=127217&r1=127216&r2=127217&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Mar  7 22:07:54 2011
@@ -5261,11 +5261,9 @@
     // 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;
   }
 





More information about the cfe-commits mailing list