From: Duncan P. N. Exon Smith Date: Fri, 24 Jul 2015 20:56:10 +0000 (+0000) Subject: DI: Simplify DebugInfoFinder::processType(), NFC X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=24b6acf9719e4cae19a2b9cdb3fd32e074b19c7a;p=oota-llvm.git DI: Simplify DebugInfoFinder::processType(), NFC Handle `DISubroutineType` up-front rather than as part of a branch for `DICompositeTypeBase`. The only shared code path was looking through the base type, but `DISubroutineType` can never have a base type. This also removes the last use of `DICompositeTypeBase`, since we can strengthen the cast to `DICompositeType`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243159 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index cccbaf687f8..55e46b36a14 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -149,20 +149,22 @@ void DebugInfoFinder::processType(DIType *DT) { if (!addType(DT)) return; processScope(DT->getScope().resolve(TypeIdentifierMap)); - if (auto *DCT = dyn_cast(DT)) { + if (auto *ST = dyn_cast(DT)) { + for (DITypeRef Ref : ST->getTypeArray()) + processType(Ref.resolve(TypeIdentifierMap)); + return; + } + if (auto *DCT = dyn_cast(DT)) { processType(DCT->getBaseType().resolve(TypeIdentifierMap)); - if (auto *ST = dyn_cast(DCT)) { - for (DITypeRef Ref : ST->getTypeArray()) - processType(Ref.resolve(TypeIdentifierMap)); - return; - } for (Metadata *D : DCT->getElements()) { if (auto *T = dyn_cast(D)) processType(T); else if (auto *SP = dyn_cast(D)) processSubprogram(SP); } - } else if (auto *DDT = dyn_cast(DT)) { + return; + } + if (auto *DDT = dyn_cast(DT)) { processType(DDT->getBaseType().resolve(TypeIdentifierMap)); } }