[llvm] r190362 - Debug Info: move DIScope::getContext back from DwarfDebug.
Manman Ren
manman.ren at gmail.com
Mon Sep 9 15:35:24 PDT 2013
Author: mren
Date: Mon Sep 9 17:35:23 2013
New Revision: 190362
URL: http://llvm.org/viewvc/llvm-project?rev=190362&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/DebugInfo.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/trunk/lib/IR/DebugInfo.cpp
Modified: llvm/trunk/include/llvm/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=190362&r1=190361&r2=190362&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/DebugInfo.h Mon Sep 9 17:35:23 2013
@@ -200,6 +200,9 @@ namespace llvm {
public:
explicit DIScope(const MDNode *N = 0) : DIDescriptor (N) {}
+ /// Gets the parent scope for this scope node or returns a
+ /// default constructed scope.
+ DIScopeRef getContext() const;
StringRef getFilename() const;
StringRef getDirectory() const;
@@ -213,6 +216,7 @@ namespace llvm {
class DIScopeRef {
template <typename DescTy>
friend DescTy DIDescriptor::getFieldAs(unsigned Elt) const;
+ friend DIScopeRef DIScope::getContext() const;
/// Val can be either a MDNode or a MDString, in the latter,
/// MDString specifies the type identifier.
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=190362&r1=190361&r2=190362&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Mon Sep 9 17:35:23 2013
@@ -919,7 +919,7 @@ static bool isTypeUnitScoped(DIType Ty,
// Don't generate a hash for anything scoped inside a function.
if (Parent.isSubprogram())
return false;
- Parent = DD->getScopeContext(Parent);
+ Parent = DD->resolve(Parent.getContext());
}
return true;
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=190362&r1=190361&r2=190362&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Sep 9 17:35:23 2013
@@ -2649,26 +2649,3 @@ void DwarfDebug::emitDebugStrDWO() {
DIScope DwarfDebug::resolve(DIScopeRef SRef) const {
return SRef.resolve(TypeIdentifierMap);
}
-
-// If the current node has a parent scope then return that,
-// else return an empty scope.
-DIScope DwarfDebug::getScopeContext(DIScope S) const {
-
- if (S.isType())
- return resolve(DIType(S).getContext());
-
- if (S.isSubprogram())
- return DISubprogram(S).getContext();
-
- if (S.isLexicalBlock())
- return DILexicalBlock(S).getContext();
-
- if (S.isLexicalBlockFile())
- return DILexicalBlockFile(S).getContext();
-
- if (S.isNameSpace())
- return DINameSpace(S).getContext();
-
- assert((S.isFile() || S.isCompileUnit()) && "Unhandled type of scope.");
- return DIScope();
-}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=190362&r1=190361&r2=190362&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Mon Sep 9 17:35:23 2013
@@ -690,9 +690,6 @@ public:
/// or another context nested inside a subprogram.
bool isSubprogramContext(const MDNode *Context);
- /// Gets the parent scope for this scope node or returns a
- /// default constructed scope.
- DIScope getScopeContext(DIScope S) const;
};
} // End of namespace llvm
Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=190362&r1=190361&r2=190362&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Sep 9 17:35:23 2013
@@ -785,6 +785,29 @@ Value *DITemplateValueParameter::getValu
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();
More information about the llvm-commits
mailing list