From: Chris Lattner Date: Mon, 26 Jan 2009 22:24:27 +0000 (+0000) Subject: Fix a bug I introduced in my changes, which caused MeasureTokenLength X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=363fdc29656cc03c1817268888f95e6343470aa8;p=clang 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 --- 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 LocInfo = SM.getDecomposedInstantiationLoc(Loc); + Loc = SM.getInstantiationLoc(Loc); + std::pair LocInfo = SM.getDecomposedLoc(Loc); std::pair Buffer = SM.getBufferData(LocInfo.first); const char *StrData = Buffer.first+LocInfo.second;