Skip to content

Commit 8efe6a6

Browse files
committed
[New diagnostics] Don't aggregate across warnings/errors.
The "grouped diagnostics" feature can handle multiple warnings/errors/remarks in a single grouping, but doing so isn't very ergonomic for users because the primary warning/error/remark can be buried in the source file. As a first step toward improving this situation, always break up groups at a new warning/error/remark.
1 parent 0ae2906 commit 8efe6a6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/Frontend/PrintingDiagnosticConsumer.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,11 +1107,13 @@ void PrintingDiagnosticConsumer::handleDiagnostic(SourceManager &SM,
11071107
// Use the swift-syntax formatter.
11081108
auto bufferStack = getSourceBufferStack(SM, Info.Loc);
11091109
if (!bufferStack.empty()) {
1110-
// If there are no enqueued diagnostics, or they are from a different
1111-
// outermost buffer, flush any enqueued diagnostics and start fresh.
1110+
// If there are no enqueued diagnostics, they are from a different
1111+
// outermost buffer, or we have hit a non-note diagnostic, flush any
1112+
// enqueued diagnostics and start fresh.
11121113
unsigned outermostBufferID = bufferStack.back();
11131114
if (!queuedDiagnostics ||
1114-
outermostBufferID != queuedDiagnosticsOutermostBufferID) {
1115+
outermostBufferID != queuedDiagnosticsOutermostBufferID ||
1116+
Info.Kind != DiagnosticKind::Note) {
11151117
flush(/*includeTrailingBreak*/ true);
11161118

11171119
queuedDiagnosticsOutermostBufferID = outermostBufferID;

0 commit comments

Comments
 (0)