DebugInfo: more support for mutating DICompositeType to reduce magic number usage in Clang

llvm-svn: 178090
This commit is contained in:
David Blaikie 2013-03-26 23:46:36 +00:00
parent d14757751f
commit fe6db31ce8
2 changed files with 9 additions and 1 deletions

View File

@ -359,6 +359,7 @@ namespace llvm {
DICompositeType getContainingType() const { DICompositeType getContainingType() const {
return getFieldAs<DICompositeType>(12); return getFieldAs<DICompositeType>(12);
} }
void setContainingType(DICompositeType ContainingType);
DIArray getTemplateParams() const { return getFieldAs<DIArray>(13); } DIArray getTemplateParams() const { return getFieldAs<DIArray>(13); }
/// Verify - Verify that a composite type descriptor is well formed. /// Verify - Verify that a composite type descriptor is well formed.

View File

@ -616,7 +616,7 @@ MDNode *DIDerivedType::getObjCProperty() const {
return dyn_cast_or_null<MDNode>(DbgNode->getOperand(10)); 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) { 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"); assert(!TParams || DbgNode->getNumOperands() == 14 && "If you're setting the template parameters this should include a slot for that");
TrackingVH<MDNode> N(*this); TrackingVH<MDNode> N(*this);
@ -626,6 +626,13 @@ void DICompositeType::setTypeArray(DIArray Elements, DIArray TParams) {
DbgNode = N; 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 /// isInlinedFnArgument - Return true if this variable provides debugging
/// information for an inlined function arguments. /// information for an inlined function arguments.
bool DIVariable::isInlinedFnArgument(const Function *CurFn) { bool DIVariable::isInlinedFnArgument(const Function *CurFn) {