diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-07-28 08:33:48 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-07-28 09:01:31 -0700 |
commit | 9b837af463dc81f849fe99a0ad4f3b477d87c1e3 (patch) | |
tree | c5f1b5287dde24e91ecb682033101e821741ef69 | |
parent | 2ddae15e808a41216d5e7a97db8ae69bb7b77464 (diff) | |
download | gcc-9b837af463dc81f849fe99a0ad4f3b477d87c1e3.zip gcc-9b837af463dc81f849fe99a0ad4f3b477d87c1e3.tar.gz gcc-9b837af463dc81f849fe99a0ad4f3b477d87c1e3.tar.bz2 |
c++: tree dump indentation
We were always forcing an indent, even if there was nothing to indent.
Fixed thusly.
gcc/cp/
* ptree.c (cxx_print_decl): Better indentation.
-rw-r--r-- | gcc/cp/ptree.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c index 224cf14..dfc244f 100644 --- a/gcc/cp/ptree.c +++ b/gcc/cp/ptree.c @@ -57,17 +57,35 @@ cxx_print_decl (FILE *file, tree node, int indent) decl_as_string (node, TFF_TEMPLATE_HEADER)); } - indent_to (file, indent + 3); + bool need_indent = true; + if (DECL_EXTERNAL (node) && DECL_NOT_REALLY_EXTERN (node)) - fprintf (file, " not-really-extern"); + { + if (need_indent) + indent_to (file, indent + 3); + fprintf (file, " not-really-extern"); + need_indent = false; + } + if (TREE_CODE (node) == FUNCTION_DECL && DECL_PENDING_INLINE_INFO (node)) - fprintf (file, " pending-inline-info %p", - (void *) DECL_PENDING_INLINE_INFO (node)); + { + if (need_indent) + indent_to (file, indent + 3); + fprintf (file, " pending-inline-info %p", + (void *) DECL_PENDING_INLINE_INFO (node)); + need_indent = false; + } + if (VAR_OR_FUNCTION_DECL_P (node) && DECL_TEMPLATE_INFO (node)) - fprintf (file, " template-info %p", - (void *) DECL_TEMPLATE_INFO (node)); + { + if (need_indent) + indent_to (file, indent + 3); + fprintf (file, " template-info %p", + (void *) DECL_TEMPLATE_INFO (node)); + need_indent = false; + } } void |