public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] gccrs: Minor tuning in AST dump
@ 2023-05-02 7:11 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-05-02 7:11 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:d2df050bd4392119adf64d0e35670c1a85d6451b
commit d2df050bd4392119adf64d0e35670c1a85d6451b
Author: Marc Poulhiès <dkm@kataplop.net>
Date: Wed Apr 26 23:08:30 2023 +0200
gccrs: Minor tuning in AST dump
Use parentheses to remove any ambiguities when dumping expressions with
unary ! and -.
gcc/rust/ChangeLog:
* ast/rust-ast-dump.cc (Dump::visit): print parentheses around
unique expression operand.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
Diff:
---
gcc/rust/ast/rust-ast-dump.cc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc
index c5c3300dbf9..4c1f3d85b11 100644
--- a/gcc/rust/ast/rust-ast-dump.cc
+++ b/gcc/rust/ast/rust-ast-dump.cc
@@ -554,13 +554,14 @@ Dump::visit (NegationExpr &expr)
switch (expr.get_expr_type ())
{
case NegationOperator::NEGATE:
- stream << '-';
+ stream << "-(";
break;
case NegationOperator::NOT:
- stream << '!';
+ stream << "!(";
break;
}
visit (expr.get_negated_expr ());
+ stream << ')';
}
void
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-02 7:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-02 7:11 [gcc/devel/rust/master] gccrs: Minor tuning in AST dump Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).