From 8466ef6d80064fa44c5eb4fda749b055d690b587 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Tue, 18 Jul 2023 10:27:09 -0700 Subject: [PATCH] Serialization: allow `IS_STATIC_LIBRARY` to be deserialised properly Properly encode the field metadata to permit the deserialization by `llvm-bcanalyzer` for aiding debugging. --- lib/Serialization/Serialization.cpp | 1 + test/Serialization/static.swift | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 test/Serialization/static.swift diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp index 46b9cfd148c..66a00351018 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -837,6 +837,7 @@ void Serializer::writeBlockInfoBlock() { BLOCK_RECORD(options_block, SDK_PATH); BLOCK_RECORD(options_block, XCC); BLOCK_RECORD(options_block, IS_SIB); + BLOCK_RECORD(options_block, IS_STATIC_LIBRARY); BLOCK_RECORD(options_block, IS_TESTABLE); BLOCK_RECORD(options_block, ARE_PRIVATE_IMPORTS_ENABLED); BLOCK_RECORD(options_block, RESILIENCE_STRATEGY); diff --git a/test/Serialization/static.swift b/test/Serialization/static.swift new file mode 100644 index 00000000000..b77754ff528 --- /dev/null +++ b/test/Serialization/static.swift @@ -0,0 +1,12 @@ +// RUN: %empty-directory(%t) + +// RUN: %target-swift-frontend -emit-module -o %t %s +// RUN: llvm-bcanalyzer -dump %t/static.swiftmodule | %FileCheck %s -check-prefix CHECK -check-prefix DYNAMIC + +// RUN: %target-swift-frontend -static -emit-module -o %t %s +// RUN: llvm-bcanalyzer -dump %t/static.swiftmodule | %FileCheck %s -check-prefix CHECK -check-prefix STATIC + +// CHECK: +// CHECK-STATIC: +// CHECK-DYNAMIC-NOT: +// CHECK: