Skip to content

add default values for SymbolGraphOptions #59037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions include/swift/SymbolGraphGen/SymbolGraphOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,33 @@ namespace symbolgraphgen {

struct SymbolGraphOptions {
/// The directory to output the symbol graph JSON files.
StringRef OutputDir;
StringRef OutputDir = {};

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

/// The minimum access level that symbols must have in order to be
/// included in the graph.
AccessLevel MinimumAccessLevel;
AccessLevel MinimumAccessLevel = AccessLevel::Public;

/// Emit members gotten through class inheritance or protocol default
/// implementations with compound, "SYNTHESIZED" USRs.
bool EmitSynthesizedMembers;
bool EmitSynthesizedMembers = false;

/// Whether to print informational messages when rendering
/// a symbol graph.
bool PrintMessages;
bool PrintMessages = false;

/// Whether to skip docs for symbols with compound, "SYNTHESIZED" USRs.
bool SkipInheritedDocs;
bool SkipInheritedDocs = false;

/// Whether to emit symbols with SPI information.
bool IncludeSPISymbols;
bool IncludeSPISymbols = false;

/// Whether to include documentation for clang nodes or not.
bool IncludeClangDocs;
bool IncludeClangDocs = false;
};

} // end namespace symbolgraphgen
Expand Down
1 change: 1 addition & 0 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,7 @@ static void ParseSymbolGraphArgs(symbolgraphgen::SymbolGraphOptions &Opts,
Opts.PrettyPrint = false;
Opts.EmitSynthesizedMembers = true;
Opts.PrintMessages = false;
Opts.IncludeClangDocs = false;
}

static bool ParseSearchPathArgs(SearchPathOptions &Opts,
Expand Down
4 changes: 4 additions & 0 deletions test/SymbolGraph/ClangImporter/EmitWhileBuilding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// RUN: %{python} -m json.tool %t/EmitWhileBuilding.symbols.json %t/EmitWhileBuilding.formatted.symbols.json
// RUN: %FileCheck %s --input-file %t/EmitWhileBuilding.formatted.symbols.json
// RUN: %FileCheck %s --input-file %t/EmitWhileBuilding.formatted.symbols.json --check-prefix HEADER
// RUN: %FileCheck %s --input-file %t/EmitWhileBuilding.formatted.symbols.json --check-prefix LOCATION

// REQUIRES: objc_interop

Expand All @@ -28,3 +29,6 @@ public enum SwiftEnum {}
// CHECK-NEXT: "spelling": "SwiftEnum"
// CHECK-NEXT: }
// CHECK-NEXT: ],

// ensure that the only nodes with a "location" field are the ones that came from Swift
// LOCATION-COUNT-2: "location":