Misc. cleanups to HTML printing: make code rendered using tables; add
better div positioning for messages.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48555 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/HTMLPrint.cpp b/Driver/HTMLPrint.cpp
index 1108bc3..a6b90fa 100644
--- a/Driver/HTMLPrint.cpp
+++ b/Driver/HTMLPrint.cpp
@@ -179,19 +179,15 @@
(StrNo < NumStrs ? Strs[StrNo] : "<<<INTERNAL ERROR>>>") +
std::string(Msg.begin() + i + 2, Msg.end());
}
- }
-
- // Start making the div tag.
+ }
+
+ // Create the html for the message.
std::ostringstream os;
- os << "\n<div class=\"codeline\"><div class=\"nums\"> </div>"
- << "<div class=\"lines\">";
-
- for (unsigned i = 0; i < ColNo+1; ++i)
- os << ' ';
-
- os << "</div><span class=\"msg\">";
+ os << "\n<tr><td class=\"num\"></td><td class=\"line\">"
+ << "<div class=\"msg\" style=\"margin-left:"
+ << ColNo << "ex\">";
switch (DiagLevel) {
default: assert(0 && "Unknown diagnostic type!");
@@ -202,15 +198,13 @@
break;
}
- os << Msg; // FIXME: HTML escape "Msg"
- os << "</span></div";
+ os << Msg << "</div></td></tr>";
- // Insert a div tag with the warning.
+ // Insert the new html.
const llvm::MemoryBuffer *Buf = R.getSourceMgr().getBuffer(FileID);
const char* FileStart = Buf->getBufferStart();
-
R.InsertStrBefore(SourceLocation::getFileLoc(FileID, LineStart - FileStart),
os.str());
}