Skip to content

Commit b8d135a

Browse files
committed
Enhance swift-ide-test to accept -swift-version multiple times.
This allows swift-ide-test to be passed -swift-version X by lit but have it overriden by a specifc test.
1 parent ad5eab9 commit b8d135a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ SDK("sdk", llvm::cl::desc("path to the SDK to build against"));
237237
static llvm::cl::opt<std::string>
238238
Triple("target", llvm::cl::desc("target triple"));
239239

240-
static llvm::cl::opt<std::string>
240+
static llvm::cl::list<std::string>
241241
SwiftVersion("swift-version", llvm::cl::desc("Swift version"));
242242

243243
static llvm::cl::opt<std::string>
@@ -2982,8 +2982,11 @@ int main(int argc, char *argv[]) {
29822982
if (!options::Triple.empty())
29832983
InitInvok.setTargetTriple(options::Triple);
29842984
if (!options::SwiftVersion.empty()) {
2985+
// Honor the *last* -swift-version specified.
2986+
const auto &LastSwiftVersion =
2987+
options::SwiftVersion[options::SwiftVersion.size()-1];
29852988
if (auto swiftVersion =
2986-
version::Version::parseVersionString(options::SwiftVersion,
2989+
version::Version::parseVersionString(LastSwiftVersion,
29872990
SourceLoc(), nullptr)) {
29882991
if (auto actual = swiftVersion.getValue().getEffectiveLanguageVersion())
29892992
InitInvok.getLangOptions().EffectiveLanguageVersion = actual.getValue();

0 commit comments

Comments
 (0)