-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add ApplySite::dump(). #23962
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
Add ApplySite::dump(). #23962
Conversation
This is one of the most common operations that I perform in a debugger.
@swift-ci smoke test and merge. |
@swift-ci smoke test linux |
include/swift/SIL/ApplySite.h
Outdated
@@ -383,6 +383,8 @@ class ApplySite { | |||
static bool classof(const SILInstruction *inst) { | |||
return bool(ApplySiteKind::fromNodeKind(inst->getKind())); | |||
} | |||
|
|||
void dump() const { getInstruction()->dump(); } |
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.
Can you wrap this with a used attribute and an obsolute attribute. E.x.:
LLVM_ATTRIBUTE_DEPRECATED(void dump() const, "only for use in the debugger");
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.
(Forgot to add the LLVM_ATTRIBUTE_USED). So it would actually bt his:
LLVM_ATTRIBUTE_DEPRECATED(void dump() const LLVM_ATTRIBUTE_USED, "only for use in the debugger");
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.
I didn't use LLVM_ATTRIBUTE_DEPRECATED because it's not a declaration, it's a trivial inline function definition around SILInstruction::dump() and I didn't want to declare it separately. Incidentally, SILInstruction::dump() is not declared as LLVM_ATTRIBUTE_DEPRECATED either, and it's expected to call these functions within the source to generate debug output.
LLVM_ATTRIBUTE_USED makes perfect sense.
I frankly don't understand the use-case for using both of these attributes together. What problem is solved by polluting the code with LLVM_ATTRIBUTE_DEPRECATED? Sometimes people (like me) accidentally commit a wayward debug print call that's not under a flag for a short time, but I don't see that as a serious problem that the attribute can solve in the common case.
This already passed full testing. |
@swift-ci smoke test and merge. |
@swift-ci smoke test and merge |
This is one of the most common operations that I perform in a debugger.