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)
|
if (info.status != serialization::Status::Valid)
|
||||||
return info.status;
|
return info.status;
|
||||||
|
|
||||||
|
LangOpts.EffectiveLanguageVersion = info.compatibilityVersion;
|
||||||
setTargetTriple(info.targetTriple);
|
setTargetTriple(info.targetTriple);
|
||||||
if (!extendedInfo.getSDKPath().empty())
|
if (!extendedInfo.getSDKPath().empty())
|
||||||
setSDKPath(extendedInfo.getSDKPath());
|
setSDKPath(extendedInfo.getSDKPath());
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// RUN: %empty-directory(%t)
|
// 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
|
// RUN: %swift-ide-test -test-CompilerInvocation-from-module -source-filename=%t/ASTSection.swiftmodule
|
||||||
|
|
||||||
// Test the inline section mechanism.
|
// Test the inline section mechanism.
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
// REQUIRES: OS=macosx
|
// REQUIRES: OS=macosx
|
||||||
|
|
||||||
// CHECK: - Swift Version: {{.+}}.{{.+}}
|
// CHECK: - Swift Version: {{.+}}.{{.+}}
|
||||||
|
// CHECK: - Compatibility Version: 3
|
||||||
// CHECK: - Target: {{.+}}-{{.+}}-{{.+}}
|
// CHECK: - Target: {{.+}}-{{.+}}-{{.+}}
|
||||||
// CHECK: - SDK path: /fake/sdk/path{{$}}
|
// CHECK: - SDK path: /fake/sdk/path{{$}}
|
||||||
// CHECK: - -Xcc options: -working-directory {{.+}} -DA -DB
|
// CHECK: - -Xcc options: -working-directory {{.+}} -DA -DB
|
||||||
|
|||||||
@@ -42,16 +42,25 @@ void anchorForGetMainExecutable() {}
|
|||||||
|
|
||||||
using namespace llvm::MachO;
|
using namespace llvm::MachO;
|
||||||
|
|
||||||
static bool validateModule(llvm::StringRef data, bool Verbose,
|
static bool
|
||||||
swift::serialization::ValidationInfo &info,
|
validateModule(llvm::StringRef data, bool Verbose,
|
||||||
swift::serialization::ExtendedValidationInfo &extendedInfo) {
|
swift::serialization::ValidationInfo &info,
|
||||||
|
swift::serialization::ExtendedValidationInfo &extendedInfo) {
|
||||||
info = swift::serialization::validateSerializedAST(data, &extendedInfo);
|
info = swift::serialization::validateSerializedAST(data, &extendedInfo);
|
||||||
if (info.status != swift::serialization::Status::Valid)
|
if (info.status != swift::serialization::Status::Valid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
swift::CompilerInvocation CI;
|
||||||
|
if (CI.loadFromSerializedAST(data) != swift::serialization::Status::Valid)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (Verbose) {
|
if (Verbose) {
|
||||||
if (!info.shortVersion.empty())
|
if (!info.shortVersion.empty())
|
||||||
llvm::outs() << "- Swift Version: " << info.shortVersion << "\n";
|
llvm::outs() << "- Swift Version: " << info.shortVersion << "\n";
|
||||||
|
llvm::outs() << "- Compatibility Version: "
|
||||||
|
<< CI.getLangOptions()
|
||||||
|
.EffectiveLanguageVersion.asAPINotesVersionString()
|
||||||
|
<< "\n";
|
||||||
llvm::outs() << "- Target: " << info.targetTriple << "\n";
|
llvm::outs() << "- Target: " << info.targetTriple << "\n";
|
||||||
if (!extendedInfo.getSDKPath().empty())
|
if (!extendedInfo.getSDKPath().empty())
|
||||||
llvm::outs() << "- SDK path: " << extendedInfo.getSDKPath() << "\n";
|
llvm::outs() << "- SDK path: " << extendedInfo.getSDKPath() << "\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user