]> granicus.if.org Git - clang/commitdiff
Added guard for printing out PathDiagnostics whose last element ends with
authorTed Kremenek <kremenek@apple.com>
Thu, 3 Apr 2008 07:13:10 +0000 (07:13 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 3 Apr 2008 07:13:10 +0000 (07:13 +0000)
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

Driver/HTMLDiagnostics.cpp

index 69e77bc2fe000cf9762b6613e9813f88ab3161c1..c29096d0f68232ac7f58895ec35abfe0d7c551b3 100644 (file)
@@ -74,6 +74,9 @@ void HTMLDiagnostics::HandlePathDiagnostic(const PathDiagnostic& D) {
   if (D.empty())
     return;
   
+  if (!D.back()->getLocation().isFileID())
+    return;
+  
   // Create the HTML directory if it is missing.
   
   if (!createdDir) {
@@ -151,7 +154,8 @@ void HTMLDiagnostics::HandlePathDiagnostic(const PathDiagnostic& D) {
   
   {
     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());
   }