Skip to content

Commit 0400d8b

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 2716ea9 commit 0400d8b

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
@@ -69,6 +69,10 @@ static void addQueueDiagnostic(void *queuedDiagnostics,
6969
severity, info.Loc.getOpaquePointerValue(),
7070
highlightRanges.data(),
7171
highlightRanges.size() / 2);
72+
73+
for (auto *childNote : info.ChildDiagnosticInfo) {
74+
addQueueDiagnostic(queuedDiagnostics, *childNote, SM);
75+
}
7276
}
7377

7478
void DiagnosticBridge::enqueueDiagnostic(SourceManager &SM,

0 commit comments

Comments
 (0)