@@ -242,20 +242,6 @@ class CompilerInvocation {
242
242
return FrontendOpts.ModuleName ;
243
243
}
244
244
245
- void addInputFilename (StringRef Filename) {
246
- FrontendOpts.Inputs .addInputFilename (Filename);
247
- }
248
-
249
- // / Does not take ownership of \p Buf.
250
- void addInputBuffer (llvm::MemoryBuffer *Buf) {
251
- FrontendOpts.Inputs .addInputBuffer (Buf);
252
- }
253
-
254
- void setPrimaryInput (SelectedInput pi ) {
255
- FrontendOpts.Inputs .setPrimaryInput (pi );
256
- }
257
-
258
- void clearInputs () { FrontendOpts.Inputs .clearInputs (); }
259
245
260
246
StringRef getOutputFilename () const {
261
247
return FrontendOpts.getSingleOutputFilename ();
@@ -307,7 +293,7 @@ class CompilerInvocation {
307
293
// / Return value includes the buffer so caller can keep it alive.
308
294
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
309
295
setUpInputForSILTool (StringRef inputFilename, StringRef moduleNameArg,
310
- bool alwaysSetModuleToMain,
296
+ bool alwaysSetModuleToMain, bool bePrimary,
311
297
serialization::ExtendedValidationInfo &extendedInfo);
312
298
bool hasSerializedAST () {
313
299
return FrontendOpts.InputKind == InputFileKind::IFK_Swift_Library;
@@ -359,8 +345,6 @@ class CompilerInstance {
359
345
void createSILModule ();
360
346
void setPrimarySourceFile (SourceFile *SF);
361
347
362
- bool setUpForFileAt (unsigned i);
363
-
364
348
public:
365
349
SourceManager &getSourceMgr () { return SourceMgr; }
366
350
@@ -436,6 +420,23 @@ class CompilerInstance {
436
420
// / \brief Returns true if there was an error during setup.
437
421
bool setup (const CompilerInvocation &Invocation);
438
422
423
+ private:
424
+ void setUpLLVMArguments ();
425
+ void setUpDiagnosticOptions ();
426
+ bool setUpModuleLoaders ();
427
+ Optional<unsigned > setupCodeCompletionBuffer ();
428
+ bool setupInputs (Optional<unsigned > codeCompletionBufferID);
429
+ bool isInMainMode () {
430
+ return Invocation.getInputKind () == InputFileKind::IFK_Swift;
431
+ }
432
+ bool isInSILMode () {
433
+ return Invocation.getInputKind () == InputFileKind::IFK_SIL;
434
+ }
435
+ bool setupForInput (const InputFile &input);
436
+ void setupForBuffer (llvm::MemoryBuffer *buffer, bool isPrimary);
437
+ bool setUpForFile (StringRef file, bool isPrimary);
438
+
439
+ public:
439
440
// / Parses and type-checks all input files.
440
441
void performSema ();
441
442
@@ -445,6 +446,13 @@ class CompilerInstance {
445
446
// /
446
447
void performParseOnly (bool EvaluateConditionals = false );
447
448
449
+ private:
450
+ SourceFile *
451
+ createSourceFileForMainModule (SourceFileKind FileKind,
452
+ SourceFile::ImplicitModuleImportKind ImportKind,
453
+ Optional<unsigned > BufferID);
454
+
455
+ public:
448
456
// / Frees up the ASTContext and SILModule objects that this instance is
449
457
// / holding on.
450
458
void freeContextAndSIL ();
@@ -469,7 +477,7 @@ class CompilerInstance {
469
477
};
470
478
471
479
private:
472
- void createREPLFile (const ImplicitImports &implicitImports) const ;
480
+ void createREPLFile (const ImplicitImports &implicitImports);
473
481
std::unique_ptr<DelayedParsingCallbacks>
474
482
computeDelayedParsingCallback (bool isPrimary);
475
483
0 commit comments