diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-14 23:22:57 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-14 23:22:57 +0000 |
commit | 184e65d363aa9148c3935ca445bb823e6e0d3617 (patch) | |
tree | a96cc2e85d6e328bc5623f14a4dcc1801cc3656e /clang/lib/Frontend/HTMLDiagnostics.cpp | |
parent | 6c6aea914ab003284feb2ad49627007dd525940e (diff) | |
download | bcm5719-llvm-184e65d363aa9148c3935ca445bb823e6e0d3617.tar.gz bcm5719-llvm-184e65d363aa9148c3935ca445bb823e6e0d3617.zip |
Change Lexer::MeasureTokenLength to take a LangOptions reference.
This allows it to accurately measure tokens, so that we get:
t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~~^
instead of the woefully inferior:
t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~ ^
Most of this is just plumbing to push the reference around.
llvm-svn: 69099
Diffstat (limited to 'clang/lib/Frontend/HTMLDiagnostics.cpp')
-rw-r--r-- | clang/lib/Frontend/HTMLDiagnostics.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Frontend/HTMLDiagnostics.cpp b/clang/lib/Frontend/HTMLDiagnostics.cpp index 83c2ac56a75..752d41fb4c1 100644 --- a/clang/lib/Frontend/HTMLDiagnostics.cpp +++ b/clang/lib/Frontend/HTMLDiagnostics.cpp @@ -163,7 +163,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) { return; // FIXME: Emit a warning? // Create a new rewriter to generate HTML. - Rewriter R(const_cast<SourceManager&>(SMgr)); + Rewriter R(const_cast<SourceManager&>(SMgr), PP->getLangOptions()); // Process the path. unsigned n = D.size(); @@ -574,8 +574,8 @@ void HTMLDiagnostics::HighlightRange(Rewriter& R, FileID BugFileID, SourceRange Range, const char *HighlightStart, const char *HighlightEnd) { - - SourceManager& SM = R.getSourceMgr(); + SourceManager &SM = R.getSourceMgr(); + const LangOptions &LangOpts = R.getLangOpts(); SourceLocation InstantiationStart = SM.getInstantiationLoc(Range.getBegin()); unsigned StartLineNo = SM.getInstantiationLineNumber(InstantiationStart); @@ -596,7 +596,7 @@ void HTMLDiagnostics::HighlightRange(Rewriter& R, FileID BugFileID, if (EndColNo) { // Add in the length of the token, so that we cover multi-char tokens. - EndColNo += Lexer::MeasureTokenLength(Range.getEnd(), SM) - 1; + EndColNo += Lexer::MeasureTokenLength(Range.getEnd(), SM, LangOpts)-1; } // Highlight the range. Make the span tag the outermost tag for the |