summaryrefslogtreecommitdiff
path: root/lib/Target/CBackend
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-16 18:02:45 +0000
committerChris Lattner <sabre@nondot.org>2007-01-16 18:02:45 +0000
commita80cc93f103a3033f90a47d5e316c32d5e5a8826 (patch)
tree62ce9611a5e55672046ce11e55b63ec4678ae793 /lib/Target/CBackend
parent26aa785942fa43eac68ec9a7592ab49df5d1dc57 (diff)
downloadllvm-a80cc93f103a3033f90a47d5e316c32d5e5a8826.tar.gz
llvm-a80cc93f103a3033f90a47d5e316c32d5e5a8826.tar.bz2
llvm-a80cc93f103a3033f90a47d5e316c32d5e5a8826.tar.xz
Fix SMG2000 with the CBE: opaque types need names too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33258 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CBackend')
-rw-r--r--lib/Target/CBackend/CBackend.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 304145887b..737a346ca4 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -272,7 +272,7 @@ bool CBackendNameAllUsedStructsAndMergeFunctions::runOnModule(Module &M) {
// If this isn't a struct type, remove it from our set of types to name.
// This simplifies emission later.
- if (!isa<StructType>(I->second)) {
+ if (!isa<StructType>(I->second) && !isa<OpaqueType>(I->second)) {
TST.remove(I);
} else {
// If this is not used, remove it from the symbol table.
@@ -1691,23 +1691,21 @@ void CWriter::printModuleTypes(const TypeSymbolTable &TST) {
// Print out forward declarations for structure types before anything else!
Out << "/* Structure forward decls */\n";
- for (; I != End; ++I)
- if (const Type *STy = dyn_cast<StructType>(I->second)) {
- std::string Name = "struct l_" + Mang->makeNameProper(I->first);
- Out << Name << ";\n";
- TypeNames.insert(std::make_pair(STy, Name));
- }
+ for (; I != End; ++I) {
+ std::string Name = "struct l_" + Mang->makeNameProper(I->first);
+ Out << Name << ";\n";
+ TypeNames.insert(std::make_pair(I->second, Name));
+ }
Out << '\n';
// Now we can print out typedefs. Above, we guaranteed that this can only be
- // for struct types.
+ // for struct or opaque types.
Out << "/* Typedefs */\n";
for (I = TST.begin(); I != End; ++I) {
- const StructType *Ty = cast<StructType>(I->second);
std::string Name = "l_" + Mang->makeNameProper(I->first);
Out << "typedef ";
- printType(Out, Ty, false, Name);
+ printType(Out, I->second, false, Name);
Out << ";\n";
}