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 | d38172181012d0eab2c30a58d9ca97f193bf67a5 (patch) | |
tree | 341d75e5afa34b9c3d965d225a68a3603fe2fa5a /clang/lib/Lex/Lexer.cpp | |
parent | b6d36e1d14edc54d137f6b36c85b042b6dfe17d3 (diff) | |
download | bcm5719-llvm-d38172181012d0eab2c30a58d9ca97f193bf67a5.tar.gz bcm5719-llvm-d38172181012d0eab2c30a58d9ca97f193bf67a5.zip |
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
Diffstat (limited to 'clang/lib/Lex/Lexer.cpp')
-rw-r--r-- | clang/lib/Lex/Lexer.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 7f14e7a4a2d..986dd13d5d8 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<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; |