Skip to content

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

Merged
merged 2 commits into from
Apr 16, 2019
Merged
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions include/swift/SIL/ApplySite.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ class ApplySite {
static bool classof(const SILInstruction *inst) {
return bool(ApplySiteKind::fromNodeKind(inst->getKind()));
}

void dump() const { getInstruction()->dump(); }
Copy link
Contributor

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");

Copy link
Contributor

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");

Copy link
Contributor Author

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.

};

//===----------------------------------------------------------------------===//
Expand Down