Merge pull request #69970 from NuriAmari/swift-ide-test-updates

[swift-ide-test] Add -enable-upcoming-feature ImportObjcForwardDeclarations support
This commit is contained in:
Nuri Amari
2023-11-27 12:50:18 -08:00
committed by GitHub
4 changed files with 54 additions and 9 deletions

View File

@@ -413,12 +413,6 @@ static llvm::cl::opt<bool> CodeCompleteCallPatternHeuristics(
"Use heuristics to guess whether we want call pattern completions"),
llvm::cl::cat(Category));
static llvm::cl::opt<bool>
ObjCForwardDeclarations("enable-objc-forward-declarations",
llvm::cl::desc("Import Objective-C forward declarations when possible"),
llvm::cl::cat(Category),
llvm::cl::init(false));
static llvm::cl::opt<bool>
EnableSwift3ObjCInference("enable-swift3-objc-inference",
llvm::cl::desc("Enable Swift 3's @objc inference rules"),
@@ -870,6 +864,11 @@ static llvm::cl::list<std::string>
llvm::cl::desc("Enable an experimental feature"),
llvm::cl::cat(Category));
static llvm::cl::list<std::string>
EnableUpcomingFeatures("enable-upcoming-feature",
llvm::cl::desc("Enable a feature that will be introduced in an upcoming language version"),
llvm::cl::cat(Category));
static llvm::cl::list<std::string>
AccessNotesPath("access-notes-path", llvm::cl::desc("Path to access notes file"),
llvm::cl::cat(Category));
@@ -4435,6 +4434,12 @@ int main(int argc, char *argv[]) {
}
}
for (const auto &featureArg : options::EnableUpcomingFeatures) {
if (auto feature = getUpcomingFeature(featureArg)) {
InitInvok.getLangOptions().Features.insert(*feature);
}
}
if (!options::Triple.empty())
InitInvok.setTargetTriple(options::Triple);
if (!options::SwiftVersion.empty()) {
@@ -4489,8 +4494,13 @@ int main(int argc, char *argv[]) {
options::EnableDeserializationSafety;
InitInvok.getLangOptions().EnableSwift3ObjCInference =
options::EnableSwift3ObjCInference;
// The manner in which swift-ide-test constructs its CompilerInvocation does
// not hit the codepath in arg parsing that would normally construct
// ClangImporter options based on enabled language features etc. Explicitly
// enable them here.
InitInvok.getClangImporterOptions().ImportForwardDeclarations |=
options::ObjCForwardDeclarations;
InitInvok.getLangOptions().hasFeature(
Feature::ImportObjcForwardDeclarations);
if (!options::ResourceDir.empty()) {
InitInvok.setRuntimeResourcePath(options::ResourceDir);
}