aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-03-26 23:46:36 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-03-26 23:46:36 +0000
commitf34ea642e6402538f217db67a734a8530a36eed0 (patch)
tree1693715da6712baea3ebc02d87a472382da7d75f
parent847e36fb60ed4c9fa08215df4fddbe085bbad87a (diff)
DebugInfo: more support for mutating DICompositeType to reduce magic number usage in Clang
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178090 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/DebugInfo.h1
-rw-r--r--lib/IR/DebugInfo.cpp9
2 files changed, 9 insertions, 1 deletions
diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h
index e30713e252..15f91870a5 100644
--- a/include/llvm/DebugInfo.h
+++ b/include/llvm/DebugInfo.h
@@ -359,6 +359,7 @@ namespace llvm {
DICompositeType getContainingType() const {
return getFieldAs<DICompositeType>(12);
}
+ void setContainingType(DICompositeType ContainingType);
DIArray getTemplateParams() const { return getFieldAs<DIArray>(13); }
/// Verify - Verify that a composite type descriptor is well formed.
diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp
index 1916f5ea96..b74522f8b7 100644
--- a/lib/IR/DebugInfo.cpp
+++ b/lib/IR/DebugInfo.cpp
@@ -616,7 +616,7 @@ MDNode *DIDerivedType::getObjCProperty() const {
return dyn_cast_or_null<MDNode>(DbgNode->getOperand(10));
}
-/// \brief Set the array of member DITypes
+/// \brief Set the array of member DITypes.
void DICompositeType::setTypeArray(DIArray Elements, DIArray TParams) {
assert(!TParams || DbgNode->getNumOperands() == 14 && "If you're setting the template parameters this should include a slot for that");
TrackingVH<MDNode> N(*this);
@@ -626,6 +626,13 @@ void DICompositeType::setTypeArray(DIArray Elements, DIArray TParams) {
DbgNode = N;
}
+/// \brief Set the containing type.
+void DICompositeType::setContainingType(DICompositeType ContainingType) {
+ TrackingVH<MDNode> N(*this);
+ N->replaceOperandWith(12, ContainingType);
+ DbgNode = N;
+}
+
/// isInlinedFnArgument - Return true if this variable provides debugging
/// information for an inlined function arguments.
bool DIVariable::isInlinedFnArgument(const Function *CurFn) {