Index: src/common/dwarf_cu_to_module.cc |
diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc |
index c52dffb339b75ff51ddac281d1e8fb6f661bbfd1..99a7bf30cce69bbe608869e1b1e088eb3fe532ea 100644 |
--- a/src/common/dwarf_cu_to_module.cc |
+++ b/src/common/dwarf_cu_to_module.cc |
@@ -384,17 +384,17 @@ string DwarfCUToModule::GenericDIEHandler::ComputeQualifiedName() { |
qualified_name = &specification_->qualified_name; |
} |
- const string *unqualified_name; |
+ const string *unqualified_name = NULL; |
const string *enclosing_name; |
if (!qualified_name) { |
- // Find our unqualified name. If the DIE has its own DW_AT_name |
- // attribute, then use that; otherwise, check our specification. |
- if (name_attribute_.empty() && specification_) |
- unqualified_name = &specification_->unqualified_name; |
- else |
+ // Find the unqualified name. If the DIE has its own DW_AT_name |
+ // attribute, then use that; otherwise, check the specification. |
+ if (!name_attribute_.empty()) |
unqualified_name = &name_attribute_; |
+ else if (specification_) |
+ unqualified_name = &specification_->unqualified_name; |
- // Find the name of our enclosing context. If we have a |
+ // Find the name of the enclosing context. If this DIE has a |
// specification, it's the specification's enclosing context that |
// counts; otherwise, use this DIE's context. |
if (specification_) |
@@ -408,7 +408,7 @@ string DwarfCUToModule::GenericDIEHandler::ComputeQualifiedName() { |
string return_value; |
if (qualified_name) { |
return_value = *qualified_name; |
- } else { |
+ } else if (unqualified_name && enclosing_name) { |
// Combine the enclosing name and unqualified name to produce our |
// own fully-qualified name. |
return_value = cu_context_->language->MakeQualifiedName(*enclosing_name, |
@@ -417,7 +417,7 @@ string DwarfCUToModule::GenericDIEHandler::ComputeQualifiedName() { |
// If this DIE was marked as a declaration, record its names in the |
// specification table. |
- if (declaration_) { |
+ if (declaration_ && qualified_name || (unqualified_name && enclosing_name)) { |
Specification spec; |
if (qualified_name) { |
spec.qualified_name = *qualified_name; |