Added guard for printing out PathDiagnostics whose last element ends with
a piece with a SourceLocation that does not have a FileID.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49151 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/HTMLDiagnostics.cpp b/Driver/HTMLDiagnostics.cpp
index 69e77bc..c29096d 100644
--- a/Driver/HTMLDiagnostics.cpp
+++ b/Driver/HTMLDiagnostics.cpp
@@ -74,6 +74,9 @@
if (D.empty())
return;
+ if (!D.back()->getLocation().isFileID())
+ return;
+
// Create the HTML directory if it is missing.
if (!createdDir) {
@@ -151,7 +154,8 @@
{
std::ostringstream os;
- os << "\n<!-- BUGLINE " << D.back()->getLocation().getLineNumber()
+ FullSourceLoc L = D.back()->getLocation();
+ os << "\n<!-- BUGLINE " << L.getLineNumber()
<< " -->\n";
R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str());
}