Remove language check from dwarf2_compute_name
authorTom Tromey <tromey@adacore.com>
Fri, 4 Nov 2022 20:08:13 +0000 (14:08 -0600)
committerTom Tromey <tromey@adacore.com>
Thu, 1 Dec 2022 18:16:41 +0000 (11:16 -0700)
dwarf2_compute_name has a redundant check of the CU's language -- this
is also checked in dwarf2_canonicalize_name.  Removing this slightly
simplifies a future patch.

Reviewed-by: Andrew Burgess <aburgess@redhat.com>
gdb/dwarf2/read.c

index dd7fea400275a1b44b754f4dfc930fd555b36dcc..aa13d42ad778394c01abbb6f50f49bad2baa56c1 100644 (file)
@@ -8927,7 +8927,6 @@ dwarf2_compute_name (const char *name,
       if (die_needs_namespace (die, cu))
        {
          const char *prefix;
-         const char *canonical_name = NULL;
 
          string_file buf;
 
@@ -9093,10 +9092,9 @@ dwarf2_compute_name (const char *name,
 
          const std::string &intermediate_name = buf.string ();
 
-         if (lang == language_cplus)
-           canonical_name
-             = dwarf2_canonicalize_name (intermediate_name.c_str (), cu,
-                                         objfile);
+         const char *canonical_name
+           = dwarf2_canonicalize_name (intermediate_name.c_str (), cu,
+                                       objfile);
 
          /* If we only computed INTERMEDIATE_NAME, or if
             INTERMEDIATE_NAME is already canonical, then we need to