diff options
author | Manman Ren <manman.ren@gmail.com> | 2013-09-09 22:35:23 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2013-09-09 22:35:23 +0000 |
commit | de897a369a8f4f2626c39db4b7f8dc3736a3bf09 (patch) | |
tree | 3dd5010b3972d6120fbc30e6ebe8258d82460064 /llvm/lib/IR/DebugInfo.cpp | |
parent | fff258976de026b9b6b98340ca0950fc9d9c23bb (diff) | |
download | bcm5719-llvm-de897a369a8f4f2626c39db4b7f8dc3736a3bf09.tar.gz bcm5719-llvm-de897a369a8f4f2626c39db4b7f8dc3736a3bf09.zip |
Debug Info: move DIScope::getContext back from DwarfDebug.
This partially reverts r190330. DIScope::getContext now returns DIScopeRef
instead of DIScope. We construct a DIScopeRef from DIScope when we are
dealing with subprogram, lexical block or name space.
llvm-svn: 190362
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index e0b59649a76..51c9e58b2d7 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -785,6 +785,29 @@ Value *DITemplateValueParameter::getValue() const { return getField(DbgNode, 4); } +// If the current node has a parent scope then return that, +// else return an empty scope. +DIScopeRef DIScope::getContext() const { + + if (isType()) + return DIType(DbgNode).getContext(); + + if (isSubprogram()) + return DIScopeRef(DISubprogram(DbgNode).getContext()); + + if (isLexicalBlock()) + return DIScopeRef(DILexicalBlock(DbgNode).getContext()); + + if (isLexicalBlockFile()) + return DIScopeRef(DILexicalBlockFile(DbgNode).getContext()); + + if (isNameSpace()) + return DIScopeRef(DINameSpace(DbgNode).getContext()); + + assert((isFile() || isCompileUnit()) && "Unhandled type of scope."); + return DIScopeRef(NULL); +} + StringRef DIScope::getFilename() const { if (!DbgNode) return StringRef(); |