]> granicus.if.org Git - clang/commitdiff
Fix a bug I introduced in my changes, which caused MeasureTokenLength
authorChris Lattner <sabre@nondot.org>
Mon, 26 Jan 2009 22:24:27 +0000 (22:24 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 26 Jan 2009 22:24:27 +0000 (22:24 +0000)
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

lib/Lex/Lexer.cpp

index 7f14e7a4a2df20301e8d990afea2df10169ed238..986dd13d5d8f8332ed908cf53a6a2337fdee28b3 100644 (file)
@@ -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;