* [Ada] Minor tweak in pretty-printing of expressions
@ 2021-05-04 9:52 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-05-04 9:52 UTC (permalink / raw)
To: gcc-patches; +Cc: Yannick Moy
[-- Attachment #1: Type: text/plain, Size: 427 bytes --]
Printing of expressions is used in GNATprove to display parts of an
assertion which are not proved, Here the printing is improved slightly
for an expression-with-actions, so that the underlying expression is
printed, instead of the corresponding AST form of the expression with
Expr_Name.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* pprint.adb (Expression_Image): Special case for
expression-with-actions.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 812 bytes --]
diff --git a/gcc/ada/pprint.adb b/gcc/ada/pprint.adb
--- a/gcc/ada/pprint.adb
+++ b/gcc/ada/pprint.adb
@@ -682,7 +682,7 @@ package body Pprint is
end case;
end Expr_Name;
- -- Start of processing for Expression_Name
+ -- Start of processing for Expression_Image
begin
if not From_Source then
@@ -697,6 +697,12 @@ package body Pprint is
end;
end if;
+ -- Reach to the underlying expression for an expression-with-actions
+
+ if Nkind (Expr) = N_Expression_With_Actions then
+ return Expression_Image (Expression (Expr), Default);
+ end if;
+
-- Compute left (start) and right (end) slocs for the expression
-- Consider using Sinput.Sloc_Range instead, except that it does not
-- work properly currently???
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-04 9:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 9:52 [Ada] Minor tweak in pretty-printing of expressions Pierre-Marie de Rodat
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).