Fix bug: test/Regression/CBackend/2002-10-15-OpaqueTypeProblem.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4190 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-10-16 00:08:22 +00:00
parent 8371299258
commit 04b72c821e
2 changed files with 20 additions and 4 deletions

View File

@ -196,12 +196,12 @@ ostream &CWriter::printType(const Type *Ty, const string &NameSoFar,
}
// 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: {
@ -257,6 +257,14 @@ ostream &CWriter::printType(const Type *Ty, const string &NameSoFar,
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!");
abort();

View File

@ -196,12 +196,12 @@ ostream &CWriter::printType(const Type *Ty, const string &NameSoFar,
}
// 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: {
@ -257,6 +257,14 @@ ostream &CWriter::printType(const Type *Ty, const string &NameSoFar,
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!");
abort();