diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-04-01 06:13:56 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-04-01 06:13:56 +0000 |
commit | 5fb5dfb6646464db3cd6d54a6332375c8fe36b75 (patch) | |
tree | 0c5fc288044b8320b5337de39cb1d2dddc7c0bde /lib/Frontend/HTMLDiagnostics.cpp | |
parent | 360431660b2245a109f5c6870729126dbcdea254 (diff) |
- Changed PathDiagnosticPiece::getLocation() to return a PathDiagnosticLocation
instead of a FullSourceLoc. This resulted in a bunch of small edits in various
clients.
- Updated BugReporter to include an alternate PathDiagnostic generation
algorithm for PathDiagnosticClients desiring more control-flow pieces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68193 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/HTMLDiagnostics.cpp')
-rw-r--r-- | lib/Frontend/HTMLDiagnostics.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/lib/Frontend/HTMLDiagnostics.cpp b/lib/Frontend/HTMLDiagnostics.cpp index 0b266cda0f..fbca057849 100644 --- a/lib/Frontend/HTMLDiagnostics.cpp +++ b/lib/Frontend/HTMLDiagnostics.cpp @@ -130,12 +130,12 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) { if (noDir) return; - SourceManager &SMgr = D.begin()->getLocation().getManager(); + const SourceManager &SMgr = D.begin()->getLocation().getManager(); FileID FID; // Verify that the entire path is from the same FileID. for (PathDiagnostic::const_iterator I = D.begin(), E = D.end(); I != E; ++I) { - FullSourceLoc L = I->getLocation().getInstantiationLoc(); + FullSourceLoc L = I->getLocation().asLocation().getInstantiationLoc(); if (FID.isInvalid()) { FID = SMgr.getFileID(L); @@ -162,7 +162,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) { return; // FIXME: Emit a warning? // Create a new rewriter to generate HTML. - Rewriter R(SMgr); + Rewriter R(const_cast<SourceManager&>(SMgr)); // Process the path. unsigned n = D.size(); @@ -215,18 +215,18 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) { llvm::raw_string_ostream os(s); os << "<!-- REPORTHEADER -->\n" - << "<h3>Bug Summary</h3>\n<table class=\"simpletable\">\n" + << "<h3>Bug Summary</h3>\n<table class=\"simpletable\">\n" "<tr><td class=\"rowname\">File:</td><td>" - << html::EscapeText(DirName) - << html::EscapeText(Entry->getName()) - << "</td></tr>\n<tr><td class=\"rowname\">Location:</td><td>" - "<a href=\"#EndPath\">line " - << (*D.rbegin()).getLocation().getInstantiationLineNumber() - << ", column " - << (*D.rbegin()).getLocation().getInstantiationColumnNumber() - << "</a></td></tr>\n" - "<tr><td class=\"rowname\">Description:</td><td>" - << D.getDescription() << "</td></tr>\n"; + << html::EscapeText(DirName) + << html::EscapeText(Entry->getName()) + << "</td></tr>\n<tr><td class=\"rowname\">Location:</td><td>" + "<a href=\"#EndPath\">line " + << (*D.rbegin()).getLocation().asLocation().getInstantiationLineNumber() + << ", column " + << (*D.rbegin()).getLocation().asLocation().getInstantiationColumnNumber() + << "</a></td></tr>\n" + "<tr><td class=\"rowname\">Description:</td><td>" + << D.getDescription() << "</td></tr>\n"; // Output any other meta data. @@ -280,7 +280,8 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) { std::string s; llvm::raw_string_ostream os(s); os << "\n<!-- BUGLINE " - << D.back()->getLocation().getInstantiationLineNumber() << " -->\n"; + << D.back()->getLocation().asLocation().getInstantiationLineNumber() + << " -->\n"; R.InsertStrBefore(SMgr.getLocForStartOfFile(FID), os.str()); } @@ -336,7 +337,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID, // For now, just draw a box above the line in question, and emit the // warning. - FullSourceLoc Pos = P.getLocation(); + FullSourceLoc Pos = P.getLocation().asLocation(); if (!Pos.isValid()) return; @@ -460,7 +461,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID, // Get the name of the macro by relexing it. { - FullSourceLoc L = MP->getLocation().getInstantiationLoc(); + FullSourceLoc L = MP->getLocation().asLocation().getInstantiationLoc(); assert(L.isFileID()); std::pair<const char*, const char*> BufferInfo = L.getBufferData(); const char* MacroName = L.getDecomposedLoc().second + BufferInfo.first; |