diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-03-26 23:46:36 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-03-26 23:46:36 +0000 |
commit | fe6db31ce8fb6106c2a51cd2f785fb3900ccb70c (patch) | |
tree | 8dd5fc9a8bf638644c2365d17ee25b2f703218e0 /llvm | |
parent | d14757751f4a6aeee2a7ff473eed2f19a579dbe4 (diff) | |
download | bcm5719-llvm-fe6db31ce8fb6106c2a51cd2f785fb3900ccb70c.tar.gz bcm5719-llvm-fe6db31ce8fb6106c2a51cd2f785fb3900ccb70c.zip |
DebugInfo: more support for mutating DICompositeType to reduce magic number usage in Clang
llvm-svn: 178090
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/DebugInfo.h | 1 | ||||
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/llvm/include/llvm/DebugInfo.h b/llvm/include/llvm/DebugInfo.h index e30713e2520..15f91870a57 100644 --- a/llvm/include/llvm/DebugInfo.h +++ b/llvm/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/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 1916f5ea966..b74522f8b7a 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/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) { |