aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/TokenLexer.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-12-19 23:55:44 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-12-19 23:55:44 +0000
commitb29740ae158f9421096a28bcc7ad6af7171b1874 (patch)
tree76b21f5b8aabb43b5f2280989a8351f8d2d96aac /lib/Lex/TokenLexer.cpp
parent6b248dbd6347d73bb2c44103a4f3b2a521050107 (diff)
[preprocessor] When "merging" macro argument tokens into one SLocEntry chunk,
make sure they came from the same kind of FileIDs. Thanks to Abramo Bagnara for providing the test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170616 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/TokenLexer.cpp')
-rw-r--r--lib/Lex/TokenLexer.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp
index 8c6f6204eb..5b41fe9b8d 100644
--- a/lib/Lex/TokenLexer.cpp
+++ b/lib/Lex/TokenLexer.cpp
@@ -749,14 +749,18 @@ static void updateConsecutiveMacroArgTokens(SourceManager &SM,
Token *NextTok = begin_tokens + 1;
for (; NextTok < end_tokens; ++NextTok) {
+ SourceLocation NextLoc = NextTok->getLocation();
+ if (CurLoc.isFileID() != NextLoc.isFileID())
+ break; // Token from different kind of FileID.
+
int RelOffs;
- if (!SM.isInSameSLocAddrSpace(CurLoc, NextTok->getLocation(), &RelOffs))
+ if (!SM.isInSameSLocAddrSpace(CurLoc, NextLoc, &RelOffs))
break; // Token from different local/loaded location.
// Check that token is not before the previous token or more than 50
// "characters" away.
if (RelOffs < 0 || RelOffs > 50)
break;
- CurLoc = NextTok->getLocation();
+ CurLoc = NextLoc;
}
// For the consecutive tokens, find the length of the SLocEntry to contain