DebugInfo: Remove DIArray and DITypeArray typedefs

Remove the `DIArray` and `DITypeArray` typedefs, preferring the
underlying types (`DebugNodeArray` and `MDTypeRefArray`, respectively).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235413 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-04-21 20:07:38 +00:00
parent 423476d899
commit 1cacd28c3b
9 changed files with 54 additions and 61 deletions

View File

@ -118,7 +118,7 @@ LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Dref, LLVMMetadataRef File,
DIBuilder *D = unwrap(Dref);
return wrap(
D->createSubroutineType(File ? unwrap<MDFile>(File) : nullptr,
DITypeArray(unwrap<MDTuple>(ParameterTypes))));
MDTypeRefArray(unwrap<MDTuple>(ParameterTypes))));
}
LLVMMetadataRef LLVMDIBuilderCreateStructType(
@ -131,7 +131,7 @@ LLVMMetadataRef LLVMDIBuilderCreateStructType(
unwrap<MDScope>(Scope), Name, File ? unwrap<MDFile>(File) : nullptr, Line,
SizeInBits, AlignInBits, Flags,
DerivedFrom ? unwrap<MDType>(DerivedFrom) : nullptr,
ElementTypes ? DIArray(unwrap<MDTuple>(ElementTypes)) : nullptr));
ElementTypes ? DebugNodeArray(unwrap<MDTuple>(ElementTypes)) : nullptr));
}
LLVMMetadataRef LLVMDIBuilderCreateReplaceableCompositeType(
@ -165,7 +165,7 @@ LLVMMetadataRef LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Dref,
DIBuilder *D = unwrap(Dref);
return wrap(D->createArrayType(SizeInBits, AlignInBits,
unwrap<MDType>(ElementType),
DIArray(unwrap<MDTuple>(Subscripts))));
DebugNodeArray(unwrap<MDTuple>(Subscripts))));
}
LLVMMetadataRef LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Dref,
@ -190,7 +190,7 @@ LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Dref,
DIBuilder *D = unwrap(Dref);
Metadata **DataValue = unwrap(Data);
ArrayRef<Metadata *> Elements(DataValue, Length);
DIArray A = D->getOrCreateArray(Elements);
DebugNodeArray A = D->getOrCreateArray(Elements);
return wrap(A.get());
}
@ -200,7 +200,7 @@ LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Dref,
DIBuilder *D = unwrap(Dref);
Metadata **DataValue = unwrap(Data);
ArrayRef<Metadata *> Elements(DataValue, Length);
DITypeArray A = D->getOrCreateTypeArray(Elements);
MDTypeRefArray A = D->getOrCreateTypeArray(Elements);
return wrap(A.get());
}

View File

