diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-05-11 21:39:18 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-05-11 21:39:18 +0000 |
commit | df8755884e039d3f313ee0fea42b955257b5e240 (patch) | |
tree | 26513c4ed7ca970b3b266d35056c2a03d92deb69 /lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp | |
parent | 8aeb1471ef62a4befba00721925a3717914f21d8 (diff) |
The Lexer constructor expects a source location at the start of the
file buffer, not at the start of lexing.
Fixes assertion hit in format diagnostics. rdar://11418366
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156647 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp index 629f1eab43..f1ce8786a1 100644 --- a/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -441,9 +441,10 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID, FullSourceLoc L = MP->getLocation().asLocation().getExpansionLoc(); assert(L.isFileID()); StringRef BufferInfo = L.getBufferData(); - const char* MacroName = L.getDecomposedLoc().second + BufferInfo.data(); - Lexer rawLexer(L, PP.getLangOpts(), BufferInfo.begin(), - MacroName, BufferInfo.end()); + std::pair<FileID, unsigned> LocInfo = L.getDecomposedLoc(); + const char* MacroName = LocInfo.second + BufferInfo.data(); + Lexer rawLexer(SM.getLocForStartOfFile(LocInfo.first), PP.getLangOpts(), + BufferInfo.begin(), MacroName, BufferInfo.end()); Token TheTok; rawLexer.LexFromRawLexer(TheTok); |