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
This commit is contained in:
Chris Lattner 2009-01-26 22:24:27 +00:00
parent b6d36e1d14
commit d381721810
1 changed files with 2 additions and 1 deletions

View 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;