Merge pull request #19024 from adrian-prantl/40241256

This commit is contained in:
swift-ci
2018-08-29 17:28:43 -07:00
committed by GitHub
3 changed files with 15 additions and 4 deletions

View File

@@ -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());

View File

@@ -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

View File

@@ -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";