mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #19024 from adrian-prantl/40241256
This commit is contained in:
@@ -1207,6 +1207,7 @@ CompilerInvocation::loadFromSerializedAST(StringRef data) {
|
||||
if (info.status != serialization::Status::Valid)
|
||||
return info.status;
|
||||
|
||||
LangOpts.EffectiveLanguageVersion = info.compatibilityVersion;
|
||||
setTargetTriple(info.targetTriple);
|
||||
if (!extendedInfo.getSDKPath().empty())
|
||||
setSDKPath(extendedInfo.getSDKPath());
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// RUN: %empty-directory(%t)
|
||||
|
||||
// RUN: %target-swift-frontend -c -sdk /fake/sdk/path -Xcc -DA -Xcc -DB -emit-module -o %t %S/ASTSection.swift
|
||||
// RUN: %target-swift-frontend -c -sdk /fake/sdk/path -Xcc -DA -Xcc -DB -emit-module -o %t %S/ASTSection.swift -swift-version 3
|
||||
// RUN: %swift-ide-test -test-CompilerInvocation-from-module -source-filename=%t/ASTSection.swiftmodule
|
||||
|
||||
// Test the inline section mechanism.
|
||||
@@ -16,6 +16,7 @@
|
||||
// REQUIRES: OS=macosx
|
||||
|
||||
// CHECK: - Swift Version: {{.+}}.{{.+}}
|
||||
// CHECK: - Compatibility Version: 3
|
||||
// CHECK: - Target: {{.+}}-{{.+}}-{{.+}}
|
||||
// CHECK: - SDK path: /fake/sdk/path{{$}}
|
||||
// CHECK: - -Xcc options: -working-directory {{.+}} -DA -DB
|
||||
|
||||
@@ -42,16 +42,25 @@ void anchorForGetMainExecutable() {}
|
||||
|
||||
using namespace llvm::MachO;
|
||||
|
||||
static bool validateModule(llvm::StringRef data, bool Verbose,
|
||||
static bool
|
||||
validateModule(llvm::StringRef data, bool Verbose,
|
||||
swift::serialization::ValidationInfo &info,
|
||||
swift::serialization::ExtendedValidationInfo &extendedInfo) {
|
||||
info = swift::serialization::validateSerializedAST(data, &extendedInfo);
|
||||
if (info.status != swift::serialization::Status::Valid)
|
||||
return false;
|
||||
|
||||
swift::CompilerInvocation CI;
|
||||
if (CI.loadFromSerializedAST(data) != swift::serialization::Status::Valid)
|
||||
return false;
|
||||
|
||||
if (Verbose) {
|
||||
if (!info.shortVersion.empty())
|
||||
llvm::outs() << "- Swift Version: " << info.shortVersion << "\n";
|
||||
llvm::outs() << "- Compatibility Version: "
|
||||
<< CI.getLangOptions()
|
||||
.EffectiveLanguageVersion.asAPINotesVersionString()
|
||||
<< "\n";
|
||||
llvm::outs() << "- Target: " << info.targetTriple << "\n";
|
||||
if (!extendedInfo.getSDKPath().empty())
|
||||
llvm::outs() << "- SDK path: " << extendedInfo.getSDKPath() << "\n";
|
||||
|
||||
Reference in New Issue
Block a user