[llvm] r243159 - DI: Simplify DebugInfoFinder::processType(), NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Fri Jul 24 13:56:10 PDT 2015
Author: dexonsmith
Date: Fri Jul 24 15:56:10 2015
New Revision: 243159
URL: http://llvm.org/viewvc/llvm-project?rev=243159&view=rev
Log:
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`.
Modified:
llvm/trunk/lib/IR/DebugInfo.cpp
Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=243159&r1=243158&r2=243159&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Fri Jul 24 15:56:10 2015
@@ -149,20 +149,22 @@ void DebugInfoFinder::processType(DIType
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));
}
}
More information about the llvm-commits
mailing list