Skip to content

Commit 6e16e29

Browse files
authored
Merge pull request #19024 from adrian-prantl/40241256
2 parents 542ed54 + 97cbd3b commit 6e16e29

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,7 @@ CompilerInvocation::loadFromSerializedAST(StringRef data) {
12071207
if (info.status != serialization::Status::Valid)
12081208
return info.status;
12091209

1210+
LangOpts.EffectiveLanguageVersion = info.compatibilityVersion;
12101211
setTargetTriple(info.targetTriple);
12111212
if (!extendedInfo.getSDKPath().empty())
12121213
setSDKPath(extendedInfo.getSDKPath());

test/DebugInfo/ASTSection_linker.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// RUN: %empty-directory(%t)
44

5-
// RUN: %target-swift-frontend -c -sdk /fake/sdk/path -Xcc -DA -Xcc -DB -emit-module -o %t %S/ASTSection.swift
5+
// RUN: %target-swift-frontend -c -sdk /fake/sdk/path -Xcc -DA -Xcc -DB -emit-module -o %t %S/ASTSection.swift -swift-version 3
66
// RUN: %swift-ide-test -test-CompilerInvocation-from-module -source-filename=%t/ASTSection.swiftmodule
77

88
// Test the inline section mechanism.
@@ -16,6 +16,7 @@
1616
// REQUIRES: OS=macosx
1717

1818
// CHECK: - Swift Version: {{.+}}.{{.+}}
19+
// CHECK: - Compatibility Version: 3
1920
// CHECK: - Target: {{.+}}-{{.+}}-{{.+}}
2021
// CHECK: - SDK path: /fake/sdk/path{{$}}
2122
// CHECK: - -Xcc options: -working-directory {{.+}} -DA -DB

tools/lldb-moduleimport-test/lldb-moduleimport-test.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,25 @@ void anchorForGetMainExecutable() {}
4242

4343
using namespace llvm::MachO;
4444

45-
static bool validateModule(llvm::StringRef data, bool Verbose,
46-
swift::serialization::ValidationInfo &info,
47-
swift::serialization::ExtendedValidationInfo &extendedInfo) {
45+
static bool
46+
validateModule(llvm::StringRef data, bool Verbose,
47+
swift::serialization::ValidationInfo &info,
48+
swift::serialization::ExtendedValidationInfo &extendedInfo) {
4849
info = swift::serialization::validateSerializedAST(data, &extendedInfo);
4950
if (info.status != swift::serialization::Status::Valid)
5051
return false;
5152

53+
swift::CompilerInvocation CI;
54+
if (CI.loadFromSerializedAST(data) != swift::serialization::Status::Valid)
55+
return false;
56+
5257
if (Verbose) {
5358
if (!info.shortVersion.empty())
5459
llvm::outs() << "- Swift Version: " << info.shortVersion << "\n";
60+
llvm::outs() << "- Compatibility Version: "
61+
<< CI.getLangOptions()
62+
.EffectiveLanguageVersion.asAPINotesVersionString()
63+
<< "\n";
5564
llvm::outs() << "- Target: " << info.targetTriple << "\n";
5665
if (!extendedInfo.getSDKPath().empty())
5766
llvm::outs() << "- SDK path: " << extendedInfo.getSDKPath() << "\n";

0 commit comments

Comments
 (0)