@@ -650,42 +650,43 @@ convertFileContentsToInputs(ArrayRef<FileContent> contents) {
650650
651651bool SwiftASTManager::initCompilerInvocation (
652652 CompilerInvocation &Invocation, ArrayRef<const char *> OrigArgs,
653- DiagnosticEngine &Diags, StringRef UnresolvedPrimaryFile ,
654- std::string &Error) {
655- return initCompilerInvocation (Invocation, OrigArgs, Diags,
653+ swift::FrontendOptions::ActionType Action, DiagnosticEngine &Diags ,
654+ StringRef UnresolvedPrimaryFile, std::string &Error) {
655+ return initCompilerInvocation (Invocation, OrigArgs, Action, Diags,
656656 UnresolvedPrimaryFile,
657- llvm::vfs::getRealFileSystem (),
658- Error);
657+ llvm::vfs::getRealFileSystem (), Error);
659658}
660659
661660bool SwiftASTManager::initCompilerInvocation (
662661 CompilerInvocation &Invocation, ArrayRef<const char *> OrigArgs,
663- DiagnosticEngine &Diags, StringRef UnresolvedPrimaryFile,
662+ FrontendOptions::ActionType Action, DiagnosticEngine &Diags,
663+ StringRef UnresolvedPrimaryFile,
664664 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FileSystem,
665665 std::string &Error) {
666666 return ide::initCompilerInvocation (
667- Invocation, OrigArgs, Diags, UnresolvedPrimaryFile, FileSystem,
667+ Invocation, OrigArgs, Action, Diags, UnresolvedPrimaryFile, FileSystem,
668668 Impl.RuntimeResourcePath , Impl.DiagnosticDocumentationPath ,
669669 Impl.SessionTimestamp , Error);
670670}
671671
672- bool SwiftASTManager::initCompilerInvocation (CompilerInvocation &CompInvok,
673- ArrayRef<const char *> OrigArgs,
674- StringRef PrimaryFile,
675- std::string &Error) {
672+ bool SwiftASTManager::initCompilerInvocation (
673+ CompilerInvocation &CompInvok, ArrayRef<const char *> OrigArgs,
674+ swift::FrontendOptions::ActionType Action, StringRef PrimaryFile,
675+ std::string &Error) {
676676 DiagnosticEngine Diagnostics (Impl.SourceMgr );
677- return initCompilerInvocation (CompInvok, OrigArgs, Diagnostics, PrimaryFile ,
678- Error);
677+ return initCompilerInvocation (CompInvok, OrigArgs, Action, Diagnostics ,
678+ PrimaryFile, Error);
679679}
680680
681681bool SwiftASTManager::initCompilerInvocationNoInputs (
682682 swift::CompilerInvocation &Invocation, ArrayRef<const char *> OrigArgs,
683- swift::DiagnosticEngine &Diags, std::string &Error, bool AllowInputs) {
683+ swift::FrontendOptions::ActionType Action, swift::DiagnosticEngine &Diags,
684+ std::string &Error, bool AllowInputs) {
684685
685686 SmallVector<const char *, 16 > Args (OrigArgs.begin (), OrigArgs.end ());
686687 // Use stdin as a .swift input to satisfy the driver.
687688 Args.push_back (" -" );
688- if (initCompilerInvocation (Invocation, Args, Diags, " " , Error))
689+ if (initCompilerInvocation (Invocation, Args, Action, Diags, " " , Error))
689690 return true ;
690691
691692 if (!AllowInputs &&
@@ -699,13 +700,15 @@ bool SwiftASTManager::initCompilerInvocationNoInputs(
699700 return false ;
700701}
701702
702- SwiftInvocationRef SwiftASTManager::getInvocation (
703- ArrayRef<const char *> OrigArgs, StringRef PrimaryFile, std::string &Error) {
704- return getInvocation (OrigArgs, PrimaryFile, llvm::vfs::getRealFileSystem (),
705- Error);
703+ SwiftInvocationRef
704+ SwiftASTManager::getTypecheckInvocation (ArrayRef<const char *> OrigArgs,
705+ StringRef PrimaryFile,
706+ std::string &Error) {
707+ return getTypecheckInvocation (OrigArgs, PrimaryFile,
708+ llvm::vfs::getRealFileSystem (), Error);
706709}
707710
708- SwiftInvocationRef SwiftASTManager::getInvocation (
711+ SwiftInvocationRef SwiftASTManager::getTypecheckInvocation (
709712 ArrayRef<const char *> OrigArgs, StringRef PrimaryFile,
710713 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FileSystem,
711714 std::string &Error) {
@@ -716,8 +719,9 @@ SwiftInvocationRef SwiftASTManager::getInvocation(
716719 Diags.addConsumer (CollectDiagConsumer);
717720
718721 CompilerInvocation CompInvok;
719- if (initCompilerInvocation (CompInvok, OrigArgs, Diags, PrimaryFile,
720- FileSystem, Error)) {
722+ if (initCompilerInvocation (CompInvok, OrigArgs,
723+ FrontendOptions::ActionType::Typecheck, Diags,
724+ PrimaryFile, FileSystem, Error)) {
721725 // We create a traced operation here to represent the failure to parse
722726 // arguments since we cannot reach `createAST` where that would normally
723727 // happen.
0 commit comments