diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-26 22:24:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-26 22:24:27 +0000 |
commit | 363fdc29656cc03c1817268888f95e6343470aa8 (patch) | |
tree | f7b73d6e9d33c4471c1836a0c41da9043153b3ad /lib/Lex/Lexer.cpp | |
parent | f20269b42843d10c930886ee661ee1dd37a4248b (diff) |
Fix a bug I introduced in my changes, which caused MeasureTokenLength
to crash when given an instantiation location. Thanks to Fariborz for
the testcase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63057 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 7f14e7a4a2..986dd13d5d 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -222,7 +222,8 @@ unsigned Lexer::MeasureTokenLength(SourceLocation Loc, // If this comes from a macro expansion, we really do want the macro name, not // the token this macro expanded to. - std::pair<FileID, unsigned> LocInfo = SM.getDecomposedInstantiationLoc(Loc); + Loc = SM.getInstantiationLoc(Loc); + std::pair<FileID, unsigned> LocInfo = SM.getDecomposedLoc(Loc); std::pair<const char *,const char *> Buffer = SM.getBufferData(LocInfo.first); const char *StrData = Buffer.first+LocInfo.second; |