From d38172181012d0eab2c30a58d9ca97f193bf67a5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 26 Jan 2009 22:24:27 +0000 Subject: [PATCH] Fix a bug I introduced in my changes, which caused MeasureTokenLength to crash when given an instantiation location. Thanks to Fariborz for the testcase. llvm-svn: 63057 --- clang/lib/Lex/Lexer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 7f14e7a4a2df..986dd13d5d8f 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/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;