Skip to content

Commit d04cfeb

Browse files
authored
Serialization: Indicate application extension mode via XCC (#76285)
This fixes the debugger's ability to perform expression evaluation when debugging an executable that was built with both under the following circumstances: 1. explicit module build 2. `-application-extension` The fix is to include `-fapplication-extension` as an XCC field in the swiftmodule. This primes the debugger's ClangImporter with the correct flag needed to load the explicitly built pcm files generated at build time.
1 parent 5f851b6 commit d04cfeb

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/Frontend/Frontend.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
238238
serializationOpts.ExtraClangOptions.push_back("--target=" +
239239
LangOpts.ClangTarget->str());
240240
}
241+
if (LangOpts.EnableAppExtensionRestrictions) {
242+
serializationOpts.ExtraClangOptions.push_back("-fapplication-extension");
243+
}
241244

242245
serializationOpts.PluginSearchOptions =
243246
getSearchPathOptions().PluginSearchOpts;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -emit-module -module-name AppExtSafe -emit-module-path %t/AppExtSafe.swiftmodule -parse-as-library -serialize-debugging-options -application-extension %s
3+
4+
// Check the serialized flags paths.
5+
// RUN: llvm-bcanalyzer -dump %t/AppExtSafe.swiftmodule > %t/AppExtSafe.swiftmodule.txt
6+
// RUN: %FileCheck %s < %t/AppExtSafe.swiftmodule.txt
7+
8+
// CHECK-LABEL: <OPTIONS_BLOCK
9+
// CHECK: <XCC abbrevid={{[0-9]+}}/> blob data = '-fapplication-extension'
10+
// CHECK: </OPTIONS_BLOCK>

0 commit comments

Comments
 (0)