-
Notifications
You must be signed in to change notification settings - Fork 14.3k
DiagnosticPrinter: Use printAsOperand to handle anonymous values #119491
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
DiagnosticPrinter: Use printAsOperand to handle anonymous values #119491
Conversation
@llvm/pr-subscribers-backend-arm @llvm/pr-subscribers-llvm-ir Author: Matt Arsenault (arsenm) ChangesTo avoid changing the behavior in the general case, only do this Full diff: https://github.com/llvm/llvm-project/pull/119491.diff 1 Files Affected:
diff --git a/llvm/lib/IR/DiagnosticPrinter.cpp b/llvm/lib/IR/DiagnosticPrinter.cpp
index 49b8bbae53be9e..5ded23403b41e6 100644
--- a/llvm/lib/IR/DiagnosticPrinter.cpp
+++ b/llvm/lib/IR/DiagnosticPrinter.cpp
@@ -97,7 +97,12 @@ DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Twine &Str) {
// IR related types.
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Value &V) {
- Stream << V.getName();
+ // Avoid printing '@' prefix for named functions.
+ if (V.hasName())
+ Stream << V.getName();
+ else
+ V.printAsOperand(Stream, /*PrintType=*/false);
+
return *this;
}
|
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 add a test?
See next up the stack |
dff095d
to
1619481
Compare
To avoid changing the behavior in the general case, only do this for anonymous functions. Otherwise, we'll end up with a leading '@' on the name, which may not be meaningful to end users.
8bfb4bd
to
84bc22e
Compare
To avoid changing the behavior in the general case, only do this
for anonymous functions. Otherwise, we'll end up with a leading
'@' on the name, which may not be meaningful to end users.