@@ -413,12 +413,6 @@ static llvm::cl::opt<bool> CodeCompleteCallPatternHeuristics(
413
413
" Use heuristics to guess whether we want call pattern completions" ),
414
414
llvm::cl::cat(Category));
415
415
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
-
422
416
static llvm::cl::opt<bool >
423
417
EnableSwift3ObjCInference (" enable-swift3-objc-inference" ,
424
418
llvm::cl::desc (" Enable Swift 3's @objc inference rules" ),
@@ -870,6 +864,11 @@ static llvm::cl::list<std::string>
870
864
llvm::cl::desc (" Enable an experimental feature" ),
871
865
llvm::cl::cat(Category));
872
866
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
+
873
872
static llvm::cl::list<std::string>
874
873
AccessNotesPath (" access-notes-path" , llvm::cl::desc(" Path to access notes file" ),
875
874
llvm::cl::cat(Category));
@@ -4435,6 +4434,12 @@ int main(int argc, char *argv[]) {
4435
4434
}
4436
4435
}
4437
4436
4437
+ for (const auto &featureArg : options::EnableUpcomingFeatures) {
4438
+ if (auto feature = getUpcomingFeature (featureArg)) {
4439
+ InitInvok.getLangOptions ().Features .insert (*feature);
4440
+ }
4441
+ }
4442
+
4438
4443
if (!options::Triple.empty ())
4439
4444
InitInvok.setTargetTriple (options::Triple);
4440
4445
if (!options::SwiftVersion.empty ()) {
@@ -4489,8 +4494,13 @@ int main(int argc, char *argv[]) {
4489
4494
options::EnableDeserializationSafety;
4490
4495
InitInvok.getLangOptions ().EnableSwift3ObjCInference =
4491
4496
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.
4492
4501
InitInvok.getClangImporterOptions ().ImportForwardDeclarations |=
4493
- options::ObjCForwardDeclarations;
4502
+ InitInvok.getLangOptions ().hasFeature (
4503
+ Feature::ImportObjcForwardDeclarations);
4494
4504
if (!options::ResourceDir.empty ()) {
4495
4505
InitInvok.setRuntimeResourcePath (options::ResourceDir);
4496
4506
}
0 commit comments