Skip to content

Commit 0d6341b

Browse files
xedinktoso
authored andcommitted
[DiagnosticBridge] Make sure that diagnostic queues up its child notes
`DiagnosticEngine` has an API that allows to attach notes to a "primary" diagnostic (an error or a warning). This works well with old formatting (`llvm`) but `swift` formatter doesn't display attached notes which makes some diagnostics very hard to work with i.e. `invalid_redecl`.
1 parent f78fb36 commit 0d6341b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/AST/DiagnosticBridge.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ static void addQueueDiagnostic(void *queuedDiagnostics,
7777
documentationPath.size(),
7878
highlightRanges.data(),
7979
highlightRanges.size() / 2);
80+
81+
for (auto *childNote : info.ChildDiagnosticInfo) {
82+
addQueueDiagnostic(queuedDiagnostics, *childNote, SM);
83+
}
8084
}
8185

8286
void DiagnosticBridge::enqueueDiagnostic(SourceManager &SM,

0 commit comments

Comments
 (0)