aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-30 00:22:33 +0000
committerChris Lattner <sabre@nondot.org>2003-10-30 00:22:33 +0000
commit88c17380646dbb7c0c5054a392de5a46d17620ba (patch)
tree3cf903128ea2f6e4daf86b6c1de72dcce19bcd65
parentdaf2a492a7eef1d4f68b1ed04b401ca6140c191f (diff)
Print the names of more opaque types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9598 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/AsmWriter.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 2cdca502dc..40e0129db2 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -111,7 +111,8 @@ static void fillTypeNameTable(const Module *M,
//
const Type *Ty = cast<Type>(I->second);
if (!isa<PointerType>(Ty) ||
- !cast<PointerType>(Ty)->getElementType()->isPrimitiveType())
+ !cast<PointerType>(Ty)->getElementType()->isPrimitiveType() ||
+ isa<OpaqueType>(cast<PointerType>(Ty)->getElementType()))
TypeNames.insert(std::make_pair(Ty, getLLVMName(I->first)));
}
}
@@ -122,12 +123,16 @@ static void fillTypeNameTable(const Module *M,
static std::string calcTypeName(const Type *Ty,
std::vector<const Type *> &TypeStack,
std::map<const Type *, std::string> &TypeNames){
- if (Ty->isPrimitiveType()) return Ty->getDescription(); // Base case
+ if (Ty->isPrimitiveType() && !isa<OpaqueType>(Ty))
+ return Ty->getDescription(); // Base case
// Check to see if the type is named.
std::map<const Type *, std::string>::iterator I = TypeNames.find(Ty);
if (I != TypeNames.end()) return I->second;
+ if (isa<OpaqueType>(Ty))
+ return "opaque";
+
// Check to see if the Type is already on the stack...
unsigned Slot = 0, CurSize = TypeStack.size();
while (Slot < CurSize && TypeStack[Slot] != Ty) ++Slot; // Scan for type
@@ -210,9 +215,6 @@ static std::ostream &printTypeInt(std::ostream &Out, const Type *Ty,
std::map<const Type *, std::string>::iterator I = TypeNames.find(Ty);
if (I != TypeNames.end()) return Out << I->second;
- if (isa<OpaqueType>(Ty))
- return Out << "opaque";
-
// Otherwise we have a type that has not been named but is a derived type.
// Carefully recurse the type hierarchy to print out any contained symbolic
// names.