diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-06 15:28:02 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-06 15:28:02 +0000 |
commit | 8d6cadac1886f4a2dc53ffc4279b71d26647fa22 (patch) | |
tree | a2dc3968bfecca8999f0978eb3c9d4b7086dd505 /gcc/toplev.c | |
parent | ba3a929e20346436d77caa3477f2ffa6899ece1d (diff) | |
download | gcc-8d6cadac1886f4a2dc53ffc4279b71d26647fa22.tar.gz |
* toplev.c (output_stack_usage): Be prepared for suffixes created by
the compiler in the function names.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202339 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r-- | gcc/toplev.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c index 4d12bc9246f..3473211efb1 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1017,22 +1017,35 @@ output_stack_usage (void) { expanded_location loc = expand_location (DECL_SOURCE_LOCATION (current_function_decl)); - const char *raw_id, *id; - - /* Strip the scope prefix if any. */ - raw_id = lang_hooks.decl_printable_name (current_function_decl, 2); - id = strrchr (raw_id, '.'); - if (id) - id++; + /* We don't want to print the full qualified name because it can be long, + so we strip the scope prefix, but we may need to deal with the suffix + created by the compiler. */ + const char *suffix + = strchr (IDENTIFIER_POINTER (DECL_NAME (current_function_decl)), '.'); + const char *name + = lang_hooks.decl_printable_name (current_function_decl, 2); + if (suffix) + { + const char *dot = strchr (name, '.'); + while (dot && strcasecmp (dot, suffix) != 0) + { + name = dot + 1; + dot = strchr (name, '.'); + } + } else - id = raw_id; + { + const char *dot = strrchr (name, '.'); + if (dot) + name = dot + 1; + } fprintf (stack_usage_file, "%s:%d:%d:%s\t"HOST_WIDE_INT_PRINT_DEC"\t%s\n", lbasename (loc.file), loc.line, loc.column, - id, + name, stack_usage, stack_usage_kind_str[stack_usage_kind]); } |