aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/TokenLexer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Lex/TokenLexer.cpp')
-rw-r--r--lib/Lex/TokenLexer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp
index ea4ce669d1..3707ef1ed6 100644
--- a/lib/Lex/TokenLexer.cpp
+++ b/lib/Lex/TokenLexer.cpp
@@ -31,7 +31,14 @@ void TokenLexer::Init(Token &Tok, MacroArgs *Actuals) {
Macro = PP.getMacroInfo(Tok.getIdentifierInfo());
ActualArgs = Actuals;
CurToken = 0;
+
InstantiateLoc = Tok.getLocation();
+
+ // If the instantiation loc is not already a FileID, resolve it here. If we
+ // don't do this, we end up doing it once per token lexed.
+ if (!InstantiateLoc.isFileID())
+ InstantiateLoc = PP.getSourceManager().getInstantiationLoc(InstantiateLoc);
+
AtStartOfLine = Tok.isAtStartOfLine();
HasLeadingSpace = Tok.hasLeadingSpace();
Tokens = &*Macro->tokens_begin();