From ce6a39f31f1b17089b1a3d12390733da1616fed1 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Thu, 16 Apr 2015 02:24:01 +0000 Subject: [PATCH] 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 --- include/llvm/IR/DebugInfo.h | 34 +++------------------------ lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 2 +- lib/CodeGen/AsmPrinter/DwarfDebug.h | 5 +--- lib/CodeGen/AsmPrinter/DwarfUnit.h | 3 --- lib/IR/DebugInfo.cpp | 14 ----------- 5 files changed, 5 insertions(+), 53 deletions(-) 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) { -- 2.34.1