aboutsummaryrefslogtreecommitdiff
path: root/Driver/HTMLPrint.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-14 21:14:03 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-14 21:14:03 +0000
commit3004be018c7b542bb6cb457c613086d9cddc61f4 (patch)
tree1602dbdc173469a6f574c1a76e67a2a4e906ab06 /Driver/HTMLPrint.cpp
parent5dd004125aea94c667162b92d574c66d49b461d8 (diff)
Convert over to new SourceManager::isFromMainFile() instead of doing direct
FileID comparison (fixes insidious corner case with chunks). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49684 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/HTMLPrint.cpp')
-rw-r--r--Driver/HTMLPrint.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/Driver/HTMLPrint.cpp b/Driver/HTMLPrint.cpp
index ef20395530..77e85d71e0 100644
--- a/Driver/HTMLPrint.cpp
+++ b/Driver/HTMLPrint.cpp
@@ -157,16 +157,13 @@ void HTMLDiagnostic::HandleDiagnostic(Diagnostic &Diags,
SourceManager& SM = R.getSourceMgr();
FullSourceLoc LPos = Pos.getLogicalLoc();
- unsigned FileID = LPos.getLocation().getFileID();
+ unsigned FileID = SM.getCanonicalFileID(LPos.getLocation());
assert (&LPos.getManager() == &SM && "SourceManagers are different!");
- unsigned MainFileID = SM.getMainFileID();
-
- if (FileID != MainFileID)
+ if (!SM.isFromMainFile(LPos.getLocation()))
return;
-
// Compute the column number. Rewind from the current position to the start
// of the line.
@@ -228,13 +225,12 @@ void HTMLDiagnostic::HandleDiagnostic(Diagnostic &Diags,
++Ranges;
- if (B.getFileID() != MainFileID || E.getFileID() != MainFileID)
+ if (!SM.isFromMainFile(B) || !SM.isFromMainFile(E))
continue;
// Highlight the range. Make the span tag the outermost tag for the
// selected range.
R.InsertCStrBefore(B, "<span class=\"mrange\">");
R.InsertCStrAfter(E, "</span>");
- }
-
+ }
}