From 7bb386a299a7ccee998654dc7f000f66dd3acbbf Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Tue, 9 Jul 2013 00:16:56 +0000 Subject: [PATCH] Revert "DebugInfo: remove unused helper function getDICompositeType." This reverts commit r185876 as the functions appear to still be used by dragonegg. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185890 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/DebugInfo.h | 3 +++ lib/IR/DebugInfo.cpp | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h index dd03bf70d2c..372d367b707 100644 --- a/include/llvm/DebugInfo.h +++ b/include/llvm/DebugInfo.h @@ -695,6 +695,9 @@ namespace llvm { /// getDISubprogram - Find subprogram that is enclosing this scope. DISubprogram getDISubprogram(const MDNode *Scope); + /// getDICompositeType - Find underlying composite type. + DICompositeType getDICompositeType(DIType T); + /// isSubprogramContext - Return true if Context is either a subprogram /// or another context nested inside a subprogram. bool isSubprogramContext(const MDNode *Context); diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index c55d68fdc74..25d4ea4fc2a 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -844,6 +844,17 @@ DISubprogram llvm::getDISubprogram(const MDNode *Scope) { return DISubprogram(); } +/// getDICompositeType - Find underlying composite type. +DICompositeType llvm::getDICompositeType(DIType T) { + if (T.isCompositeType()) + return DICompositeType(T); + + if (T.isDerivedType()) + return getDICompositeType(DIDerivedType(T).getTypeDerivedFrom()); + + return DICompositeType(); +} + /// isSubprogramContext - Return true if Context is either a subprogram /// or another context nested inside a subprogram. bool llvm::isSubprogramContext(const MDNode *Context) {