diff --git a/include/llvm/IR/DebugInfo.h b/include/llvm/IR/DebugInfo.h index 3233ea34c60..18b0c72b008 100644 --- a/include/llvm/IR/DebugInfo.h +++ b/include/llvm/IR/DebugInfo.h @@ -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 class DIRef; -typedef DIRef DIDescriptorRef; -typedef DIRef DIScopeRef; -typedef DIRef 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 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 - DIRef(const TypedDebugNodeRef &Ref, - typename std::enable_if::value>::type * = - nullptr) - : Val(Ref) {} - - T resolve(const DITypeIdentifierMap &Map) const; - operator Metadata *() const { return const_cast(Val); } -}; - -template <> -DIDescriptor DIRef::resolve(const DITypeIdentifierMap &Map) const; -template <> -DIScope DIRef::resolve(const DITypeIdentifierMap &Map) const; -template <> DIType DIRef::resolve(const DITypeIdentifierMap &Map) const; - class DIType { MDType *N; diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index b59c5e3e049..97c9855fe14 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -129,7 +129,7 @@ bool DebugLocDwarfExpression::isFrameRegister(unsigned MachineReg) { /// resolve - Look in the DwarfDebug map for the MDNode that /// corresponds to the reference. -template T DbgVariable::resolve(DIRef Ref) const { +template T *DbgVariable::resolve(TypedDebugNodeRef Ref) const { return DD->resolve(Ref); } diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h index c718baf47ba..809e7bdde10 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -173,7 +173,7 @@ public: private: /// resolve - Look in the DwarfDebug map for the MDNode that /// corresponds to the reference. - template T resolve(DIRef Ref) const; + template T *resolve(TypedDebugNodeRef Ref) const; }; @@ -577,9 +577,6 @@ public: void emitDebugLocEntryLocation(const DebugLocEntry &Entry); /// Find the MDNode for the given reference. - template T resolve(DIRef Ref) const { - return Ref.resolve(TypeIdentifierMap); - } template T *resolve(TypedDebugNodeRef Ref) const { return Ref.resolve(TypeIdentifierMap); } diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.h b/lib/CodeGen/AsmPrinter/DwarfUnit.h index a7378738d67..b354255d709 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.h +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.h @@ -342,9 +342,6 @@ protected: /// resolve - Look in the DwarfDebug map for the MDNode that /// corresponds to the reference. - template T resolve(DIRef Ref) const { - return DD->resolve(Ref); - } template T *resolve(TypedDebugNodeRef Ref) const { return DD->resolve(Ref); } diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index d877325b1f1..719c28b547f 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -307,20 +307,6 @@ bool DebugInfoFinder::addScope(DIScope Scope) { return true; } -template <> -DIDescriptor -DIRef::resolve(const DITypeIdentifierMap &Map) const { - return DIDescriptor(DebugNodeRef(Val).resolve(Map)); -} -template <> -DIScope DIRef::resolve(const DITypeIdentifierMap &Map) const { - return MDScopeRef(Val).resolve(Map); -} -template <> -DIType DIRef::resolve(const DITypeIdentifierMap &Map) const { - return MDTypeRef(Val).resolve(Map); -} - bool llvm::stripDebugInfo(Function &F) { bool Changed = false; for (BasicBlock &BB : F) {