[cfe-commits] r65615 - /cfe/trunk/lib/CodeGen/CodeGenTypes.cpp

Eli Friedman eli.friedman at gmail.com
Thu Feb 26 20:53:40 PST 2009


Author: efriedma
Date: Thu Feb 26 22:53:40 2009
New Revision: 65615

URL: http://llvm.org/viewvc/llvm-project?rev=65615&view=rev
Log:
Change the way clang generates union types a bit so it plays well 
with the LLVM C backend.


Modified:
    cfe/trunk/lib/CodeGen/CodeGenTypes.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=65615&r1=65614&r2=65615&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Thu Feb 26 22:53:40 2009
@@ -555,6 +555,11 @@
   // of the result doesn't matter because anyone allocating
   // structures should be aligning them appropriately anyway.
   // FIXME: We can be a bit more intuitive in a lot of cases.
-  STy = llvm::ArrayType::get(llvm::Type::Int8Ty, RL.getSize() / 8);
+  // FIXME: Make this a struct type to work around PR2399; the
+  // C backend doesn't like structs using array types.
+  std::vector<const llvm::Type*> LLVMFields;
+  LLVMFields.push_back(llvm::ArrayType::get(llvm::Type::Int8Ty,
+                                            RL.getSize() / 8));
+  STy = llvm::StructType::get(LLVMFields, true);
   assert(CGT.getTargetData().getTypePaddedSizeInBits(STy) == RL.getSize());
 }





More information about the cfe-commits mailing list