DebugInfo: Remove DITypedArray<>, replace with typedefs

Replace all uses of `DITypedArray<>` with `MDTupleTypedArrayWrapper<>`
and `MDTypeRefArray`.  The APIs are completely different, but the
provided functionality is the same: treat an `MDTuple` as if it's an
array of a particular element type.

To simplify this patch a bit, I've temporarily typedef'ed
`DebugNodeArray` to `DIArray` and `MDTypeRefArray` to `DITypeArray`.
I've also temporarily conditionalized the accessors to check for null --
eventually these should be changed to asserts and the callers should
check for null themselves.

There's a tiny accompanying patch to clang.

llvm-svn: 234290
This commit is contained in:
Duncan P. N. Exon Smith
2015-04-07 04:14:33 +00:00
parent 8d33fdc3bf
commit 000fa2c646
13 changed files with 100 additions and 145 deletions

View File

@@ -91,8 +91,8 @@ void DIBuilder::finalize() {
DIArray SPs = getOrCreateArray(AllSubprograms);
TempSubprograms->replaceAllUsesWith(SPs);
for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) {
DISubprogram SP = cast<MDSubprogram>(SPs.getElement(i));
for (unsigned i = 0, e = SPs.size(); i != e; ++i) {
DISubprogram SP = cast<MDSubprogram>(SPs[i]);
if (MDNode *Temp = SP.getVariablesNodes()) {
const auto &PV = PreservedVariables.lookup(SP);
SmallVector<Metadata *, 4> Variables(PV.begin(), PV.end());
@@ -858,9 +858,9 @@ void DIBuilder::replaceArrays(DICompositeType &T, DIArray Elements,
{
TypedTrackingMDRef<MDCompositeTypeBase> N(T);
if (Elements)
N->replaceElements(cast<MDTuple>(Elements.get()));
N->replaceElements(Elements);
if (TParams)
N->replaceTemplateParams(cast<MDTuple>(TParams.get()));
N->replaceTemplateParams(MDTemplateParameterArray(TParams));
T = N.get();
}