diff --git a/clang/Driver/HTMLDiagnostics.cpp b/clang/Driver/HTMLDiagnostics.cpp index 69e77bc2fe00..c29096d0f682 100644 --- a/clang/Driver/HTMLDiagnostics.cpp +++ b/clang/Driver/HTMLDiagnostics.cpp @@ -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\n"; R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str()); }