-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SymbolGraphGen] silence symbolgraph-extract output without -v flag #36785
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
Conversation
rdar://72630103
@swift-ci Please smoke test |
@swift-ci Please build toolchain macOS platform |
|
||
/// Whether to silence the "Found N symbols" messages when rendering | ||
/// a symbol graph. | ||
bool QuietMessages; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "quiet" common terminology? Maybe SilenceMessage
would fit better here (see https://github.com/apple/swift/blob/a5a79f23c0257c36c297d3c1b9275a873434468a/lib/Sema/TypeCheckType.h#L57)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When i started writing this, i assumed i would use a --quiet
flag, which i've seen on other tools to reduce/eliminate the messages they display. Since the meaning was ultimately inverted (no output without -v
flag), this might work better as PrintMessages
instead. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PrintMessages
sounds good as well!
llvm::errs() << ModuleDecls.size() | ||
<< " top-level declarations in this module.\n"; | ||
if (!Options.QuietMessages) | ||
llvm::errs() << ModuleDecls.size() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way to implement this would be to create a stream that forwards its input to llvm:errs()
only if QuietMessages
is true. That way we don't have to guard the messages around if
checks. I don't really mind either way though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless there's some "optional stream wrapper" type that exists somewhere, this implementation feels like the "smallest diff" way to implement this. Otherwise, i'd have to implement the wrapper myself.
@@ -35,6 +35,10 @@ struct SymbolGraphOptions { | |||
/// Emit members gotten through class inheritance or protocol default | |||
/// implementations with compound, "SYNTHESIZED" USRs. | |||
bool EmitSynthesizedMembers; | |||
|
|||
/// Whether to silence the "Found N symbols" messages when rendering |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more than the "Found N symbols" messages though right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are three lines that are affected by this change:
Emitting symbol graph file for module: <filename>.swiftmodule
X top-level declarations in this file.
Found Y symbols and Z relationships.
emitSymbolGraphForModule
only emits the latter two (the first is printed directly by swift-symbolgraph-extract
), so centering the docs around the "Found N symbols" seemed like the most direct way to describe it. I could mention the "X top-level symbols" line as well if that seems better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true today but might not be in the future. I'm nitpicking though, this isn't blocking :)
Pushed up a commit to invert the meaning of the field. I tweaked the doc comment while i was at it, too. 😉 @swift-ci Please smoke test |
@swift-ci Please build toolchain macOS platform |
macOS Toolchain Install command |
Resolves rdar://72630103
This PR changes how SymbolGraphGen emits its output. By default, the SymbolGraphGen code will not output anything other than errors without a
-v
flag given toswift-symbolgraph-extract
. This also means that the symbol-graph code called from the driver or from SourceKit will now also be silenced.