aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/CBackend/CBackend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/CBackend/CBackend.cpp')
-rw-r--r--lib/Target/CBackend/CBackend.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 4765f409e2..feaf135269 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -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();