Skip to content

Commit 89ecc5a

Browse files
committed
[NFC] Pipe PrintDiagnosticNames through swiftinterface loader
1 parent 1b38c91 commit 89ecc5a

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

include/swift/Frontend/ModuleInterfaceLoader.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,8 @@ struct InterfaceSubContextDelegateImpl : InterfaceSubContextDelegate {
646646
const LangOptions &LangOpts,
647647
const ClangImporterOptions &clangImporterOpts,
648648
const CASOptions &casOpts,
649-
bool suppressNotes, bool suppressRemarks);
649+
bool suppressNotes, bool suppressRemarks,
650+
PrintDiagnosticNamesMode diagnosticNamesMode);
650651
bool extractSwiftInterfaceVersionAndArgs(CompilerInvocation &subInvocation,
651652
DiagnosticEngine &subInstanceDiags,
652653
SwiftInterfaceInfo &interfaceInfo,

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,7 +1663,8 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface(
16631663
FrontendOptions::ActionType requestedAction,
16641664
const SearchPathOptions &SearchPathOpts, const LangOptions &LangOpts,
16651665
const ClangImporterOptions &clangImporterOpts, const CASOptions &casOpts,
1666-
bool suppressNotes, bool suppressRemarks) {
1666+
bool suppressNotes, bool suppressRemarks,
1667+
PrintDiagnosticNamesMode printDiagnosticNames) {
16671668
GenericArgs.push_back("-frontend");
16681669
// Start with a genericSubInvocation that copies various state from our
16691670
// invoking ASTContext.
@@ -1764,6 +1765,20 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface(
17641765
GenericArgs.push_back("-suppress-remarks");
17651766
}
17661767

1768+
// Inherit the parent invocation's setting for printing diagnostic IDs.
1769+
genericSubInvocation.getDiagnosticOptions().PrintDiagnosticNames =
1770+
printDiagnosticNames;
1771+
switch (printDiagnosticNames) {
1772+
case PrintDiagnosticNamesMode::None:
1773+
break;
1774+
case PrintDiagnosticNamesMode::Identifier:
1775+
GenericArgs.push_back("-debug-diagnostic-names");
1776+
break;
1777+
case PrintDiagnosticNamesMode::Group:
1778+
// FIXME: Currently no flag for Group mode
1779+
break;
1780+
}
1781+
17671782
// Inherit this setting down so that it can affect error diagnostics (mostly
17681783
// by making them non-fatal).
17691784
genericSubInvocation.getLangOptions().DebuggerSupport = LangOpts.DebuggerSupport;
@@ -1870,7 +1885,8 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
18701885
inheritOptionsForBuildingInterface(LoaderOpts.requestedAction, searchPathOpts,
18711886
langOpts, clangImporterOpts, casOpts,
18721887
Diags->getSuppressNotes(),
1873-
Diags->getSuppressRemarks());
1888+
Diags->getSuppressRemarks(),
1889+
Diags->getPrintDiagnosticNamesMode());
18741890
// Configure front-end input.
18751891
auto &SubFEOpts = genericSubInvocation.getFrontendOptions();
18761892
SubFEOpts.RequestedAction = LoaderOpts.requestedAction;

0 commit comments

Comments
 (0)