diff options
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 181 |
1 files changed, 90 insertions, 91 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index b721077594c..ee233f710f2 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -64,7 +64,7 @@ bool DIEDwarfExpression::isFrameRegister(unsigned MachineReg) { } DwarfUnit::DwarfUnit(unsigned UID, dwarf::Tag UnitTag, - const MDCompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, + const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU) : UniqueID(UID), CUNode(Node), UnitDie(UnitTag), DebugInfoOffset(0), Asm(A), DD(DW), DU(DWU), IndexTyDie(nullptr), Section(nullptr) { @@ -161,7 +161,7 @@ int64_t DwarfUnit::getDefaultLowerBound() const { } /// Check whether the DIE for this MDNode can be shared across CUs. -static bool isShareableAcrossCUs(const DebugNode *D) { +static bool isShareableAcrossCUs(const DINode *D) { // When the MDNode can be part of the type system, the DIE can be shared // across CUs. // Combining type units and cross-CU DIE sharing is lower value (since @@ -169,18 +169,18 @@ static bool isShareableAcrossCUs(const DebugNode *D) { // level already) but may be implementable for some value in projects // building multiple independent libraries with LTO and then linking those // together. - return (isa<MDType>(D) || - (isa<MDSubprogram>(D) && !cast<MDSubprogram>(D)->isDefinition())) && + return (isa<DIType>(D) || + (isa<DISubprogram>(D) && !cast<DISubprogram>(D)->isDefinition())) && !GenerateDwarfTypeUnits; } -DIE *DwarfUnit::getDIE(const DebugNode *D) const { +DIE *DwarfUnit::getDIE(const DINode *D) const { if (isShareableAcrossCUs(D)) return DU->getDIE(D); return MDNodeToDieMap.lookup(D); } -void DwarfUnit::insertDIE(const DebugNode *Desc, DIE *D) { +void DwarfUnit::insertDIE(const DINode *Desc, DIE *D) { if (isShareableAcrossCUs(Desc)) { DU->insertDIE(Desc, D); return; @@ -320,7 +320,7 @@ void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute, Entry); } -DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const DebugNode *N) { +DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N) { assert(Tag != dwarf::DW_TAG_auto_variable && Tag != dwarf::DW_TAG_arg_variable); Parent.addChild(make_unique<DIE>((dwarf::Tag)Tag)); @@ -354,38 +354,38 @@ void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, StringRef File, addUInt(Die, dwarf::DW_AT_decl_line, None, Line); } -void DwarfUnit::addSourceLine(DIE &Die, const MDLocalVariable *V) { +void DwarfUnit::addSourceLine(DIE &Die, const DILocalVariable *V) { assert(V); addSourceLine(Die, V->getLine(), V->getScope()->getFilename(), V->getScope()->getDirectory()); } -void DwarfUnit::addSourceLine(DIE &Die, const MDGlobalVariable *G) { +void DwarfUnit::addSourceLine(DIE &Die, const DIGlobalVariable *G) { assert(G); addSourceLine(Die, G->getLine(), G->getFilename(), G->getDirectory()); } -void DwarfUnit::addSourceLine(DIE &Die, const MDSubprogram *SP) { +void DwarfUnit::addSourceLine(DIE &Die, const DISubprogram *SP) { assert(SP); addSourceLine(Die, SP->getLine(), SP->getFilename(), SP->getDirectory()); } -void DwarfUnit::addSourceLine(DIE &Die, const MDType *Ty) { +void DwarfUnit::addSourceLine(DIE &Die, const DIType *Ty) { assert(Ty); addSourceLine(Die, Ty->getLine(), Ty->getFilename(), Ty->getDirectory()); } -void DwarfUnit::addSourceLine(DIE &Die, const MDObjCProperty *Ty) { +void DwarfUnit::addSourceLine(DIE &Die, const DIObjCProperty *Ty) { assert(Ty); addSourceLine(Die, Ty->getLine(), Ty->getFilename(), Ty->getDirectory()); } -void DwarfUnit::addSourceLine(DIE &Die, const MDNamespace *NS) { +void DwarfUnit::addSourceLine(DIE &Die, const DINamespace *NS) { addSourceLine(Die, NS->getLine(), NS->getFilename(), NS->getDirectory()); } @@ -459,27 +459,27 @@ bool DwarfUnit::addRegisterOffset(DIELoc &TheDie, unsigned Reg, void DwarfUnit::addBlockByrefAddress(const DbgVariable &DV, DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location) { - const MDType *Ty = DV.getType(); - const MDType *TmpTy = Ty; + const DIType *Ty = DV.getType(); + const DIType *TmpTy = Ty; uint16_t Tag = Ty->getTag(); bool isPointer = false; StringRef varName = DV.getName(); if (Tag == dwarf::DW_TAG_pointer_type) { - auto *DTy = cast<MDDerivedType>(Ty); + auto *DTy = cast<DIDerivedType>(Ty); TmpTy = resolve(DTy->getBaseType()); isPointer = true; } // Find the __forwarding field and the variable field in the __Block_byref // struct. - DebugNodeArray Fields = cast<MDCompositeTypeBase>(TmpTy)->getElements(); - const MDDerivedType *varField = nullptr; - const MDDerivedType *forwardingField = nullptr; + DINodeArray Fields = cast<DICompositeTypeBase>(TmpTy)->getElements(); + const DIDerivedType *varField = nullptr; + const DIDerivedType *forwardingField = nullptr; for (unsigned i = 0, N = Fields.size(); i < N; ++i) { - auto *DT = cast<MDDerivedType>(Fields[i]); + auto *DT = cast<DIDerivedType>(Fields[i]); StringRef fieldName = DT->getName(); if (fieldName == "__forwarding") forwardingField = DT; @@ -534,8 +534,8 @@ void DwarfUnit::addBlockByrefAddress(const DbgVariable &DV, DIE &Die, } /// Return true if type encoding is unsigned. -static bool isUnsignedDIType(DwarfDebug *DD, const MDType *Ty) { - if (auto *DTy = dyn_cast<MDDerivedTypeBase>(Ty)) { +static bool isUnsignedDIType(DwarfDebug *DD, const DIType *Ty) { + if (auto *DTy = dyn_cast<DIDerivedTypeBase>(Ty)) { dwarf::Tag T = (dwarf::Tag)Ty->getTag(); // Encode pointer constants as unsigned bytes. This is used at least for // null pointer constant emission. @@ -557,7 +557,7 @@ static bool isUnsignedDIType(DwarfDebug *DD, const MDType *Ty) { T == dwarf::DW_TAG_volatile_type || T == dwarf::DW_TAG_restrict_type || T == dwarf::DW_TAG_enumeration_type); - if (MDTypeRef Deriv = DTy->getBaseType()) + if (DITypeRef Deriv = DTy->getBaseType()) return isUnsignedDIType(DD, DD->resolve(Deriv)); // FIXME: Enums without a fixed underlying type have unknown signedness // here, leading to incorrectly emitted constants. @@ -565,7 +565,7 @@ static bool isUnsignedDIType(DwarfDebug *DD, const MDType *Ty) { return false; } - auto *BTy = cast<MDBasicType>(Ty); + auto *BTy = cast<DIBasicType>(Ty); unsigned Encoding = BTy->getEncoding(); assert((Encoding == dwarf::DW_ATE_unsigned || Encoding == dwarf::DW_ATE_unsigned_char || @@ -583,7 +583,7 @@ static bool isUnsignedDIType(DwarfDebug *DD, const MDType *Ty) { } /// If this type is derived from a base type then return base type size. -static uint64_t getBaseTypeSize(DwarfDebug *DD, const MDDerivedType *Ty) { +static uint64_t getBaseTypeSize(DwarfDebug *DD, const DIDerivedType *Ty) { unsigned Tag = Ty->getTag(); if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef && @@ -602,7 +602,7 @@ static uint64_t getBaseTypeSize(DwarfDebug *DD, const MDDerivedType *Ty) { BaseType->getTag() == dwarf::DW_TAG_rvalue_reference_type) return Ty->getSizeInBits(); - if (auto *DT = dyn_cast<MDDerivedType>(BaseType)) + if (auto *DT = dyn_cast<DIDerivedType>(BaseType)) return getBaseTypeSize(DD, DT); return BaseType->getSizeInBits(); @@ -636,12 +636,12 @@ void DwarfUnit::addConstantFPValue(DIE &Die, const ConstantFP *CFP) { } void DwarfUnit::addConstantValue(DIE &Die, const ConstantInt *CI, - const MDType *Ty) { + const DIType *Ty) { addConstantValue(Die, CI->getValue(), Ty); } void DwarfUnit::addConstantValue(DIE &Die, const MachineOperand &MO, - const MDType *Ty) { + const DIType *Ty) { assert(MO.isImm() && "Invalid machine operand!"); addConstantValue(Die, isUnsignedDIType(DD, Ty), MO.getImm()); @@ -654,7 +654,7 @@ void DwarfUnit::addConstantValue(DIE &Die, bool Unsigned, uint64_t Val) { Unsigned ? dwarf::DW_FORM_udata : dwarf::DW_FORM_sdata, Val); } -void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, const MDType *Ty) { +void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty) { addConstantValue(Die, Val, isUnsignedDIType(DD, Ty)); } @@ -695,29 +695,29 @@ void DwarfUnit::addLinkageName(DIE &Die, StringRef LinkageName) { GlobalValue::getRealLinkageName(LinkageName)); } -void DwarfUnit::addTemplateParams(DIE &Buffer, DebugNodeArray TParams) { +void DwarfUnit::addTemplateParams(DIE &Buffer, DINodeArray TParams) { // Add template parameters. for (const auto *Element : TParams) { - if (auto *TTP = dyn_cast<MDTemplateTypeParameter>(Element)) + if (auto *TTP = dyn_cast<DITemplateTypeParameter>(Element)) constructTemplateTypeParameterDIE(Buffer, TTP); - else if (auto *TVP = dyn_cast<MDTemplateValueParameter>(Element)) + else if (auto *TVP = dyn_cast<DITemplateValueParameter>(Element)) constructTemplateValueParameterDIE(Buffer, TVP); } } -DIE *DwarfUnit::getOrCreateContextDIE(const MDScope *Context) { - if (!Context || isa<MDFile>(Context)) +DIE *DwarfUnit::getOrCreateContextDIE(const DIScope *Context) { + if (!Context || isa<DIFile>(Context)) return &getUnitDie(); - if (auto *T = dyn_cast<MDType>(Context)) + if (auto *T = dyn_cast<DIType>(Context)) return getOrCreateTypeDIE(T); - if (auto *NS = dyn_cast<MDNamespace>(Context)) + if (auto *NS = dyn_cast<DINamespace>(Context)) return getOrCreateNameSpace(NS); - if (auto *SP = dyn_cast<MDSubprogram>(Context)) + if (auto *SP = dyn_cast<DISubprogram>(Context)) return getOrCreateSubprogramDIE(SP); return getDIE(Context); } -DIE *DwarfUnit::createTypeDIE(const MDCompositeType *Ty) { +DIE *DwarfUnit::createTypeDIE(const DICompositeType *Ty) { auto *Context = resolve(Ty->getScope()); DIE *ContextDIE = getOrCreateContextDIE(Context); @@ -727,7 +727,7 @@ DIE *DwarfUnit::createTypeDIE(const MDCompositeType *Ty) { // Create new type. DIE &TyDIE = createAndAddDIE(Ty->getTag(), *ContextDIE, Ty); - constructTypeDIE(TyDIE, cast<MDCompositeType>(Ty)); + constructTypeDIE(TyDIE, cast<DICompositeType>(Ty)); updateAcceleratorTables(Context, Ty, TyDIE); return &TyDIE; @@ -737,14 +737,13 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) { if (!TyNode) return nullptr; - auto *Ty = cast<MDType>(TyNode); + auto *Ty = cast<DIType>(TyNode); assert(Ty == resolve(Ty->getRef()) && "type was not uniqued, possible ODR violation."); // DW_TAG_restrict_type is not supported in DWARF2 if (Ty->getTag() == dwarf::DW_TAG_restrict_type && DD->getDwarfVersion() <= 2) - return getOrCreateTypeDIE( - resolve(cast<MDDerivedType>(Ty)->getBaseType())); + return getOrCreateTypeDIE(resolve(cast<DIDerivedType>(Ty)->getBaseType())); // Construct the context before querying for the existence of the DIE in case // such construction creates the DIE. @@ -760,11 +759,11 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) { updateAcceleratorTables(Context, Ty, TyDIE); - if (auto *BT = dyn_cast<MDBasicType>(Ty)) + if (auto *BT = dyn_cast<DIBasicType>(Ty)) constructTypeDIE(TyDIE, BT); - else if (auto *STy = dyn_cast<MDSubroutineType>(Ty)) + else if (auto *STy = dyn_cast<DISubroutineType>(Ty)) constructTypeDIE(TyDIE, STy); - else if (auto *CTy = dyn_cast<MDCompositeType>(Ty)) { + else if (auto *CTy = dyn_cast<DICompositeType>(Ty)) { if (GenerateDwarfTypeUnits && !Ty->isForwardDecl()) if (MDString *TypeId = CTy->getRawIdentifier()) { DD->addDwarfTypeUnitType(getCU(), TypeId->getString(), TyDIE, CTy); @@ -773,17 +772,17 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) { } constructTypeDIE(TyDIE, CTy); } else { - constructTypeDIE(TyDIE, cast<MDDerivedType>(Ty)); + constructTypeDIE(TyDIE, cast<DIDerivedType>(Ty)); } return &TyDIE; } -void DwarfUnit::updateAcceleratorTables(const MDScope *Context, - const MDType *Ty, const DIE &TyDIE) { +void DwarfUnit::updateAcceleratorTables(const DIScope *Context, + const DIType *Ty, const DIE &TyDIE) { if (!Ty->getName().empty() && !Ty->isForwardDecl()) { bool IsImplementation = 0; - if (auto *CT = dyn_cast<MDCompositeTypeBase>(Ty)) { + if (auto *CT = dyn_cast<DICompositeTypeBase>(Ty)) { // A runtime language of 0 actually means C/C++ and that any // non-negative value is some version of Objective-C/C++. IsImplementation = CT->getRuntimeLang() == 0 || CT->isObjcClassComplete(); @@ -791,13 +790,13 @@ void DwarfUnit::updateAcceleratorTables(const MDScope *Context, unsigned Flags = IsImplementation ? dwarf::DW_FLAG_type_implementation : 0; DD->addAccelType(Ty->getName(), TyDIE, Flags); - if (!Context || isa<MDCompileUnit>(Context) || isa<MDFile>(Context) || - isa<MDNamespace>(Context)) + if (!Context || isa<DICompileUnit>(Context) || isa<DIFile>(Context) || + isa<DINamespace>(Context)) addGlobalType(Ty, TyDIE, Context); } } -void DwarfUnit::addType(DIE &Entity, const MDType *Ty, +void DwarfUnit::addType(DIE &Entity, const DIType *Ty, dwarf::Attribute Attribute) { assert(Ty && "Trying to add a type that doesn't exist?"); @@ -818,7 +817,7 @@ void DwarfUnit::addType(DIE &Entity, const MDType *Ty, addDIEEntry(Entity, Attribute, Entry); } -std::string DwarfUnit::getParentContextString(const MDScope *Context) const { +std::string DwarfUnit::getParentContextString(const DIScope *Context) const { if (!Context) return ""; @@ -827,8 +826,8 @@ std::string DwarfUnit::getParentContextString(const MDScope *Context) const { return ""; std::string CS; - SmallVector<const MDScope *, 1> Parents; - while (!isa<MDCompileUnit>(Context)) { + SmallVector<const DIScope *, 1> Parents; + while (!isa<DICompileUnit>(Context)) { Parents.push_back(Context); if (Context->getScope()) Context = resolve(Context->getScope()); @@ -841,9 +840,9 @@ std::string DwarfUnit::getParentContextString(const MDScope *Context) const { // Reverse iterate over our list to go from the outermost construct to the // innermost. for (auto I = Parents.rbegin(), E = Parents.rend(); I != E; ++I) { - const MDScope *Ctx = *I; + const DIScope *Ctx = *I; StringRef Name = Ctx->getName(); - if (Name.empty() && isa<MDNamespace>(Ctx)) + if (Name.empty() && isa<DINamespace>(Ctx)) Name = "(anonymous namespace)"; if (!Name.empty()) { CS += Name; @@ -853,7 +852,7 @@ std::string DwarfUnit::getParentContextString(const MDScope *Context) const { return CS; } -void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDBasicType *BTy) { +void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIBasicType *BTy) { // Get core information. StringRef Name = BTy->getName(); // Add name if not anonymous or intermediate type. @@ -871,14 +870,14 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDBasicType *BTy) { addUInt(Buffer, dwarf::DW_AT_byte_size, None, Size); } -void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDDerivedType *DTy) { +void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy) { // Get core information. StringRef Name = DTy->getName(); uint64_t Size = DTy->getSizeInBits() >> 3; uint16_t Tag = Buffer.getTag(); // Map to main type, void will not have a type. - const MDType *FromTy = resolve(DTy->getBaseType()); + const DIType *FromTy = resolve(DTy->getBaseType()); if (FromTy) addType(Buffer, FromTy); @@ -894,15 +893,15 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDDerivedType *DTy) { if (Tag == dwarf::DW_TAG_ptr_to_member_type) addDIEEntry( Buffer, dwarf::DW_AT_containing_type, - *getOrCreateTypeDIE(resolve(cast<MDDerivedType>(DTy)->getClassType()))); + *getOrCreateTypeDIE(resolve(cast<DIDerivedType>(DTy)->getClassType()))); // Add source line info if available and TyDesc is not a forward declaration. if (!DTy->isForwardDecl()) addSourceLine(Buffer, DTy); } -void DwarfUnit::constructSubprogramArguments(DIE &Buffer, MDTypeRefArray Args) { +void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args) { for (unsigned i = 1, N = Args.size(); i < N; ++i) { - const MDType *Ty = resolve(Args[i]); + const DIType *Ty = resolve(Args[i]); if (!Ty) { assert(i == N-1 && "Unspecified parameter must be the last argument"); createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, Buffer); @@ -915,9 +914,9 @@ void DwarfUnit::constructSubprogramArguments(DIE &Buffer, MDTypeRefArray Args) { } } -void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDSubroutineType *CTy) { +void DwarfUnit::constructTypeDIE(DIE &Buffer, const DISubroutineType *CTy) { // Add return type. A void return won't have a type. - auto Elements = cast<MDSubroutineType>(CTy)->getTypeArray(); + auto Elements = cast<DISubroutineType>(CTy)->getTypeArray(); if (Elements.size()) if (auto RTy = resolve(Elements[0])) addType(Buffer, RTy); @@ -943,7 +942,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDSubroutineType *CTy) { addFlag(Buffer, dwarf::DW_AT_rvalue_reference); } -void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { +void DwarfUnit::constructTypeDIE(DIE &Buffer, const DICompositeType *CTy) { // Add name if not anonymous or intermediate type. StringRef Name = CTy->getName(); @@ -961,13 +960,13 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { case dwarf::DW_TAG_union_type: case dwarf::DW_TAG_class_type: { // Add elements to structure type. - DebugNodeArray Elements = CTy->getElements(); + DINodeArray Elements = CTy->getElements(); for (const auto *Element : Elements) { if (!Element) continue; - if (auto *SP = dyn_cast<MDSubprogram>(Element)) + if (auto *SP = dyn_cast<DISubprogram>(Element)) getOrCreateSubprogramDIE(SP); - else if (auto *DDTy = dyn_cast<MDDerivedType>(Element)) { + else if (auto *DDTy = dyn_cast<DIDerivedType>(Element)) { if (DDTy->getTag() == dwarf::DW_TAG_friend) { DIE &ElemDie = createAndAddDIE(dwarf::DW_TAG_friend, Buffer); addType(ElemDie, resolve(DDTy->getBaseType()), dwarf::DW_AT_friend); @@ -976,7 +975,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { } else { constructMemberDIE(Buffer, DDTy); } - } else if (auto *Property = dyn_cast<MDObjCProperty>(Element)) { + } else if (auto *Property = dyn_cast<DIObjCProperty>(Element)) { DIE &ElemDie = createAndAddDIE(Property->getTag(), Buffer); StringRef PropertyName = Property->getName(); addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName); @@ -1007,7 +1006,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { // This is outside the DWARF spec, but GDB expects a DW_AT_containing_type // inside C++ composite types to point to the base class with the vtable. if (auto *ContainingType = - dyn_cast_or_null<MDCompositeType>(resolve(CTy->getVTableHolder()))) + dyn_cast_or_null<DICompositeType>(resolve(CTy->getVTableHolder()))) addDIEEntry(Buffer, dwarf::DW_AT_containing_type, *getOrCreateTypeDIE(ContainingType)); @@ -1058,7 +1057,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { } void DwarfUnit::constructTemplateTypeParameterDIE( - DIE &Buffer, const MDTemplateTypeParameter *TP) { + DIE &Buffer, const DITemplateTypeParameter *TP) { DIE &ParamDIE = createAndAddDIE(dwarf::DW_TAG_template_type_parameter, Buffer); // Add the type if it exists, it could be void and therefore no type. @@ -1069,7 +1068,7 @@ void DwarfUnit::constructTemplateTypeParameterDIE( } void DwarfUnit::constructTemplateValueParameterDIE( - DIE &Buffer, const MDTemplateValueParameter *VP) { + DIE &Buffer, const DITemplateValueParameter *VP) { DIE &ParamDIE = createAndAddDIE(VP->getTag(), Buffer); // Add the type if there is one, template template and template parameter @@ -1100,7 +1099,7 @@ void DwarfUnit::constructTemplateValueParameterDIE( } } -DIE *DwarfUnit::getOrCreateNameSpace(const MDNamespace *NS) { +DIE *DwarfUnit::getOrCreateNameSpace(const DINamespace *NS) { // Construct the context before querying for the existence of the DIE in case // such construction creates the DIE. DIE *ContextDIE = getOrCreateContextDIE(NS->getScope()); @@ -1120,7 +1119,7 @@ DIE *DwarfUnit::getOrCreateNameSpace(const MDNamespace *NS) { return &NDie; } -DIE *DwarfUnit::getOrCreateSubprogramDIE(const MDSubprogram *SP, bool Minimal) { +DIE *DwarfUnit::getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal) { // Construct the context before querying for the existence of the DIE in case // such construction creates the DIE (as is the case for member function // declarations). @@ -1151,7 +1150,7 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(const MDSubprogram *SP, bool Minimal) { return &SPDie; } -bool DwarfUnit::applySubprogramDefinitionAttributes(const MDSubprogram *SP, +bool DwarfUnit::applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie) { DIE *DeclDie = nullptr; StringRef DeclLinkageName; @@ -1183,7 +1182,7 @@ bool DwarfUnit::applySubprogramDefinitionAttributes(const MDSubprogram *SP, return true; } -void DwarfUnit::applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie, +void DwarfUnit::applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal) { if (!Minimal) if (applySubprogramDefinitionAttributes(SP, SPDie)) @@ -1207,7 +1206,7 @@ void DwarfUnit::applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie, Language == dwarf::DW_LANG_ObjC)) addFlag(SPDie, dwarf::DW_AT_prototyped); - const MDSubroutineType *SPTy = SP->getType(); + const DISubroutineType *SPTy = SP->getType(); assert(SPTy->getTag() == dwarf::DW_TAG_subroutine_type && "the type of a subprogram should be a subroutine"); @@ -1269,7 +1268,7 @@ void DwarfUnit::applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie, addFlag(SPDie, dwarf::DW_AT_explicit); } -void DwarfUnit::constructSubrangeDIE(DIE &Buffer, const MDSubrange *SR, +void DwarfUnit::constructSubrangeDIE(DIE &Buffer, const DISubrange *SR, DIE *IndexTy) { DIE &DW_Subrange = createAndAddDIE(dwarf::DW_TAG_subrange_type, Buffer); addDIEEntry(DW_Subrange, dwarf::DW_AT_type, *IndexTy); @@ -1303,7 +1302,7 @@ DIE *DwarfUnit::getIndexTyDie() { return IndexTyDie; } -void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { +void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy) { if (CTy->isVector()) addFlag(Buffer, dwarf::DW_AT_GNU_vector); @@ -1316,21 +1315,21 @@ void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { DIE *IdxTy = getIndexTyDie(); // Add subranges to array type. - DebugNodeArray Elements = CTy->getElements(); + DINodeArray Elements = CTy->getElements(); for (unsigned i = 0, N = Elements.size(); i < N; ++i) { // FIXME: Should this really be such a loose cast? - if (auto *Element = dyn_cast_or_null<DebugNode>(Elements[i])) + if (auto *Element = dyn_cast_or_null<DINode>(Elements[i])) if (Element->getTag() == dwarf::DW_TAG_subrange_type) - constructSubrangeDIE(Buffer, cast<MDSubrange>(Element), IdxTy); + constructSubrangeDIE(Buffer, cast<DISubrange>(Element), IdxTy); } } -void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { - DebugNodeArray Elements = CTy->getElements(); +void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy) { + DINodeArray Elements = CTy->getElements(); // Add enumerators to enumeration type. for (unsigned i = 0, N = Elements.size(); i < N; ++i) { - auto *Enum = dyn_cast_or_null<MDEnumerator>(Elements[i]); + auto *Enum = dyn_cast_or_null<DIEnumerator>(Elements[i]); if (Enum) { DIE &Enumerator = createAndAddDIE(dwarf::DW_TAG_enumerator, Buffer); StringRef Name = Enum->getName(); @@ -1340,7 +1339,7 @@ void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const MDCompositeType *CTy) { Value); } } - const MDType *DTy = resolve(CTy->getBaseType()); + const DIType *DTy = resolve(CTy->getBaseType()); if (DTy) { addType(Buffer, DTy); addFlag(Buffer, dwarf::DW_AT_enum_class); @@ -1351,7 +1350,7 @@ void DwarfUnit::constructContainingTypeDIEs() { for (auto CI = ContainingTypeMap.begin(), CE = ContainingTypeMap.end(); CI != CE; ++CI) { DIE &SPDie = *CI->first; - const DebugNode *D = CI->second; + const DINode *D = CI->second; if (!D) continue; DIE *NDie = getDIE(D); @@ -1361,7 +1360,7 @@ void DwarfUnit::constructContainingTypeDIEs() { } } -void DwarfUnit::constructMemberDIE(DIE &Buffer, const MDDerivedType *DT) { +void DwarfUnit::constructMemberDIE(DIE &Buffer, const DIDerivedType *DT) { DIE &MemberDie = createAndAddDIE(DT->getTag(), Buffer); StringRef Name = DT->getName(); if (!Name.empty()) @@ -1449,7 +1448,7 @@ void DwarfUnit::constructMemberDIE(DIE &Buffer, const MDDerivedType *DT) { addFlag(MemberDie, dwarf::DW_AT_artificial); } -DIE *DwarfUnit::getOrCreateStaticMemberDIE(const MDDerivedType *DT) { +DIE *DwarfUnit::getOrCreateStaticMemberDIE(const DIDerivedType *DT) { if (!DT) return nullptr; @@ -1464,7 +1463,7 @@ DIE *DwarfUnit::getOrCreateStaticMemberDIE(const MDDerivedType *DT) { DIE &StaticMemberDIE = createAndAddDIE(DT->getTag(), *ContextDIE, DT); - const MDType *Ty = resolve(DT->getBaseType()); + const DIType *Ty = resolve(DT->getBaseType()); addString(StaticMemberDIE, dwarf::DW_AT_name, DT->getName()); addType(StaticMemberDIE, Ty); |