diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-07-24 20:56:10 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-07-24 20:56:10 +0000 |
commit | 260fa8a75b1cb04f0652d5446a6521c7681bd1e3 (patch) | |
tree | 0db891cca96a52ffd320144f245fdf8516dda7e6 /llvm/lib/IR | |
parent | 3c5a56b13c174d5b894b342808f804eb0c2c2389 (diff) | |
download | bcm5719-llvm-260fa8a75b1cb04f0652d5446a6521c7681bd1e3.tar.gz bcm5719-llvm-260fa8a75b1cb04f0652d5446a6521c7681bd1e3.zip |
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`.
llvm-svn: 243159
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index cccbaf687f8..55e46b36a14 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/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<DICompositeTypeBase>(DT)) { + if (auto *ST = dyn_cast<DISubroutineType>(DT)) { + for (DITypeRef Ref : ST->getTypeArray()) + processType(Ref.resolve(TypeIdentifierMap)); + return; + } + if (auto *DCT = dyn_cast<DICompositeType>(DT)) { processType(DCT->getBaseType().resolve(TypeIdentifierMap)); - if (auto *ST = dyn_cast<DISubroutineType>(DCT)) { - for (DITypeRef Ref : ST->getTypeArray()) - processType(Ref.resolve(TypeIdentifierMap)); - return; - } for (Metadata *D : DCT->getElements()) { if (auto *T = dyn_cast<DIType>(D)) processType(T); else if (auto *SP = dyn_cast<DISubprogram>(D)) processSubprogram(SP); } - } else if (auto *DDT = dyn_cast<DIDerivedType>(DT)) { + return; + } + if (auto *DDT = dyn_cast<DIDerivedType>(DT)) { processType(DDT->getBaseType().resolve(TypeIdentifierMap)); } } |