[llvm-commits] [llvm-gcc-4.2] r40058 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Duncan Sands baldrick at free.fr
Thu Jul 19 07:45:20 PDT 2007


Author: baldrick
Date: Thu Jul 19 09:45:20 2007
New Revision: 40058

URL: http://llvm.org/viewvc/llvm-project?rev=40058&view=rev
Log:
A better fix for transparent unions: treat them like
ordinary unions for type conversion purposes.  The
ABI HandleArgument code already knows how to deal
with them, turning them into the first union field
for argument passing purposes.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=40058&r1=40057&r2=40058&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Thu Jul 19 09:45:20 2007
@@ -1763,29 +1763,7 @@
     TheModule->addTypeName(GetTypeName("union.", orig_type), Ty);
     return TypeDB.setType(type, Ty);
   }
-  
-  // If this is a union with the transparent_union attribute set, it is
-  // treated as if it were just the same as its first type.
-  if (TYPE_TRANSPARENT_UNION(type)) {
-    tree Field = TYPE_FIELDS(type);
-    assert(Field && "Transparent union must have some elements!");
-    tree FirstFieldDecl = NULL_TREE;
-    while (Field) {
-      if (TREE_CODE(Field) == FIELD_DECL) {
-        if (FirstFieldDecl == NULL_TREE)
-          FirstFieldDecl = Field;
-        // Set the field idx to zero for all fields.
-        SetFieldIndex(Field, 0);
-      }
-
-      Field = TREE_CHAIN(Field);
-    }
-    assert(FirstFieldDecl != NULL_TREE
-           && "Transparent union must have some elements!");
 
-    return TypeDB.setType(type, ConvertType(TREE_TYPE(FirstFieldDecl)));
-  }
-  
   // Note that we are compiling a struct now.
   bool OldConvertingStruct = ConvertingStruct;
   ConvertingStruct = true;





More information about the llvm-commits mailing list