diff options
Diffstat (limited to 'llvm/lib/DebugInfo')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 28 | 
1 files changed, 28 insertions, 0 deletions
| diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp index db5cc37..6c78ef0 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -129,6 +129,25 @@ prettyLanguageVersionString(const DWARFAttribute &AttrValue,        static_cast<SourceLanguageName>(*LName), *LVersion);  } +static llvm::Expected<llvm::StringRef> +getApplePropertyName(const DWARFDie &PropDIE) { +  if (!PropDIE) +    return llvm::createStringError("invalid DIE"); + +  if (PropDIE.getTag() != DW_TAG_APPLE_property) +    return llvm::createStringError("not referencing a DW_TAG_APPLE_property"); + +  auto PropNameForm = PropDIE.find(DW_AT_APPLE_property_name); +  if (!PropNameForm) +    return ""; + +  auto NameOrErr = PropNameForm->getAsCString(); +  if (!NameOrErr) +    return NameOrErr.takeError(); + +  return *NameOrErr; +} +  static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,                            const DWARFAttribute &AttrValue, unsigned Indent,                            DIDumpOptions DumpOpts) { @@ -233,6 +252,15 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,              Die.getAttributeValueAsReferencedDie(FormValue).getName(                  DINameKind::LinkageName))        OS << Space << "\"" << Name << '\"'; +  } else if (Attr == DW_AT_APPLE_property) { +    auto PropDIE = Die.getAttributeValueAsReferencedDie(FormValue); +    if (auto PropNameOrErr = getApplePropertyName(PropDIE)) +      OS << Space << "\"" << *PropNameOrErr << '\"'; +    else +      DumpOpts.RecoverableErrorHandler(createStringError( +          errc::invalid_argument, +          llvm::formatv("decoding DW_AT_APPLE_property_name: {}", +                        toString(PropNameOrErr.takeError()))));    } else if (Attr == DW_AT_type || Attr == DW_AT_containing_type) {      DWARFDie D = resolveReferencedType(Die, FormValue);      if (D && !D.isNULL()) { | 
