@@ -83,19 +83,37 @@ void ModuleInterfaceBuilder::configureSubInvocationInputsAndOutputs(
83
83
.setMainAndSupplementaryOutputs ({MainOut}, {SOPs});
84
84
}
85
85
86
- void ModuleInterfaceBuilder::configureSubInvocation (
86
+ void swift::inheritOptionsForBuildingInterface (
87
+ CompilerInvocation &Invok,
87
88
const SearchPathOptions &SearchPathOpts,
88
- const LangOptions &LangOpts,
89
- ClangModuleLoader *ClangLoader) {
89
+ const LangOptions &LangOpts) {
90
90
// Start with a SubInvocation that copies various state from our
91
91
// invoking ASTContext.
92
- subInvocation.setImportSearchPaths (SearchPathOpts.ImportSearchPaths );
93
- subInvocation.setFrameworkSearchPaths (SearchPathOpts.FrameworkSearchPaths );
94
- subInvocation.setSDKPath (SearchPathOpts.SDKPath );
95
- subInvocation.setInputKind (InputFileKind::SwiftModuleInterface);
96
- subInvocation.setRuntimeResourcePath (SearchPathOpts.RuntimeResourcePath );
97
- subInvocation.setTargetTriple (LangOpts.Target );
92
+ Invok.setImportSearchPaths (SearchPathOpts.ImportSearchPaths );
93
+ Invok.setFrameworkSearchPaths (SearchPathOpts.FrameworkSearchPaths );
94
+ Invok.setSDKPath (SearchPathOpts.SDKPath );
95
+ Invok.setInputKind (InputFileKind::SwiftModuleInterface);
96
+ Invok.setRuntimeResourcePath (SearchPathOpts.RuntimeResourcePath );
97
+ Invok.setTargetTriple (LangOpts.Target );
98
+
99
+ // Inhibit warnings from the SubInvocation since we are assuming the user
100
+ // is not in a position to fix them.
101
+ Invok.getDiagnosticOptions ().SuppressWarnings = true ;
102
+
103
+ // Inherit this setting down so that it can affect error diagnostics (mostly
104
+ // by making them non-fatal).
105
+ Invok.getLangOptions ().DebuggerSupport = LangOpts.DebuggerSupport ;
106
+
107
+ // Disable this; deinitializers always get printed with `@objc` even in
108
+ // modules that don't import Foundation.
109
+ Invok.getLangOptions ().EnableObjCAttrRequiresFoundation = false ;
110
+ }
98
111
112
+ void ModuleInterfaceBuilder::configureSubInvocation (
113
+ const SearchPathOptions &SearchPathOpts,
114
+ const LangOptions &LangOpts,
115
+ ClangModuleLoader *ClangLoader) {
116
+ inheritOptionsForBuildingInterface (subInvocation, SearchPathOpts, LangOpts);
99
117
subInvocation.setModuleName (moduleName);
100
118
subInvocation.setClangModuleCachePath (moduleCachePath);
101
119
subInvocation.getFrontendOptions ().PrebuiltModuleCachePath =
@@ -112,18 +130,6 @@ void ModuleInterfaceBuilder::configureSubInvocation(
112
130
}
113
131
}
114
132
115
- // Inhibit warnings from the SubInvocation since we are assuming the user
116
- // is not in a position to fix them.
117
- subInvocation.getDiagnosticOptions ().SuppressWarnings = true ;
118
-
119
- // Inherit this setting down so that it can affect error diagnostics (mostly
120
- // by making them non-fatal).
121
- subInvocation.getLangOptions ().DebuggerSupport = LangOpts.DebuggerSupport ;
122
-
123
- // Disable this; deinitializers always get printed with `@objc` even in
124
- // modules that don't import Foundation.
125
- subInvocation.getLangOptions ().EnableObjCAttrRequiresFoundation = false ;
126
-
127
133
// Tell the subinvocation to serialize dependency hashes if asked to do so.
128
134
auto &frontendOpts = subInvocation.getFrontendOptions ();
129
135
frontendOpts.SerializeModuleInterfaceDependencyHashes =
0 commit comments