[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Oct 29 18:23:00 PST 2003
Changes in directory llvm/lib/VMCore:
AsmWriter.cpp updated: 1.104 -> 1.105
---
Log message:
Print the names of more opaque types
---
Diffs of the changes: (+7 -5)
Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.104 llvm/lib/VMCore/AsmWriter.cpp:1.105
--- llvm/lib/VMCore/AsmWriter.cpp:1.104 Wed Oct 29 18:12:51 2003
+++ llvm/lib/VMCore/AsmWriter.cpp Wed Oct 29 18:22:33 2003
@@ -111,7 +111,8 @@
//
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 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
@@ -209,9 +214,6 @@
// Check to see if the type is named.
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
More information about the llvm-commits
mailing list