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 | e72aba9c0ff5b19128f54b09a36d2f4c2a53b40b (patch) | |
tree | ce4a3987eb6b832a55395bf05be09aac775f2c54 /lib/IR/DebugInfo.cpp | |
parent | ee50a46026a8e131bd1b82df729d1c45f856d0ec (diff) | |
download | external_llvm-e72aba9c0ff5b19128f54b09a36d2f4c2a53b40b.zip external_llvm-e72aba9c0ff5b19128f54b09a36d2f4c2a53b40b.tar.gz external_llvm-e72aba9c0ff5b19128f54b09a36d2f4c2a53b40b.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190362 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/DebugInfo.cpp')
-rw-r--r-- | lib/IR/DebugInfo.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index e0b5964..51c9e58 100644 --- a/lib/IR/DebugInfo.cpp +++ b/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(); |