Skip to content

Commit c8ed9f9

Browse files
authored
Add additional flags for symbol graph generation options (#785)
1 parent 8e1a315 commit c8ed9f9

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

Sources/SWBCore/Settings/BuiltinMacros.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,9 @@ public final class BuiltinMacros {
10971097
public static let SDKDB_TO_SYMGRAPH_EXEC = BuiltinMacros.declarePathMacro("SDKDB_TO_SYMGRAPH_EXEC")
10981098
public static let CLANG_EXTRACT_API_EXEC = BuiltinMacros.declareStringMacro("CLANG_EXTRACT_API_EXEC")
10991099
public static let DOCC_ARCHIVE_PATH = BuiltinMacros.declareStringMacro("DOCC_ARCHIVE_PATH")
1100+
public static let DOCC_PRETTY_PRINT = BuiltinMacros.declareBooleanMacro("DOCC_PRETTY_PRINT")
11001101
public static let DOCC_EXTRACT_SPI_DOCUMENTATION = BuiltinMacros.declareBooleanMacro("DOCC_EXTRACT_SPI_DOCUMENTATION")
1102+
public static let DOCC_SKIP_SYNTHESIZED_MEMBERS = BuiltinMacros.declareBooleanMacro("DOCC_SKIP_SYNTHESIZED_MEMBERS")
11011103
public static let DOCC_EXTRACT_EXTENSION_SYMBOLS = BuiltinMacros.declareBooleanMacro("DOCC_EXTRACT_EXTENSION_SYMBOLS")
11021104
public static let DOCC_EXTRACT_SWIFT_INFO_FOR_OBJC_SYMBOLS = BuiltinMacros.declareBooleanMacro("DOCC_EXTRACT_SWIFT_INFO_FOR_OBJC_SYMBOLS")
11031105
public static let DOCC_EXTRACT_OBJC_INFO_FOR_SWIFT_SYMBOLS = BuiltinMacros.declareBooleanMacro("DOCC_EXTRACT_OBJC_INFO_FOR_SWIFT_SYMBOLS")
@@ -1646,6 +1648,8 @@ public final class BuiltinMacros {
16461648
DISABLE_TEST_HOST_PLATFORM_PROCESSING,
16471649
DISABLE_XCFRAMEWORK_SIGNATURE_VALIDATION,
16481650
DOCC_ARCHIVE_PATH,
1651+
DOCC_PRETTY_PRINT,
1652+
DOCC_SKIP_SYNTHESIZED_MEMBERS,
16491653
DOCC_EXTRACT_SPI_DOCUMENTATION,
16501654
DOCC_EXTRACT_EXTENSION_SYMBOLS,
16511655
DOCC_EXTRACT_SWIFT_INFO_FOR_OBJC_SYMBOLS,

Sources/SWBCore/SpecImplementations/Tools/DocumentationCompiler.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,21 @@ final public class DocumentationCompilerSpec: GenericCompilerSpec, SpecIdentifie
7777
) -> [String] {
7878
var additionalFlags = [String]()
7979

80+
// Check if pretty print is requested
81+
if cbc.scope.evaluate(BuiltinMacros.DOCC_PRETTY_PRINT) && swiftCompilerInfo.toolFeatures.has(.emitExtensionBlockSymbols) {
82+
additionalFlags.append("-symbol-graph-pretty-print")
83+
}
84+
8085
// Check if extension symbol documentation is requested
8186
if cbc.scope.evaluate(BuiltinMacros.DOCC_EXTRACT_EXTENSION_SYMBOLS) && swiftCompilerInfo.toolFeatures.has(.emitExtensionBlockSymbols) {
8287
additionalFlags.append("-emit-extension-block-symbols")
8388
}
8489

90+
// Check if synthesized members should be skipped
91+
if cbc.scope.evaluate(BuiltinMacros.DOCC_SKIP_SYNTHESIZED_MEMBERS) && swiftCompilerInfo.toolFeatures.has(.emitExtensionBlockSymbols) {
92+
additionalFlags.append("-symbol-graph-skip-synthesized-members")
93+
}
94+
8595
switch DocumentationType(from: cbc) {
8696
case .executable:
8797
// When building executable types (like applications and command-line tools), include

Sources/SWBUniversalPlatform/Specs/Documentation.xcspec

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,20 @@
161161
DefaultValue = NO;
162162
},
163163

164+
// If the Swift compiler / Swift symbol graph extractor should pretty print the symbol graph.
165+
{
166+
Name = DOCC_PRETTY_PRINT;
167+
Type = bool;
168+
DefaultValue = NO;
169+
},
170+
171+
// If the Swift compiler / Swift symbol graph extractor should skip synthesized members.
172+
{
173+
Name = DOCC_SKIP_SYNTHESIZED_MEMBERS;
174+
Type = bool;
175+
DefaultValue = NO;
176+
},
177+
164178
{
165179
Name = DOCC_EXTRACT_SWIFT_INFO_FOR_OBJC_SYMBOLS;
166180
Type = bool;

0 commit comments

Comments
 (0)