diff options
author | Devang Patel <dpatel@apple.com> | 2009-11-24 01:14:22 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-11-24 01:14:22 +0000 |
commit | 193f720f118f52eb05de172d936a440f335c1469 (patch) | |
tree | e59d5df6c6ccdef3fa724d73c6af0c4abefb6883 /lib/Analysis/DebugInfo.cpp | |
parent | b60d5194f52349b74914593919764fe8f4396bdf (diff) |
Emit pubtypes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89725 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DebugInfo.cpp')
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 1a079b950a..5311f99e01 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -1409,4 +1409,36 @@ bool getLocationInfo(const Value *V, std::string &DisplayName, return DebugLoc::get(Id); } + + /// getDISubprogram - Find subprogram that is enclosing this scope. + DISubprogram getDISubprogram(MDNode *Scope) { + DIDescriptor D(Scope); + if (D.isNull()) + return DISubprogram(); + + if (D.isCompileUnit()) + return DISubprogram(); + + if (D.isSubprogram()) + return DISubprogram(Scope); + + if (D.isLexicalBlock()) + return getDISubprogram(DILexicalBlock(Scope).getContext().getNode()); + + return DISubprogram(); + } + + /// getDICompositeType - Find underlying composite type. + DICompositeType getDICompositeType(DIType T) { + if (T.isNull()) + return DICompositeType(); + + if (T.isCompositeType()) + return DICompositeType(T.getNode()); + + if (T.isDerivedType()) + return getDICompositeType(DIDerivedType(T.getNode()).getTypeDerivedFrom()); + + return DICompositeType(); + } } |