@@ -413,12 +413,6 @@ static llvm::cl::opt<bool> CodeCompleteCallPatternHeuristics(
413413 " Use heuristics to guess whether we want call pattern completions" ),
414414 llvm::cl::cat(Category));
415415
416- static llvm::cl::opt<bool >
417- ObjCForwardDeclarations (" enable-objc-forward-declarations" ,
418- llvm::cl::desc (" Import Objective-C forward declarations when possible" ),
419- llvm::cl::cat(Category),
420- llvm::cl::init(false ));
421-
422416static llvm::cl::opt<bool >
423417EnableSwift3ObjCInference (" enable-swift3-objc-inference" ,
424418 llvm::cl::desc (" Enable Swift 3's @objc inference rules" ),
@@ -870,6 +864,11 @@ static llvm::cl::list<std::string>
870864 llvm::cl::desc (" Enable an experimental feature" ),
871865 llvm::cl::cat(Category));
872866
867+ static llvm::cl::list<std::string>
868+ EnableUpcomingFeatures (" enable-upcoming-feature" ,
869+ llvm::cl::desc (" Enable a feature that will be introduced in an upcoming language version" ),
870+ llvm::cl::cat(Category));
871+
873872static llvm::cl::list<std::string>
874873AccessNotesPath (" access-notes-path" , llvm::cl::desc(" Path to access notes file" ),
875874 llvm::cl::cat(Category));
@@ -4435,6 +4434,12 @@ int main(int argc, char *argv[]) {
44354434 }
44364435 }
44374436
4437+ for (const auto &featureArg : options::EnableUpcomingFeatures) {
4438+ if (auto feature = getUpcomingFeature (featureArg)) {
4439+ InitInvok.getLangOptions ().Features .insert (*feature);
4440+ }
4441+ }
4442+
44384443 if (!options::Triple.empty ())
44394444 InitInvok.setTargetTriple (options::Triple);
44404445 if (!options::SwiftVersion.empty ()) {
@@ -4489,8 +4494,13 @@ int main(int argc, char *argv[]) {
44894494 options::EnableDeserializationSafety;
44904495 InitInvok.getLangOptions ().EnableSwift3ObjCInference =
44914496 options::EnableSwift3ObjCInference;
4497+ // The manner in which swift-ide-test constructs its CompilerInvocation does
4498+ // not hit the codepath in arg parsing that would normally construct
4499+ // ClangImporter options based on enabled language features etc. Explicitly
4500+ // enable them here.
44924501 InitInvok.getClangImporterOptions ().ImportForwardDeclarations |=
4493- options::ObjCForwardDeclarations;
4502+ InitInvok.getLangOptions ().hasFeature (
4503+ Feature::ImportObjcForwardDeclarations);
44944504 if (!options::ResourceDir.empty ()) {
44954505 InitInvok.setRuntimeResourcePath (options::ResourceDir);
44964506 }
0 commit comments