aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2013-01-09 02:20:00 +0000
committerEli Friedman <eli.friedman@gmail.com>2013-01-09 02:20:00 +0000
commita0f2d02d166880e5d826074b6c2ecbf64f8ca70d (patch)
tree75ec385ca0e5b01e621b6059404b216f0efbc329 /lib/Lex
parent7dc80e1c4dd44ce2b2da0fc3daff786c3d02348b (diff)
Make __has_include a bit more resilient in the presence of macros. <rdar://problem/12748859>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex')
-rw-r--r--lib/Lex/PPMacroExpansion.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index 3de6cdb39d..1b8fcbac33 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -985,8 +985,14 @@ static bool EvaluateHasIncludeCommon(Token &Tok,
// Save '(' location for possible missing ')' message.
LParenLoc = Tok.getLocation();
- // Get the file name.
- PP.getCurrentLexer()->LexIncludeFilename(Tok);
+ if (PP.getCurrentLexer()) {
+ // Get the file name.
+ PP.getCurrentLexer()->LexIncludeFilename(Tok);
+ } else {
+ // We're in a macro, so we can't use LexIncludeFilename; just
+ // grab the next token.
+ PP.Lex(Tok);
+ }
}
// Reserve a buffer to get the spelling.