@ -260,14 +260,12 @@ namespace llvm {
/// for more info.
/// @param TemplateParms Template type parameters.
/// @param UniqueIdentifier A unique identifier for the class.
MDCompositeType *createClassType(MDScope *Scope, StringRef Name,
MDFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
uint64_t OffsetInBits, unsigned Flags,
MDType *DerivedFrom, DIArray Elements,
MDType *VTableHolder = nullptr,
MDNode *TemplateParms = nullptr,
StringRef UniqueIdentifier = "");
MDCompositeType *createClassType(
MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
unsigned Flags, MDType *DerivedFrom, DebugNodeArray Elements,
MDType *VTableHolder = nullptr, MDNode *TemplateParms = nullptr,
StringRef UniqueIdentifier = "");
/// createStructType - Create debugging information entry for a struct.
/// @param Scope Scope in which this struct is defined.
@ -283,7 +281,7 @@ namespace llvm {
MDCompositeType *createStructType(
MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
MDType *DerivedFrom, DIArray Elements, unsigned RunTimeLang = 0,
MDType *DerivedFrom, DebugNodeArray Elements, unsigned RunTimeLang = 0,
MDType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");
/// createUnionType - Create debugging information entry for an union.
@ -300,7 +298,7 @@ namespace llvm {
MDCompositeType *createUnionType(MDScope *Scope, StringRef Name,
MDFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
unsigned Flags, DIArray Elements,
unsigned Flags, DebugNodeArray Elements,
unsigned RunTimeLang = 0,
StringRef UniqueIdentifier = "");
@ -341,7 +339,7 @@ namespace llvm {
MDTemplateValueParameter *createTemplateParameterPack(MDScope *Scope,
StringRef Name,
MDType *Ty,
DIArray Val);
DebugNodeArray Val);
/// createArrayType - Create debugging information entry for an array.
/// @param Size Array size.
@ -349,7 +347,7 @@ namespace llvm {
/// @param Ty Element type.
/// @param Subscripts Subscripts.
MDCompositeType *createArrayType(uint64_t Size, uint64_t AlignInBits,
MDType *Ty, DIArray Subscripts);
MDType *Ty, DebugNodeArray Subscripts);
/// createVectorType - Create debugging information entry for a vector type.
/// @param Size Array size.
@ -357,7 +355,7 @@ namespace llvm {
/// @param Ty Element type.
/// @param Subscripts Subscripts.
MDCompositeType *createVectorType(uint64_t Size, uint64_t AlignInBits,
MDType *Ty, DIArray Subscripts);
MDType *Ty, DebugNodeArray Subscripts);
/// createEnumerationType - Create debugging information entry for an
/// enumeration.
@ -372,7 +370,7 @@ namespace llvm {
/// @param UniqueIdentifier A unique identifier for the enum.
MDCompositeType *createEnumerationType(
MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits, DIArray Elements,
uint64_t SizeInBits, uint64_t AlignInBits, DebugNodeArray Elements,
MDType *UnderlyingType, StringRef UniqueIdentifier = "");
/// createSubroutineType - Create subroutine type.
@ -382,7 +380,7 @@ namespace llvm {
/// @param Flags E.g.: LValueReference.
/// These flags are used to emit dwarf attributes.
MDSubroutineType *createSubroutineType(MDFile *File,
DITypeArray ParameterTypes,
MDTypeRefArray ParameterTypes,
unsigned Flags = 0);
/// createArtificialType - Create a new MDType* with "artificial" flag set.
@ -415,11 +413,11 @@ namespace llvm {
/// for a subroutine type.
MDBasicType *createUnspecifiedParameter();
/// getOrCreateArray - Get a DIArray, create one if required.
DIArray getOrCreateArray(ArrayRef<Metadata *> Elements);
/// getOrCreateArray - Get a DebugNodeArray, create one if required.
DebugNodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
/// getOrCreateTypeArray - Get a DITypeArray, create one if required.
DITypeArray getOrCreateTypeArray(ArrayRef<Metadata *> Elements);
/// getOrCreateTypeArray - Get a MDTypeRefArray, create one if required.
MDTypeRefArray getOrCreateTypeArray(ArrayRef<Metadata *> Elements);
/// getOrCreateSubrange - Create a descriptor for a value range. This
/// implicitly uniques the values returned.
@ -664,8 +662,8 @@ namespace llvm {
/// If \c T is resolved, but the arrays aren't -- which can happen if \c T
/// has a self-reference -- \a DIBuilder needs to track the array to
/// resolve cycles.
void replaceArrays(MDCompositeType *&T, DIArray Elements,
DIArray TParems = DIArray());
void replaceArrays(MDCompositeType *&T, DebugNodeArray Elements,
DebugNodeArray TParems = DebugNodeArray());
/// \brief Replace a temporary node.
///

View File

@ -36,9 +36,6 @@ class DbgValueInst;
/// \brief Maps from type identifier to the actual MDNode.
typedef DenseMap<const MDString *, MDType *> DITypeIdentifierMap;
typedef DebugNodeArray DIArray;
typedef MDTypeRefArray DITypeArray;
/// \brief Find subprogram that is enclosing this scope.
MDSubprogram *getDISubprogram(const MDNode *Scope);

View File

@ -570,7 +570,7 @@ void DwarfCompileUnit::constructSubprogramScopeDIE(LexicalScope *Scope) {
DIE &ScopeDIE = updateSubprogramScopeDIE(Sub);
// If this is a variadic function, add an unspecified parameter.
DITypeArray FnArgs = Sub->getType()->getTypeArray();
MDTypeRefArray FnArgs = Sub->getType()->getTypeArray();
// Collect lexical scope children first.
// ObjectPointer might be a local (non-argument) local variable if it's a

View File

@ -474,7 +474,7 @@ void DwarfUnit::addBlockByrefAddress(const DbgVariable &DV, DIE &Die,
// Find the __forwarding field and the variable field in the __Block_byref
// struct.
DIArray Fields = cast<MDCompositeTypeBase>(TmpTy)->getElements();
DebugNodeArray Fields = cast<MDCompositeTypeBase>(TmpTy)->getElements();
const MDDerivedType *varField = nullptr;
const MDDerivedType *forwardingField = nullptr;
@ -695,7 +695,7 @@ void DwarfUnit::addLinkageName(DIE &Die, StringRef LinkageName) {
GlobalValue::getRealLinkageName(LinkageName));
}
void DwarfUnit::addTemplateParams(DIE &Buffer, DIArray TParams) {
void DwarfUnit::addTemplateParams(DIE &Buffer, DebugNodeArray TParams) {
// Add template parameters.
for (const auto *Element : TParams) {
if (auto *TTP = dyn_cast<MDTemplateTypeParameter>(Element))
@ -900,7 +900,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDDerivedType *DTy) {
addSourceLine(Buffer, DTy);
}
void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DITypeArray Args) {
void DwarfUnit::constructSubprogramArguments(DIE &Buffer, MDTypeRefArray Args) {
for (unsigned i = 1, N = Args.size(); i < N; ++i) {
const MDType *Ty = resolve(Args[i]);
if (!Ty) {
@ -961,7 +961,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
case dwarf::DW_TAG_union_type:
case dwarf::DW_TAG_class_type: {
// Add elements to structure type.
DIArray Elements = CTy->getElements();
DebugNodeArray Elements = CTy->getElements();
for (const auto *Element : Elements) {
if (!Element)
continue;
@ -1316,7 +1316,7 @@ void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
DIE *IdxTy = getIndexTyDie();
// Add subranges to array type.
DIArray Elements = CTy->getElements();
DebugNodeArray Elements = CTy->getElements();
for (unsigned i = 0, N = Elements.size(); i < N; ++i) {
// FIXME: Should this really be such a loose cast?
if (auto *Element = dyn_cast_or_null<DebugNode>(Elements[i]))
@ -1326,7 +1326,7 @@ void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
}
void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
DIArray Elements = CTy->getElements();
DebugNodeArray Elements = CTy->getElements();
// Add enumerators to enumeration type.
for (unsigned i = 0, N = Elements.size(); i < N; ++i) {

View File

@ -268,7 +268,7 @@ public:
void addLinkageName(DIE &Die, StringRef LinkageName);
/// \brief Add template parameters in buffer.
void addTemplateParams(DIE &Buffer, DIArray TParams);
void addTemplateParams(DIE &Buffer, DebugNodeArray TParams);
/// \brief Add register operand.
/// \returns false if the register does not exist, e.g., because it was never
@ -316,7 +316,7 @@ public:
void constructContainingTypeDIEs();
/// \brief Construct function argument DIEs.
void constructSubprogramArguments(DIE &Buffer, DITypeArray Args);
void constructSubprogramArguments(DIE &Buffer, MDTypeRefArray Args);
/// Create a DIE with the given Tag, add the DIE to its parent, and
/// call insertDIE if MD is not null.

View File

@ -93,7 +93,7 @@ void DIBuilder::finalize() {
if (MDTuple *Temp = SP->getVariables().get()) {
const auto &PV = PreservedVariables.lookup(SP);
SmallVector<Metadata *, 4> Variables(PV.begin(), PV.end());
DIArray AV = getOrCreateArray(Variables);
DebugNodeArray AV = getOrCreateArray(Variables);
TempMDTuple(Temp)->replaceAllUsesWith(AV.get());
}
}
@ -364,7 +364,7 @@ DIBuilder::createTemplateTemplateParameter(MDScope *Context, StringRef Name,
MDTemplateValueParameter *
DIBuilder::createTemplateParameterPack(MDScope *Context, StringRef Name,
MDType *Ty, DIArray Val) {
MDType *Ty, DebugNodeArray Val) {
return createTemplateValueParameterHelper(
VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
Val.get());
@ -373,8 +373,8 @@ DIBuilder::createTemplateParameterPack(MDScope *Context, StringRef Name,
MDCompositeType *DIBuilder::createClassType(
MDScope *Context, StringRef Name, MDFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
unsigned Flags, MDType *DerivedFrom, DIArray Elements, MDType *VTableHolder,
MDNode *TemplateParams, StringRef UniqueIdentifier) {
unsigned Flags, MDType *DerivedFrom, DebugNodeArray Elements,
MDType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) {
assert((!Context || isa<MDScope>(Context)) &&
"createClassType should be called with a valid Context");
@ -393,7 +393,7 @@ MDCompositeType *DIBuilder::createClassType(
MDCompositeType *DIBuilder::createStructType(
MDScope *Context, StringRef Name, MDFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
MDType *DerivedFrom, DIArray Elements, unsigned RunTimeLang,
MDType *DerivedFrom, DebugNodeArray Elements, unsigned RunTimeLang,
MDType *VTableHolder, StringRef UniqueIdentifier) {
auto *R = MDCompositeType::get(
VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
@ -406,13 +406,10 @@ MDCompositeType *DIBuilder::createStructType(
return R;
}
MDCompositeType* DIBuilder::createUnionType(MDScope * Scope, StringRef Name,
MDFile* File, unsigned LineNumber,
uint64_t SizeInBits,
uint64_t AlignInBits, unsigned Flags,
DIArray Elements,
unsigned RunTimeLang,
StringRef UniqueIdentifier) {
MDCompositeType *DIBuilder::createUnionType(
MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
DebugNodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) {
auto *R = MDCompositeType::get(
VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
MDScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits,
@ -425,14 +422,14 @@ MDCompositeType* DIBuilder::createUnionType(MDScope * Scope, StringRef Name,
}
MDSubroutineType *DIBuilder::createSubroutineType(MDFile *File,
DITypeArray ParameterTypes,
MDTypeRefArray ParameterTypes,
unsigned Flags) {
return MDSubroutineType::get(VMContext, Flags, ParameterTypes);
}
MDCompositeType *DIBuilder::createEnumerationType(
MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits, DIArray Elements,
uint64_t SizeInBits, uint64_t AlignInBits, DebugNodeArray Elements,
MDType *UnderlyingType, StringRef UniqueIdentifier) {
auto *CTy = MDCompositeType::get(
VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
@ -447,7 +444,8 @@ MDCompositeType *DIBuilder::createEnumerationType(
}
MDCompositeType *DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
MDType *Ty, DIArray Subscripts) {
MDType *Ty,
DebugNodeArray Subscripts) {
auto *R = MDCompositeType::get(VMContext, dwarf::DW_TAG_array_type, "",
nullptr, 0, nullptr, MDTypeRef::get(Ty), Size,
AlignInBits, 0, 0, Subscripts, 0, nullptr);
@ -457,7 +455,7 @@ MDCompositeType *DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
MDCompositeType *DIBuilder::createVectorType(uint64_t Size,
uint64_t AlignInBits, MDType *Ty,
DIArray Subscripts) {
DebugNodeArray Subscripts) {
auto *R =
MDCompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0,
nullptr, MDTypeRef::get(Ty), Size, AlignInBits, 0,
@ -528,11 +526,11 @@ MDCompositeType* DIBuilder::createReplaceableCompositeType(
return RetTy;
}
DIArray DIBuilder::getOrCreateArray(ArrayRef<Metadata *> Elements) {
DebugNodeArray DIBuilder::getOrCreateArray(ArrayRef<Metadata *> Elements) {
return MDTuple::get(VMContext, Elements);
}
DITypeArray DIBuilder::getOrCreateTypeArray(ArrayRef<Metadata *> Elements) {
MDTypeRefArray DIBuilder::getOrCreateTypeArray(ArrayRef<Metadata *> Elements) {
SmallVector<llvm::Metadata *, 16> Elts;
for (unsigned i = 0, e = Elements.size(); i != e; ++i) {
if (Elements[i] && isa<MDNode>(Elements[i]))
@ -540,7 +538,7 @@ DITypeArray DIBuilder::getOrCreateTypeArray(ArrayRef<Metadata *> Elements) {
else
Elts.push_back(Elements[i]);
}
return DITypeArray(MDNode::get(VMContext, Elts));
return MDTypeRefArray(MDNode::get(VMContext, Elts));
}
MDSubrange *DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
@ -838,8 +836,8 @@ void DIBuilder::replaceVTableHolder(MDCompositeType* &T, MDCompositeType* VTable
trackIfUnresolved(N);
}
void DIBuilder::replaceArrays(MDCompositeType* &T, DIArray Elements,
DIArray TParams) {
void DIBuilder::replaceArrays(MDCompositeType *&T, DebugNodeArray Elements,
DebugNodeArray TParams) {
{
TypedTrackingMDRef<MDCompositeType> N(T);
if (Elements)

View File

@ -76,7 +76,7 @@ llvm::generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes) {
DITypeIdentifierMap Map;
for (unsigned CUi = 0, CUe = CU_Nodes->getNumOperands(); CUi != CUe; ++CUi) {
auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(CUi));
DIArray Retain = CU->getRetainedTypes();
DebugNodeArray Retain = CU->getRetainedTypes();
for (unsigned Ti = 0, Te = Retain.size(); Ti != Te; ++Ti) {
if (!isa<MDCompositeType>(Retain[Ti]))
continue;

View File

@ -229,7 +229,7 @@ protected:
// Function DI
auto *File = DBuilder.createFile("filename.c", "/file/dir/");
DITypeArray ParamTypes = DBuilder.getOrCreateTypeArray(None);
MDTypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(None);
MDSubroutineType *FuncType =
DBuilder.createSubroutineType(File, ParamTypes);
auto *CU =