diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2015-05-26 12:49:18 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2015-05-26 12:49:18 +0200 |
commit | ad4ba28bb0d6acbd78ca6f2da71d987f6bd17ea6 (patch) | |
tree | 529389619f9f210e3855bc6754e7da9d1ceb16f7 /gcc/ada/treepr.adb | |
parent | 241ebe892af143aaf8cce4bfd80f9b8dce97fe72 (diff) | |
download | gcc-ad4ba28bb0d6acbd78ca6f2da71d987f6bd17ea6.zip gcc-ad4ba28bb0d6acbd78ca6f2da71d987f6bd17ea6.tar.gz gcc-ad4ba28bb0d6acbd78ca6f2da71d987f6bd17ea6.tar.bz2 |
[multiple changes]
2015-05-26 Robert Dewar <dewar@adacore.com>
* exp_prag.adb, sem_ch3.adb, sem_ch5.adb, exp_ch11.adb, ghost.adb,
exp_ch6.adb, sem_ch6.adb, sem_ch8.adb, sem_ch11.adb, sem_ch13.adb,
exp_ch3.adb: Minor reformatting.
2015-05-26 Bob Duff <duff@adacore.com>
* treepr.adb: Minor improvement to debugging routines (pp, pn)
robustness. Rearrange the code so passing a nonexistent Node_Id
prints "No such node" rather than crashing, and causing gdb to
generate confusing messages.
2015-05-26 Gary Dismukes <dismukes@adacore.com>
* sem_util.adb: Minor typo fix.
2015-05-26 Yannick Moy <moy@adacore.com>
* sem_aux.adb (Subprogram_Body_Entity): Deal with subprogram stubs.
From-SVN: r223685
Diffstat (limited to 'gcc/ada/treepr.adb')
-rw-r--r-- | gcc/ada/treepr.adb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb index 8ad81b9..d11a12b 100644 --- a/gcc/ada/treepr.adb +++ b/gcc/ada/treepr.adb @@ -974,7 +974,7 @@ package body Treepr is Prefix_Char : Character) is F : Fchar; - P : Natural := Pchar_Pos (Nkind (N)); + P : Natural; Field_To_Be_Printed : Boolean; Prefix_Str_Char : String (Prefix_Str'First .. Prefix_Str'Last + 1); @@ -987,10 +987,14 @@ package body Treepr is return; end if; - if Nkind (N) = N_Integer_Literal and then Print_In_Hex (N) then - Fmt := Hex; - else - Fmt := Auto; + -- If there is no such node, indicate that. Skip the rest, so we don't + -- crash getting fields of the nonexistent node. + + if N > Atree_Private_Part.Nodes.Last then + Print_Str ("No such node: "); + Print_Int (Int (N)); + Print_Eol; + return; end if; Prefix_Str_Char (Prefix_Str'Range) := Prefix_Str; @@ -1184,6 +1188,14 @@ package body Treepr is -- Loop to print fields included in Pchars array + P := Pchar_Pos (Nkind (N)); + + if Nkind (N) = N_Integer_Literal and then Print_In_Hex (N) then + Fmt := Hex; + else + Fmt := Auto; + end if; + while P < Pchar_Pos (Node_Kind'Succ (Nkind (N))) loop F := Pchars (P); P := P + 1; |