mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 23:24:34 +00:00
DebugInfo: Gut DIObjCProperty and DIImportedEntity
Gut a couple more classes in the DIDescriptor hierarchy. Leave behind an implicit conversion to `DIDescriptor`, the old base class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234836 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -674,50 +674,29 @@ public:
|
|||||||
MDLocation &operator*() const { return *N; }
|
MDLocation &operator*() const { return *N; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class DIObjCProperty : public DIDescriptor {
|
class DIObjCProperty {
|
||||||
|
MDObjCProperty *N;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DIObjCProperty() = default;
|
DIObjCProperty(const MDObjCProperty *N = nullptr)
|
||||||
DIObjCProperty(const MDObjCProperty *N) : DIDescriptor(N) {}
|
: N(const_cast<MDObjCProperty *>(N)) {}
|
||||||
|
|
||||||
MDObjCProperty *get() const {
|
operator MDObjCProperty *() const { return N; }
|
||||||
return cast_or_null<MDObjCProperty>(DIDescriptor::get());
|
MDObjCProperty *operator->() const { return N; }
|
||||||
}
|
MDObjCProperty &operator*() const { return *N; }
|
||||||
operator MDObjCProperty *() const { return get(); }
|
|
||||||
MDObjCProperty *operator->() const { return get(); }
|
|
||||||
MDObjCProperty &operator*() const { return *get(); }
|
|
||||||
|
|
||||||
StringRef getObjCPropertyName() const { return get()->getName(); }
|
|
||||||
DIFile getFile() const { return get()->getFile(); }
|
|
||||||
unsigned getLineNumber() const { return get()->getLine(); }
|
|
||||||
|
|
||||||
StringRef getObjCPropertyGetterName() const { return get()->getGetterName(); }
|
|
||||||
StringRef getObjCPropertySetterName() const { return get()->getSetterName(); }
|
|
||||||
unsigned getAttributes() const { return get()->getAttributes(); }
|
|
||||||
|
|
||||||
/// \brief Get the type.
|
|
||||||
///
|
|
||||||
/// \note Objective-C doesn't have an ODR, so there is no benefit in storing
|
|
||||||
/// the type as a DITypeRef here.
|
|
||||||
DIType getType() const { return get()->getType(); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief An imported module (C++ using directive or similar).
|
class DIImportedEntity {
|
||||||
class DIImportedEntity : public DIDescriptor {
|
MDImportedEntity *N;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DIImportedEntity() = default;
|
DIImportedEntity(const MDImportedEntity *N = nullptr)
|
||||||
DIImportedEntity(const MDImportedEntity *N) : DIDescriptor(N) {}
|
: N(const_cast<MDImportedEntity *>(N)) {}
|
||||||
|
|
||||||
MDImportedEntity *get() const {
|
operator DIDescriptor() const { return N; }
|
||||||
return cast_or_null<MDImportedEntity>(DIDescriptor::get());
|
operator MDImportedEntity *() const { return N; }
|
||||||
}
|
MDImportedEntity *operator->() const { return N; }
|
||||||
operator MDImportedEntity *() const { return get(); }
|
MDImportedEntity &operator*() const { return *N; }
|
||||||
MDImportedEntity *operator->() const { return get(); }
|
|
||||||
MDImportedEntity &operator*() const { return *get(); }
|
|
||||||
|
|
||||||
DIScope getContext() const { return get()->getScope(); }
|
|
||||||
DIDescriptorRef getEntity() const { return get()->getEntity(); }
|
|
||||||
unsigned getLineNumber() const { return get()->getLine(); }
|
|
||||||
StringRef getName() const { return get()->getName(); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SIMPLIFY_DESCRIPTOR(DESC) \
|
#define SIMPLIFY_DESCRIPTOR(DESC) \
|
||||||
|
@ -2136,6 +2136,11 @@ public:
|
|||||||
MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
|
MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
|
||||||
StringRef getGetterName() const { return getStringOperand(2); }
|
StringRef getGetterName() const { return getStringOperand(2); }
|
||||||
StringRef getSetterName() const { return getStringOperand(3); }
|
StringRef getSetterName() const { return getStringOperand(3); }
|
||||||
|
|
||||||
|
/// \brief Get the type.
|
||||||
|
///
|
||||||
|
/// \note Objective-C doesn't have an ODR, so there is no benefit in storing
|
||||||
|
/// the type as a DITypeRef here.
|
||||||
MDType *getType() const { return cast_or_null<MDType>(getRawType()); }
|
MDType *getType() const { return cast_or_null<MDType>(getRawType()); }
|
||||||
|
|
||||||
StringRef getFilename() const {
|
StringRef getFilename() const {
|
||||||
@ -2160,6 +2165,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// \brief An imported module (C++ using directive or similar).
|
||||||
class MDImportedEntity : public DebugNode {
|
class MDImportedEntity : public DebugNode {
|
||||||
friend class LLVMContextImpl;
|
friend class LLVMContextImpl;
|
||||||
friend class MDNode;
|
friend class MDNode;
|
||||||
|
@ -633,10 +633,10 @@ DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
|
|||||||
|
|
||||||
std::unique_ptr<DIE>
|
std::unique_ptr<DIE>
|
||||||
DwarfCompileUnit::constructImportedEntityDIE(const DIImportedEntity &Module) {
|
DwarfCompileUnit::constructImportedEntityDIE(const DIImportedEntity &Module) {
|
||||||
std::unique_ptr<DIE> IMDie = make_unique<DIE>((dwarf::Tag)Module.getTag());
|
std::unique_ptr<DIE> IMDie = make_unique<DIE>((dwarf::Tag)Module->getTag());
|
||||||
insertDIE(Module, IMDie.get());
|
insertDIE(Module, IMDie.get());
|
||||||
DIE *EntityDie;
|
DIE *EntityDie;
|
||||||
DIDescriptor Entity = resolve(Module.getEntity());
|
auto *Entity = resolve(Module->getEntity());
|
||||||
if (auto *NS = dyn_cast<MDNamespace>(Entity))
|
if (auto *NS = dyn_cast<MDNamespace>(Entity))
|
||||||
EntityDie = getOrCreateNameSpace(NS);
|
EntityDie = getOrCreateNameSpace(NS);
|
||||||
else if (auto *SP = dyn_cast<MDSubprogram>(Entity))
|
else if (auto *SP = dyn_cast<MDSubprogram>(Entity))
|
||||||
@ -648,11 +648,10 @@ DwarfCompileUnit::constructImportedEntityDIE(const DIImportedEntity &Module) {
|
|||||||
else
|
else
|
||||||
EntityDie = getDIE(Entity);
|
EntityDie = getDIE(Entity);
|
||||||
assert(EntityDie);
|
assert(EntityDie);
|
||||||
addSourceLine(*IMDie, Module.getLineNumber(),
|
addSourceLine(*IMDie, Module->getLine(), Module->getScope()->getFilename(),
|
||||||
Module.getContext().getFilename(),
|
Module->getScope()->getDirectory());
|
||||||
Module.getContext().getDirectory());
|
|
||||||
addDIEEntry(*IMDie, dwarf::DW_AT_import, *EntityDie);
|
addDIEEntry(*IMDie, dwarf::DW_AT_import, *EntityDie);
|
||||||
StringRef Name = Module.getName();
|
StringRef Name = Module->getName();
|
||||||
if (!Name.empty())
|
if (!Name.empty())
|
||||||
addString(*IMDie, dwarf::DW_AT_name, Name);
|
addString(*IMDie, dwarf::DW_AT_name, Name);
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ DwarfCompileUnit &DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) {
|
|||||||
void DwarfDebug::constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
|
void DwarfDebug::constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
|
||||||
const MDNode *N) {
|
const MDNode *N) {
|
||||||
DIImportedEntity Module = cast<MDImportedEntity>(N);
|
DIImportedEntity Module = cast<MDImportedEntity>(N);
|
||||||
if (DIE *D = TheCU.getOrCreateContextDIE(Module.getContext()))
|
if (DIE *D = TheCU.getOrCreateContextDIE(Module->getScope()))
|
||||||
D->addChild(TheCU.constructImportedEntityDIE(Module));
|
D->addChild(TheCU.constructImportedEntityDIE(Module));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,9 +432,7 @@ void DwarfUnit::addSourceLine(DIE &Die, DIType Ty) {
|
|||||||
void DwarfUnit::addSourceLine(DIE &Die, DIObjCProperty Ty) {
|
void DwarfUnit::addSourceLine(DIE &Die, DIObjCProperty Ty) {
|
||||||
assert(Ty);
|
assert(Ty);
|
||||||
|
|
||||||
DIFile File = Ty.getFile();
|
addSourceLine(Die, Ty->getLine(), Ty->getFilename(), Ty->getDirectory());
|
||||||
addSourceLine(Die, Ty.getLineNumber(), File.getFilename(),
|
|
||||||
File.getDirectory());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// addSourceLine - Add location information to specified debug information
|
/// addSourceLine - Add location information to specified debug information
|
||||||
@ -1060,19 +1058,19 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
|
|||||||
constructMemberDIE(Buffer, DDTy);
|
constructMemberDIE(Buffer, DDTy);
|
||||||
}
|
}
|
||||||
} else if (DIObjCProperty Property = dyn_cast<MDObjCProperty>(Element)) {
|
} else if (DIObjCProperty Property = dyn_cast<MDObjCProperty>(Element)) {
|
||||||
DIE &ElemDie = createAndAddDIE(Property.getTag(), Buffer);
|
DIE &ElemDie = createAndAddDIE(Property->getTag(), Buffer);
|
||||||
StringRef PropertyName = Property.getObjCPropertyName();
|
StringRef PropertyName = Property->getName();
|
||||||
addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
|
addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
|
||||||
if (Property.getType())
|
if (Property->getType())
|
||||||
addType(ElemDie, Property.getType());
|
addType(ElemDie, Property->getType());
|
||||||
addSourceLine(ElemDie, Property);
|
addSourceLine(ElemDie, Property);
|
||||||
StringRef GetterName = Property.getObjCPropertyGetterName();
|
StringRef GetterName = Property->getGetterName();
|
||||||
if (!GetterName.empty())
|
if (!GetterName.empty())
|
||||||
addString(ElemDie, dwarf::DW_AT_APPLE_property_getter, GetterName);
|
addString(ElemDie, dwarf::DW_AT_APPLE_property_getter, GetterName);
|
||||||
StringRef SetterName = Property.getObjCPropertySetterName();
|
StringRef SetterName = Property->getSetterName();
|
||||||
if (!SetterName.empty())
|
if (!SetterName.empty())
|
||||||
addString(ElemDie, dwarf::DW_AT_APPLE_property_setter, SetterName);
|
addString(ElemDie, dwarf::DW_AT_APPLE_property_setter, SetterName);
|
||||||
if (unsigned PropertyAttributes = Property.getAttributes())
|
if (unsigned PropertyAttributes = Property->getAttributes())
|
||||||
addUInt(ElemDie, dwarf::DW_AT_APPLE_property_attribute, None,
|
addUInt(ElemDie, dwarf::DW_AT_APPLE_property_attribute, None,
|
||||||
PropertyAttributes);
|
PropertyAttributes);
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope Context,
|
|||||||
SmallVectorImpl<TrackingMDNodeRef> &AllImportedModules) {
|
SmallVectorImpl<TrackingMDNodeRef> &AllImportedModules) {
|
||||||
DIImportedEntity M =
|
DIImportedEntity M =
|
||||||
MDImportedEntity::get(C, Tag, Context, DebugNodeRef(NS), Line, Name);
|
MDImportedEntity::get(C, Tag, Context, DebugNodeRef(NS), Line, Name);
|
||||||
AllImportedModules.emplace_back(M.get());
|
AllImportedModules.emplace_back(M);
|
||||||
return M;
|
return M;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ void DebugInfoFinder::processModule(const Module &M) {
|
|||||||
for (auto *RT : CU->getRetainedTypes())
|
for (auto *RT : CU->getRetainedTypes())
|
||||||
processType(RT);
|
processType(RT);
|
||||||
for (DIImportedEntity Import : CU->getImportedEntities()) {
|
for (DIImportedEntity Import : CU->getImportedEntities()) {
|
||||||
DIDescriptor Entity = Import.getEntity().resolve(TypeIdentifierMap);
|
auto *Entity = Import->getEntity().resolve(TypeIdentifierMap);
|
||||||
if (auto *T = dyn_cast<MDType>(Entity))
|
if (auto *T = dyn_cast<MDType>(Entity))
|
||||||
processType(T);
|
processType(T);
|
||||||
else if (auto *SP = dyn_cast<MDSubprogram>(Entity))
|
else if (auto *SP = dyn_cast<MDSubprogram>(Entity))
|
||||||
|
Reference in New Issue
Block a user