diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h index 3a2aff3f15c..e30713e2520 100644 --- a/include/llvm/DebugInfo.h +++ b/include/llvm/DebugInfo.h @@ -354,6 +354,7 @@ namespace llvm { } DIArray getTypeArray() const { return getFieldAs(10); } + void setTypeArray(DIArray Elements, DIArray TParams = DIArray()); unsigned getRunTimeLang() const { return getUnsignedField(11); } DICompositeType getContainingType() const { return getFieldAs(12); diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index 5ab64265e49..1916f5ea966 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -25,6 +25,7 @@ #include "llvm/IR/Module.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Dwarf.h" +#include "llvm/Support/ValueHandle.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; using namespace llvm::dwarf; @@ -615,6 +616,16 @@ MDNode *DIDerivedType::getObjCProperty() const { return dyn_cast_or_null(DbgNode->getOperand(10)); } +/// \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 N(*this); + N->replaceOperandWith(10, Elements); + if (TParams) + N->replaceOperandWith(13, TParams); + DbgNode = N; +} + /// isInlinedFnArgument - Return true if this variable provides debugging /// information for an inlined function arguments. bool DIVariable::isInlinedFnArgument(const Function *CurFn) {