diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-28 20:28:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-28 20:28:50 +0000 |
commit | be71cde46f7c46949099b523e6be72267713c7be (patch) | |
tree | b9ae07dd22cf90ae276ff8ec53c7188dd4a6fb87 | |
parent | 5414a43d72a5c17b71750f24f9c56c935d518fba (diff) | |
download | external_llvm-be71cde46f7c46949099b523e6be72267713c7be.zip external_llvm-be71cde46f7c46949099b523e6be72267713c7be.tar.gz external_llvm-be71cde46f7c46949099b523e6be72267713c7be.tar.bz2 |
simplify condition
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65711 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index c59bc0e..d07ff8f 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -168,15 +168,18 @@ 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())) - TypeNames.insert(std::make_pair(Ty, '%' + getLLVMName(TI->first))); + 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))); } } |