diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp | 22 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/DWARFDebugInfoEntry.h | 9 |
2 files changed, 20 insertions, 11 deletions
diff --git a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp index 6d2e51a64dc..559667299ca 100644 --- a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp +++ b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp @@ -18,7 +18,6 @@ #include "llvm/Support/raw_ostream.h" using namespace llvm; using namespace dwarf; -typedef DILineInfoSpecifier::FunctionNameKind FunctionNameKind; // Small helper to extract a DIE pointed by a reference // attribute. It looks up the Unit containing the DIE and calls @@ -129,8 +128,7 @@ void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS, uint32_t Ref = formValue.getAsReference(u).getValue(); DWARFDebugInfoEntryMinimal DIE; if (const DWARFUnit *RefU = findUnitAndExtractFast(DIE, u, &Ref)) - if (const char *Ref = DIE.getSubroutineName(RefU, - FunctionNameKind::LinkageName)) + if (const char *Ref = DIE.getName(RefU, DINameKind::LinkageName)) OS << " \"" << Ref << '\"'; } @@ -331,11 +329,19 @@ bool DWARFDebugInfoEntryMinimal::addressRangeContainsAddress( const char * DWARFDebugInfoEntryMinimal::getSubroutineName(const DWARFUnit *U, - FunctionNameKind Kind) const { - if (!isSubroutineDIE() || Kind == FunctionNameKind::None) + DINameKind Kind) const { + if (!isSubroutineDIE()) + return nullptr; + return getName(U, Kind); +} + +const char * +DWARFDebugInfoEntryMinimal::getName(const DWARFUnit *U, + DINameKind Kind) const { + if (Kind == DINameKind::None) return nullptr; // Try to get mangled name only if it was asked for. - if (Kind == FunctionNameKind::LinkageName) { + if (Kind == DINameKind::LinkageName) { if (const char *name = getAttributeValueAsString(U, DW_AT_MIPS_linkage_name, nullptr)) return name; @@ -351,7 +357,7 @@ DWARFDebugInfoEntryMinimal::getSubroutineName(const DWARFUnit *U, if (spec_ref != -1U) { DWARFDebugInfoEntryMinimal spec_die; if (const DWARFUnit *RefU = findUnitAndExtractFast(spec_die, U, &spec_ref)) { - if (const char *name = spec_die.getSubroutineName(RefU, Kind)) + if (const char *name = spec_die.getName(RefU, Kind)) return name; } } @@ -362,7 +368,7 @@ DWARFDebugInfoEntryMinimal::getSubroutineName(const DWARFUnit *U, DWARFDebugInfoEntryMinimal abs_origin_die; if (const DWARFUnit *RefU = findUnitAndExtractFast(abs_origin_die, U, &abs_origin_ref)) { - if (const char *name = abs_origin_die.getSubroutineName(RefU, Kind)) + if (const char *name = abs_origin_die.getName(RefU, Kind)) return name; } } diff --git a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h index 3f912e97b32..7e7efb98ba7 100644 --- a/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h +++ b/llvm/lib/DebugInfo/DWARFDebugInfoEntry.h @@ -125,9 +125,12 @@ public: /// returns its mangled name (or short name, if mangled is missing). /// This name may be fetched from specification or abstract origin /// for this subprogram. Returns null if no name is found. - const char * - getSubroutineName(const DWARFUnit *U, - DILineInfoSpecifier::FunctionNameKind Kind) const; + const char *getSubroutineName(const DWARFUnit *U, DINameKind Kind) const; + + /// Return the DIE name resolving DW_AT_sepcification or + /// DW_AT_abstract_origin references if necessary. + /// Returns null if no name is found. + const char *getName(const DWARFUnit *U, DINameKind Kind) const; /// Retrieves values of DW_AT_call_file, DW_AT_call_line and /// DW_AT_call_column from DIE (or zeroes if they are missing). |

