* c++: tree dump indentation
@ 2020-07-28 15:35 Nathan Sidwell
0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-07-28 15:35 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 198 bytes --]
We were always forcing an indent, even if there was nothing to indent.
Fixed thusly.
gcc/cp/
* ptree.c (cxx_print_decl): Better indentation.
pushing
--
Nathan Sidwell
[-- Attachment #2: indent.diff --]
[-- Type: text/x-patch, Size: 1313 bytes --]
diff --git i/gcc/cp/ptree.c w/gcc/cp/ptree.c
index 224cf14edb5..dfc244fdceb 100644
--- i/gcc/cp/ptree.c
+++ w/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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-07-28 15:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28 15:35 c++: tree dump indentation Nathan Sidwell
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).