mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-16 08:29:43 +00:00
DebugInfo: DIRef<> => TypedDebugNodeRef<>
Delete `DIRef<>`, and replace the remaining uses of it with `TypedDebugNodeRef<>`. To minimize code churn, I've added typedefs from `MDTypeRef` to `DITypeRef` (etc.). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235071 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ec0a34f850
commit
ce6a39f31f
@ -100,6 +100,9 @@ DECLARE_SIMPLIFY_DESCRIPTOR(DIImportedEntity)
|
||||
|
||||
typedef DebugNodeArray DIArray;
|
||||
typedef MDTypeRefArray DITypeArray;
|
||||
typedef DebugNodeRef DIDescriptorRef;
|
||||
typedef MDScopeRef DIScopeRef;
|
||||
typedef MDTypeRef DITypeRef;
|
||||
|
||||
class DISubrange {
|
||||
MDSubrange *N;
|
||||
@ -124,11 +127,6 @@ public:
|
||||
MDEnumerator &operator*() const { return *N; }
|
||||
};
|
||||
|
||||
template <typename T> class DIRef;
|
||||
typedef DIRef<DIDescriptor> DIDescriptorRef;
|
||||
typedef DIRef<DIScope> DIScopeRef;
|
||||
typedef DIRef<DIType> DITypeRef;
|
||||
|
||||
class DIScope {
|
||||
MDScope *N;
|
||||
|
||||
@ -141,32 +139,6 @@ public:
|
||||
MDScope &operator*() const { return *N; }
|
||||
};
|
||||
|
||||
/// \brief Represents reference to a DIDescriptor.
|
||||
///
|
||||
/// Abstracts over direct and identifier-based metadata references.
|
||||
template <typename T> class DIRef {
|
||||
/// \brief Val can be either a MDNode or a MDString.
|
||||
///
|
||||
/// In the latter, MDString specifies the type identifier.
|
||||
const Metadata *Val;
|
||||
|
||||
public:
|
||||
template <class U>
|
||||
DIRef(const TypedDebugNodeRef<U> &Ref,
|
||||
typename std::enable_if<std::is_convertible<U *, T>::value>::type * =
|
||||
nullptr)
|
||||
: Val(Ref) {}
|
||||
|
||||
T resolve(const DITypeIdentifierMap &Map) const;
|
||||
operator Metadata *() const { return const_cast<Metadata *>(Val); }
|
||||
};
|
||||
|
||||
template <>
|
||||
DIDescriptor DIRef<DIDescriptor>::resolve(const DITypeIdentifierMap &Map) const;
|
||||
template <>
|
||||
DIScope DIRef<DIScope>::resolve(const DITypeIdentifierMap &Map) const;
|
||||
template <> DIType DIRef<DIType>::resolve(const DITypeIdentifierMap &Map) const;
|
||||
|
||||
class DIType {
|
||||
MDType *N;
|
||||
|
||||
|
@ -129,7 +129,7 @@ bool DebugLocDwarfExpression::isFrameRegister(unsigned MachineReg) {
|
||||
|
||||
/// resolve - Look in the DwarfDebug map for the MDNode that
|
||||
/// corresponds to the reference.
|
||||
template <typename T> T DbgVariable::resolve(DIRef<T> Ref) const {
|
||||
template <typename T> T *DbgVariable::resolve(TypedDebugNodeRef<T> Ref) const {
|
||||
return DD->resolve(Ref);
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ public:
|
||||
private:
|
||||
/// resolve - Look in the DwarfDebug map for the MDNode that
|
||||
/// corresponds to the reference.
|
||||
template <typename T> T resolve(DIRef<T> Ref) const;
|
||||
template <typename T> T *resolve(TypedDebugNodeRef<T> Ref) const;
|
||||
};
|
||||
|
||||
|
||||
@ -577,9 +577,6 @@ public:
|
||||
void emitDebugLocEntryLocation(const DebugLocEntry &Entry);
|
||||
|
||||
/// Find the MDNode for the given reference.
|
||||
template <typename T> T resolve(DIRef<T> Ref) const {
|
||||
return Ref.resolve(TypeIdentifierMap);
|
||||
}
|
||||
template <typename T> T *resolve(TypedDebugNodeRef<T> Ref) const {
|
||||
return Ref.resolve(TypeIdentifierMap);
|
||||
}
|
||||
|
@ -342,9 +342,6 @@ protected:
|
||||
|
||||
/// resolve - Look in the DwarfDebug map for the MDNode that
|
||||
/// corresponds to the reference.
|
||||
template <typename T> T resolve(DIRef<T> Ref) const {
|
||||
return DD->resolve(Ref);
|
||||
}
|
||||
template <typename T> T *resolve(TypedDebugNodeRef<T> Ref) const {
|
||||
return DD->resolve(Ref);
|
||||
}
|
||||
|
@ -307,20 +307,6 @@ bool DebugInfoFinder::addScope(DIScope Scope) {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
DIDescriptor
|
||||
DIRef<DIDescriptor>::resolve(const DITypeIdentifierMap &Map) const {
|
||||
return DIDescriptor(DebugNodeRef(Val).resolve(Map));
|
||||
}
|
||||
template <>
|
||||
DIScope DIRef<DIScope>::resolve(const DITypeIdentifierMap &Map) const {
|
||||
return MDScopeRef(Val).resolve(Map);
|
||||
}
|
||||
template <>
|
||||
DIType DIRef<DIType>::resolve(const DITypeIdentifierMap &Map) const {
|
||||
return MDTypeRef(Val).resolve(Map);
|
||||
}
|
||||
|
||||
bool llvm::stripDebugInfo(Function &F) {
|
||||
bool Changed = false;
|
||||
for (BasicBlock &BB : F) {
|
||||
|
Loading…
Reference in New Issue
Block a user