-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[IR][Instructions] Add CallBase::getCalledFunctionName helper
#127038
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
065431f
5d90a01
793cde7
2f05b4e
bbc216f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1345,6 +1345,16 @@ class CallBase : public Instruction { | |
| return nullptr; | ||
| } | ||
|
|
||
| /// Shortcut to retrieving the name of the called function. | ||
| /// Returns std::nullopt, if the function cannot be found. | ||
| std::optional<StringRef> getCalledFunctionName() const { | ||
| Function *F = getCalledFunction(); | ||
| if (F) | ||
| return F->getName(); | ||
|
|
||
| return std::nullopt; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use an empty StringRef as the sentinel instead?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically, yes, but I think
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which is the kind of failure you are trying to avoid needing to worry about? |
||
| } | ||
|
|
||
| /// Return true if the callsite is an indirect call. | ||
| bool isIndirectCall() const; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.