-
Notifications
You must be signed in to change notification settings - Fork 10.5k
ASTPrinter: remove ASTPrinter's dependency on sema. NFC #10985
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
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
Merging. @jrose-apple Please let me know if this unblocks your patch. |
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.
Thanks, Xi!
@@ -294,6 +275,9 @@ struct PrintOptions { | |||
/// Whether to print the extensions from conforming protocols. | |||
bool PrintExtensionFromConformingProtocols = false; | |||
|
|||
std::shared_ptr<ShouldPrintChecker> CurrentPrintabilityChecker = |
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.
Small note: it seems a little funny to make this a shared_ptr
rather than just an optional non-owning pointer.
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.
Like Optional<ShouldPrintChecker*>
? does it mean we don't release the original one when when resetting the pointer?
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.
Just ShouldPrintChecker *
is fine—if it's nullptr
, you get the default behavior. Whenever someone wants to customize it, they can stack-allocate their checker and pass in the address.
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.
Stack allocation is usually insufficient for setting the checker because we set in the factory method of PrintOptions
.
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.
:-/ All right. std::shared_ptr
just seems very heavyweight to me, but I guess PrintOptions don't get copied around a lot and customizing this behavior doesn't happen very often anyway.
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.
Thanks for talking through it with me!
No description provided.