[llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Oct 15 19:09:02 PDT 2002
Changes in directory llvm/lib/CWriter:
Writer.cpp updated: 1.63 -> 1.64
---
Log message:
Fix bug: test/Regression/CBackend/2002-10-15-OpaqueTypeProblem.ll
---
Diffs of the changes:
Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.63 llvm/lib/CWriter/Writer.cpp:1.64
--- llvm/lib/CWriter/Writer.cpp:1.63 Fri Oct 11 16:40:44 2002
+++ llvm/lib/CWriter/Writer.cpp Tue Oct 15 19:08:22 2002
@@ -196,12 +196,12 @@
}
// Check to see if the type is named.
- if (!IgnoreName) {
+ if (!IgnoreName || isa<OpaqueType>(Ty)) {
map<const Type *, string>::iterator I = TypeNames.find(Ty);
if (I != TypeNames.end()) {
return Out << I->second << " " << NameSoFar;
}
- }
+ }
switch (Ty->getPrimitiveID()) {
case Type::FunctionTyID: {
@@ -256,6 +256,14 @@
unsigned NumElements = ATy->getNumElements();
return printType(ATy->getElementType(),
NameSoFar + "[" + utostr(NumElements) + "]");
+ }
+
+ case Type::OpaqueTyID: {
+ static int Count = 0;
+ string TyName = "struct opaque_" + itostr(Count++);
+ assert(TypeNames.find(Ty) == TypeNames.end());
+ TypeNames[Ty] = TyName;
+ return Out << TyName << " " << NameSoFar;
}
default:
assert(0 && "Unhandled case in getTypeProps!");
More information about the llvm-commits
mailing list