summaryrefslogtreecommitdiffstats
path: root/lib/Lex/TokenLexer.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-07-07 23:56:36 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-07-07 23:56:36 +0000
commitc8d1ecca1cd3fadbd331d15c420755aa6184554b (patch)
tree5ca4278df831905487693dc9d23680f611b60f7e /lib/Lex/TokenLexer.cpp
parent78b929121f44f7c983fce8c871aa913dce087561 (diff)
Keep track of which source locations are part of a macro argument
instantiation and improve diagnostics which are stem from macro arguments to trace the argument itself back through the layers of macro expansion. This requires some tricky handling of the source locations, as the argument appears to be expanded in the opposite direction from the surrounding macro. This patch provides helper routines that encapsulate the logic and explain the reasoning behind how we step through macros during diagnostic printing. This fixes the rest of the test cases originially in PR9279, and later split out into PR10214 and PR10215. There is still some more work we can do here to improve the macro backtrace, but those will follow as separate patches. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134660 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/TokenLexer.cpp')
-rw-r--r--lib/Lex/TokenLexer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp
index e2b002549a..fac6b7dc3e 100644
--- a/lib/Lex/TokenLexer.cpp
+++ b/lib/Lex/TokenLexer.cpp
@@ -231,9 +231,9 @@ void TokenLexer::ExpandFunctionArguments() {
"Expected arg identifier to come from definition");
for (unsigned i = FirstResult, e = ResultToks.size(); i != e; ++i) {
Token &Tok = ResultToks[i];
- Tok.setLocation(SM.createInstantiationLoc(Tok.getLocation(),
- curInst, curInst,
- Tok.getLength()));
+ Tok.setLocation(SM.createMacroArgInstantiationLoc(Tok.getLocation(),
+ curInst,
+ Tok.getLength()));
}
}