simplify condition

llvm-svn: 65711
This commit is contained in:
Chris Lattner 2009-02-28 20:28:50 +00:00
parent 0f57895708
commit 1273471795
1 changed files with 10 additions and 7 deletions

View File

@ -168,14 +168,17 @@ TypePrinting::TypePrinting(const Module *M, raw_ostream &os) : OS(os) {
const TypeSymbolTable &ST = M->getTypeSymbolTable();
for (TypeSymbolTable::const_iterator TI = ST.begin(), E = ST.end();
TI != E; ++TI) {
const Type *Ty = cast<Type>(TI->second);
// As a heuristic, don't insert pointer to primitive types, because
// they are used too often to have a single useful name.
//
const Type *Ty = cast<Type>(TI->second);
if (!isa<PointerType>(Ty) ||
!cast<PointerType>(Ty)->getElementType()->isPrimitiveType() ||
!cast<PointerType>(Ty)->getElementType()->isInteger() ||
isa<OpaqueType>(cast<PointerType>(Ty)->getElementType()))
if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
const Type *PETy = PTy->getElementType();
if ((PETy->isPrimitiveType() || PETy->isInteger()) &&
!isa<OpaqueType>(PETy))
continue;
}
TypeNames.insert(std::make_pair(Ty, '%' + getLLVMName(TI->first)));
}
}