Skip to content

Commit bf66515

Browse files
add default values for SymbolGraphOptions (#59037)
rdar://93780666
1 parent 5eba174 commit bf66515

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

include/swift/SymbolGraphGen/SymbolGraphOptions.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,33 @@ namespace symbolgraphgen {
2121

2222
struct SymbolGraphOptions {
2323
/// The directory to output the symbol graph JSON files.
24-
StringRef OutputDir;
24+
StringRef OutputDir = {};
2525

2626
/// The target of the module.
27-
llvm::Triple Target;
27+
llvm::Triple Target = {};
2828
/// Pretty-print the JSON with newlines and indentation.
29-
bool PrettyPrint;
29+
bool PrettyPrint = false;
3030

3131
/// The minimum access level that symbols must have in order to be
3232
/// included in the graph.
33-
AccessLevel MinimumAccessLevel;
33+
AccessLevel MinimumAccessLevel = AccessLevel::Public;
3434

3535
/// Emit members gotten through class inheritance or protocol default
3636
/// implementations with compound, "SYNTHESIZED" USRs.
37-
bool EmitSynthesizedMembers;
37+
bool EmitSynthesizedMembers = false;
3838

3939
/// Whether to print informational messages when rendering
4040
/// a symbol graph.
41-
bool PrintMessages;
41+
bool PrintMessages = false;
4242

4343
/// Whether to skip docs for symbols with compound, "SYNTHESIZED" USRs.
44-
bool SkipInheritedDocs;
44+
bool SkipInheritedDocs = false;
4545

4646
/// Whether to emit symbols with SPI information.
47-
bool IncludeSPISymbols;
47+
bool IncludeSPISymbols = false;
4848

4949
/// Whether to include documentation for clang nodes or not.
50-
bool IncludeClangDocs;
50+
bool IncludeClangDocs = false;
5151
};
5252

5353
} // end namespace symbolgraphgen

lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,6 +1257,7 @@ static void ParseSymbolGraphArgs(symbolgraphgen::SymbolGraphOptions &Opts,
12571257
Opts.PrettyPrint = false;
12581258
Opts.EmitSynthesizedMembers = true;
12591259
Opts.PrintMessages = false;
1260+
Opts.IncludeClangDocs = false;
12601261
}
12611262

12621263
static bool ParseSearchPathArgs(SearchPathOptions &Opts,

test/SymbolGraph/ClangImporter/EmitWhileBuilding.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// RUN: %{python} -m json.tool %t/EmitWhileBuilding.symbols.json %t/EmitWhileBuilding.formatted.symbols.json
55
// RUN: %FileCheck %s --input-file %t/EmitWhileBuilding.formatted.symbols.json
66
// RUN: %FileCheck %s --input-file %t/EmitWhileBuilding.formatted.symbols.json --check-prefix HEADER
7+
// RUN: %FileCheck %s --input-file %t/EmitWhileBuilding.formatted.symbols.json --check-prefix LOCATION
78

89
// REQUIRES: objc_interop
910

@@ -28,3 +29,6 @@ public enum SwiftEnum {}
2829
// CHECK-NEXT: "spelling": "SwiftEnum"
2930
// CHECK-NEXT: }
3031
// CHECK-NEXT: ],
32+
33+
// ensure that the only nodes with a "location" field are the ones that came from Swift
34+
// LOCATION-COUNT-2: "location":

0 commit comments

Comments
 (0)