Skip to content

Commit f81ef9c

Browse files
committed
Prepend "diagnostic produced by Clang:" to Clang diagnostics.
1 parent 323721b commit f81ef9c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lib/Frontend/DiagnosticVerifier.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ namespace {
110110
/// diagnostics for '<unknown>:0' should be considered as unexpected.
111111
bool verifyUnknown();
112112

113-
void printRemainingDiagnostics();
113+
void printRemainingDiagnostics() const;
114114

115115
/// If there are any -verify errors (e.g. differences between expectations
116116
/// and actual diagnostics produced), apply fixits to the original source
@@ -698,9 +698,12 @@ bool DiagnosticVerifier::verifyUnknown() {
698698
return HadError;
699699
}
700700

701-
void DiagnosticVerifier::printRemainingDiagnostics() {
702-
for (const auto &diag: CapturedDiagnostics) {
703-
SM.getLLVMSourceMgr().PrintMessage(llvm::errs(), diag);
701+
void DiagnosticVerifier::printRemainingDiagnostics() const {
702+
for (const auto &diag : CapturedDiagnostics) {
703+
SM.getLLVMSourceMgr().PrintMessage(
704+
llvm::errs(), diag.getLoc(), diag.getKind(),
705+
"diagnostic produced by Clang: " + diag.getMessage(),
706+
/*Ranges=*/ {}, diag.getFixIts());
704707
}
705708
}
706709

test/Frontend/verify-broken-c-module.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
// RUN: not %target-typecheck-verify-swift -I %S/Inputs/broken-c-module 2>&1 | %FileCheck %s
77

88
// CHECK: [[@LINE+3]]:8: error: unexpected error produced: could not build
9-
// CHECK: note: in file included from <module-includes>
10-
// CHECK: broken_c.h:2:11: error: expected function body after function declarator
9+
// CHECK: note: diagnostic produced by Clang: in file included from <module-includes>
10+
// CHECK: broken_c.h:2:11: error: diagnostic produced by Clang: expected function body after function declarator
1111
import BrokenCModule

0 commit comments

Comments
 (0)