aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mercier <mercier@adacore.com>2018-05-21 14:52:31 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-21 14:52:31 +0000
commitaf5d8cb0f6bbb33cc5f4aae125b7c34a4f59a8cb (patch)
tree02d4a74305b02b4df2bffc0bf141b04697e7eb1c
parente9d08fd75f6d7bb5edfe81f14be797ffb1707b50 (diff)
downloadgcc-af5d8cb0f6bbb33cc5f4aae125b7c34a4f59a8cb.zip
gcc-af5d8cb0f6bbb33cc5f4aae125b7c34a4f59a8cb.tar.gz
gcc-af5d8cb0f6bbb33cc5f4aae125b7c34a4f59a8cb.tar.bz2
[Ada] Pretty-print attribute names using mixed case
2018-05-21 Daniel Mercier <mercier@adacore.com> gcc/ada/ * pprint.adb: Use mixed case for attribute names. From-SVN: r260470
-rw-r--r--gcc/ada/ChangeLog4
-rw-r--r--gcc/ada/pprint.adb27
2 files changed, 30 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index a439064..1d5f079 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,7 @@
+2018-04-04 Daniel Mercier <mercier@adacore.com>
+
+ * pprint.adb: Use mixed case for attribute names.
+
2018-04-04 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch6.adb (Analyze_Generic_Subprogram_Body): Rename the call to
diff --git a/gcc/ada/pprint.adb b/gcc/ada/pprint.adb
index 52ea018..e66de36 100644
--- a/gcc/ada/pprint.adb
+++ b/gcc/ada/pprint.adb
@@ -24,6 +24,7 @@
------------------------------------------------------------------------------
with Atree; use Atree;
+with Csets; use Csets;
with Einfo; use Einfo;
with Namet; use Namet;
with Nlists; use Nlists;
@@ -272,11 +273,35 @@ package body Pprint is
when N_Attribute_Reference =>
if Take_Prefix then
declare
+ function To_Mixed_Case (S : String) return String;
+ -- Transform given string into the corresponding one in
+ -- mixed case form.
+
+ function To_Mixed_Case (S : String) return String is
+ Ucase : Boolean := True;
+ Result : String (S'Range);
+ begin
+ for J in S'Range loop
+ if Ucase then
+ Result (J) := Fold_Upper (S (J));
+ else
+ Result (J) := Fold_Lower (S (J));
+ end if;
+
+ Ucase := (S (J) = '_');
+ end loop;
+
+ return Result;
+ end To_Mixed_Case;
+
Id : constant Attribute_Id :=
Get_Attribute_Id (Attribute_Name (Expr));
+
+ -- Always use mixed case for attributes
Str : constant String :=
Expr_Name (Prefix (Expr)) & "'"
- & Get_Name_String (Attribute_Name (Expr));
+ & To_Mixed_Case (Get_Name_String
+ (Attribute_Name (Expr)));
N : Node_Id;
Ranges : List_Id;