Skip to content

Commit bd57f14

Browse files
committed
[NFC] Push const IRGenOptions and SILOptions everywhere
1 parent d63053d commit bd57f14

File tree

13 files changed

+77
-75
lines changed

13 files changed

+77
-75
lines changed

include/swift/Immediate/Immediate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace swift {
3737
///
3838
/// \return the result returned from main(), if execution succeeded
3939
int RunImmediately(CompilerInstance &CI, const ProcessCmdLine &CmdLine,
40-
IRGenOptions &IRGenOpts, const SILOptions &SILOpts);
40+
const IRGenOptions &IRGenOpts, const SILOptions &SILOpts);
4141

4242
void runREPL(CompilerInstance &CI, const ProcessCmdLine &CmdLine,
4343
bool ParseStdlib);

include/swift/SIL/SILModule.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ class SILModule {
254254
bool wholeModule;
255255

256256
/// The options passed into this SILModule.
257-
SILOptions &Options;
257+
const SILOptions &Options;
258258

259259
/// Set if the SILModule was serialized already. It is used
260260
/// to ensure that the module is serialized only once.
@@ -270,7 +270,7 @@ class SILModule {
270270
// Intentionally marked private so that we need to use 'constructSIL()'
271271
// to construct a SILModule.
272272
SILModule(ModuleDecl *M, Lowering::TypeConverter &TC,
273-
SILOptions &Options, const DeclContext *associatedDC,
273+
const SILOptions &Options, const DeclContext *associatedDC,
274274
bool wholeModule);
275275

276276
SILModule(const SILModule&) = delete;
@@ -351,13 +351,13 @@ class SILModule {
351351
/// source file.
352352
static std::unique_ptr<SILModule>
353353
constructSIL(ModuleDecl *M, Lowering::TypeConverter &TC,
354-
SILOptions &Options, FileUnit *sf = nullptr);
354+
const SILOptions &Options, FileUnit *sf = nullptr);
355355

356356
/// Create and return an empty SIL module that we can
357357
/// later parse SIL bodies directly into, without converting from an AST.
358358
static std::unique_ptr<SILModule>
359359
createEmptyModule(ModuleDecl *M, Lowering::TypeConverter &TC,
360-
SILOptions &Options,
360+
const SILOptions &Options,
361361
bool WholeModule = false);
362362

363363
/// Get the Swift module associated with this SIL module.
@@ -390,7 +390,7 @@ class SILModule {
390390
/// Returns true if it is the optimized OnoneSupport module.
391391
bool isOptimizedOnoneSupportModule() const;
392392

393-
SILOptions &getOptions() const { return Options; }
393+
const SILOptions &getOptions() const { return Options; }
394394

395395
using iterator = FunctionListType::iterator;
396396
using const_iterator = FunctionListType::const_iterator;

include/swift/Subsystems.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@ namespace swift {
234234
/// SIL of all files in the module is present in the SILModule.
235235
std::unique_ptr<SILModule>
236236
performSILGeneration(ModuleDecl *M, Lowering::TypeConverter &TC,
237-
SILOptions &options);
237+
const SILOptions &options);
238238

239239
/// Turn a source file into SIL IR.
240240
std::unique_ptr<SILModule>
241241
performSILGeneration(FileUnit &SF, Lowering::TypeConverter &TC,
242-
SILOptions &options);
242+
const SILOptions &options);
243243

244244
using ModuleOrSourceFile = PointerUnion<ModuleDecl *, SourceFile *>;
245245

@@ -269,7 +269,7 @@ namespace swift {
269269
/// and return the generated LLVM IR module.
270270
/// If you set an outModuleHash, then you need to call performLLVM.
271271
std::unique_ptr<llvm::Module>
272-
performIRGeneration(IRGenOptions &Opts, ModuleDecl *M,
272+
performIRGeneration(const IRGenOptions &Opts, ModuleDecl *M,
273273
std::unique_ptr<SILModule> SILMod,
274274
StringRef ModuleName, const PrimarySpecificPaths &PSPs,
275275
llvm::LLVMContext &LLVMContext,
@@ -281,7 +281,7 @@ namespace swift {
281281
/// and return the generated LLVM IR module.
282282
/// If you set an outModuleHash, then you need to call performLLVM.
283283
std::unique_ptr<llvm::Module>
284-
performIRGeneration(IRGenOptions &Opts, SourceFile &SF,
284+
performIRGeneration(const IRGenOptions &Opts, SourceFile &SF,
285285
std::unique_ptr<SILModule> SILMod,
286286
StringRef ModuleName, const PrimarySpecificPaths &PSPs,
287287
StringRef PrivateDiscriminator,
@@ -292,15 +292,15 @@ namespace swift {
292292
/// Given an already created LLVM module, construct a pass pipeline and run
293293
/// the Swift LLVM Pipeline upon it. This does not cause the module to be
294294
/// printed, only to be optimized.
295-
void performLLVMOptimizations(IRGenOptions &Opts, llvm::Module *Module,
295+
void performLLVMOptimizations(const IRGenOptions &Opts, llvm::Module *Module,
296296
llvm::TargetMachine *TargetMachine);
297297

298298
/// Wrap a serialized module inside a swift AST section in an object file.
299299
void createSwiftModuleObjectFile(SILModule &SILMod, StringRef Buffer,
300300
StringRef OutputPath);
301301

302302
/// Turn the given LLVM module into native code and return true on error.
303-
bool performLLVM(IRGenOptions &Opts, ASTContext &Ctx, llvm::Module *Module,
303+
bool performLLVM(const IRGenOptions &Opts, ASTContext &Ctx, llvm::Module *Module,
304304
StringRef OutputFilename,
305305
UnifiedStatsReporter *Stats=nullptr);
306306

@@ -315,7 +315,7 @@ namespace swift {
315315
/// \param TargetMachine target of code gen, required.
316316
/// \param effectiveLanguageVersion version of the language, effectively.
317317
/// \param OutputFilename Filename for output.
318-
bool performLLVM(IRGenOptions &Opts, DiagnosticEngine *Diags,
318+
bool performLLVM(const IRGenOptions &Opts, DiagnosticEngine *Diags,
319319
llvm::sys::Mutex *DiagMutex,
320320
llvm::GlobalVariable *HashGlobal,
321321
llvm::Module *Module,
@@ -325,13 +325,13 @@ namespace swift {
325325
UnifiedStatsReporter *Stats=nullptr);
326326

327327
/// Dump YAML describing all fixed-size types imported from the given module.
328-
bool performDumpTypeInfo(IRGenOptions &Opts,
328+
bool performDumpTypeInfo(const IRGenOptions &Opts,
329329
SILModule &SILMod,
330330
llvm::LLVMContext &LLVMContext);
331331

332332
/// Creates a TargetMachine from the IRGen opts and AST Context.
333333
std::unique_ptr<llvm::TargetMachine>
334-
createTargetMachine(IRGenOptions &Opts, ASTContext &Ctx);
334+
createTargetMachine(const IRGenOptions &Opts, ASTContext &Ctx);
335335

336336
/// A convenience wrapper for Parser functionality.
337337
class ParserUnit {

0 commit comments

Comments
 (0)