Skip to content

Commit 4ae5262

Browse files
committed
[Clang importer] Don't trivially infinitely recurse
1 parent e316a8e commit 4ae5262

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/ClangImporter/ImporterImpl.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,12 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
763763
/// already in flight.
764764
template<typename ...Args>
765765
void diagnose(SourceLoc loc, Args &&...args) {
766-
diagnose(loc, std::forward<Args>(args)...);
766+
// If we're in the middle of pretty-printing, suppress diagnostics.
767+
if (SwiftContext.Diags.isPrettyPrintingDecl()) {
768+
return;
769+
}
770+
771+
SwiftContext.Diags.diagnose(loc, std::forward<Args>(args)...);
767772
}
768773

769774
/// Import the given Clang identifier into Swift.

0 commit comments

Comments
 (0)