[cfe-commits] r78259 - in /cfe/trunk: include/clang/CodeGen/ModuleBuilder.h include/clang/Frontend/ASTConsumers.h lib/CodeGen/ABIInfo.h lib/CodeGen/CGBlocks.cpp lib/CodeGen/CGBlocks.h lib/CodeGen/CGDecl.cpp lib/CodeGen/CGExprConstant.cpp lib/CodeGen/CGObjCGNU.cpp lib/CodeGen/CGObjCMac.cpp lib/CodeGen/CGRecordLayoutBuilder.cpp lib/CodeGen/CGStmt.cpp lib/CodeGen/CodeGenFunction.h lib/CodeGen/CodeGenModule.cpp lib/CodeGen/CodeGenModule.h lib/CodeGen/CodeGenTypes.cpp lib/CodeGen/CodeGenTypes.h lib/CodeGen/TargetABIInfo.cpp

Owen Anderson resistor at mac.com
Wed Aug 5 16:18:50 PDT 2009


Author: resistor
Date: Wed Aug  5 18:18:46 2009
New Revision: 78259

URL: http://llvm.org/viewvc/llvm-project?rev=78259&view=rev
Log:
Update for LLVM API change.

Modified:
    cfe/trunk/include/clang/CodeGen/ModuleBuilder.h
    cfe/trunk/include/clang/Frontend/ASTConsumers.h
    cfe/trunk/lib/CodeGen/ABIInfo.h
    cfe/trunk/lib/CodeGen/CGBlocks.cpp
    cfe/trunk/lib/CodeGen/CGBlocks.h
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/lib/CodeGen/CGExprConstant.cpp
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp
    cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
    cfe/trunk/lib/CodeGen/CGStmt.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/lib/CodeGen/CodeGenModule.h
    cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
    cfe/trunk/lib/CodeGen/CodeGenTypes.h
    cfe/trunk/lib/CodeGen/TargetABIInfo.cpp

Modified: cfe/trunk/include/clang/CodeGen/ModuleBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/ModuleBuilder.h?rev=78259&r1=78258&r2=78259&view=diff

==============================================================================
--- cfe/trunk/include/clang/CodeGen/ModuleBuilder.h (original)
+++ cfe/trunk/include/clang/CodeGen/ModuleBuilder.h Wed Aug  5 18:18:46 2009
@@ -18,7 +18,7 @@
 #include <string>
 
 namespace llvm {
-  class LLVMContext;
+  struct LLVMContext;
   class Module;
 }
 

Modified: cfe/trunk/include/clang/Frontend/ASTConsumers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTConsumers.h?rev=78259&r1=78258&r2=78259&view=diff

==============================================================================
--- cfe/trunk/include/clang/Frontend/ASTConsumers.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTConsumers.h Wed Aug  5 18:18:46 2009
@@ -20,7 +20,7 @@
 
 namespace llvm {
   class Module;
-  class LLVMContext;
+  struct LLVMContext;
   namespace sys { class Path; }
 }
 namespace clang {

Modified: cfe/trunk/lib/CodeGen/ABIInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ABIInfo.h?rev=78259&r1=78258&r2=78259&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/ABIInfo.h (original)
+++ cfe/trunk/lib/CodeGen/ABIInfo.h Wed Aug  5 18:18:46 2009
@@ -17,7 +17,7 @@
 namespace llvm {
   class Type;
   class Value;
-  class LLVMContext;
+  struct LLVMContext;
 }
 
 namespace clang {

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Aug  5 18:18:46 2009
@@ -48,7 +48,7 @@
     Elts.push_back(BuildDestroyHelper(Ty, NoteForHelper));
   }
 
-  C = llvm::ConstantStruct::get(Elts);
+  C = llvm::ConstantStruct::get(VMContext, Elts);
 
   C = new llvm::GlobalVariable(CGM.getModule(), C->getType(), true,
                                llvm::GlobalValue::InternalLinkage,
@@ -161,7 +161,7 @@
       Elts[0] = CGM.getNSConcreteGlobalBlock();
       Elts[1] = llvm::ConstantInt::get(IntTy, flags|BLOCK_IS_GLOBAL);
 
-      C = llvm::ConstantStruct::get(Elts);
+      C = llvm::ConstantStruct::get(VMContext, Elts);
 
       char Name[32];
       sprintf(Name, "__block_holder_tmp_%d", CGM.getGlobalUniqueCount());
@@ -189,7 +189,7 @@
         Types[i+5] = ConvertType(Ty);
     }
 
-    llvm::StructType *Ty = llvm::StructType::get(Types, true);
+    llvm::StructType *Ty = llvm::StructType::get(VMContext, Types, true);
 
     llvm::AllocaInst *A = CreateTempAlloca(Ty);
     A->setAlignment(subBlockAlign);
@@ -310,7 +310,8 @@
   //   unsigned long reserved;
   //   unsigned long block_size;
   // };
-  BlockDescriptorType = llvm::StructType::get(UnsignedLongTy,
+  BlockDescriptorType = llvm::StructType::get(UnsignedLongTy->getContext(),
+                                              UnsignedLongTy,
                                               UnsignedLongTy,
                                               NULL);
 
@@ -337,7 +338,8 @@
   //   void (*__invoke)(void *);
   //   struct __block_descriptor *__descriptor;
   // };
-  GenericBlockLiteralType = llvm::StructType::get(PtrToInt8Ty,
+  GenericBlockLiteralType = llvm::StructType::get(IntTy->getContext(),
+                                                  PtrToInt8Ty,
                                                   IntTy,
                                                   IntTy,
                                                   PtrToInt8Ty,
@@ -369,7 +371,8 @@
   //   void *__copy_func_helper_decl;
   //   void *__destroy_func_decl;
   // };
-  GenericExtendedBlockLiteralType = llvm::StructType::get(PtrToInt8Ty,
+  GenericExtendedBlockLiteralType = llvm::StructType::get(IntTy->getContext(),
+                                                          PtrToInt8Ty,
                                                           IntTy,
                                                           IntTy,
                                                           PtrToInt8Ty,
@@ -511,7 +514,7 @@
                       llvm::ConstantInt::get(UnsignedLongTy,BlockLiteralSize);
 
   llvm::Constant *DescriptorStruct =
-    llvm::ConstantStruct::get(&DescriptorFields[0], 2);
+    llvm::ConstantStruct::get(VMContext, &DescriptorFields[0], 2);
 
   llvm::GlobalVariable *Descriptor =
     new llvm::GlobalVariable(getModule(), DescriptorStruct->getType(), true,
@@ -552,7 +555,7 @@
   LiteralFields[4] = Descriptor;
 
   llvm::Constant *BlockLiteralStruct =
-    llvm::ConstantStruct::get(&LiteralFields[0], 5);
+    llvm::ConstantStruct::get(VMContext, &LiteralFields[0], 5);
 
   llvm::GlobalVariable *BlockLiteral =
     new llvm::GlobalVariable(getModule(), BlockLiteralStruct->getType(), true,

Modified: cfe/trunk/lib/CodeGen/CGBlocks.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.h?rev=78259&r1=78258&r2=78259&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.h (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.h Wed Aug  5 18:18:46 2009
@@ -39,7 +39,7 @@
   class TargetData;
   class FunctionType;
   class Value;
-  class LLVMContext;
+  struct LLVMContext;
 }
 
 namespace clang {

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Wed Aug  5 18:18:46 2009
@@ -237,7 +237,7 @@
   assert((Align <= unsigned(Target.getPointerAlign(0))/8)
          && "Can't align more than pointer yet");
   Types[needsCopyDispose*2 + 4] = LTy;
-  return llvm::StructType::get(Types, false);
+  return llvm::StructType::get(VMContext, Types, false);
 }
 
 /// EmitLocalBlockVarDecl - Emit code and set up an entry in LocalDeclMap for a

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Wed Aug  5 18:18:46 2009
@@ -340,7 +340,8 @@
       return 0;
     
     llvm::Constant *Result = 
-      llvm::ConstantStruct::get(Builder.Elements, Builder.Packed);
+      llvm::ConstantStruct::get(CGF->getLLVMContext(),
+                                Builder.Elements, Builder.Packed);
 
     assert(llvm::RoundUpToAlignment(Builder.NextFieldOffsetInBytes,
                                     Builder.getAlignment(Result)) == 
@@ -406,7 +407,8 @@
         Types.push_back(Ty);
       }
       
-      llvm::StructType* STy = llvm::StructType::get(Types, false);
+      llvm::StructType* STy = llvm::StructType::get(C->getType()->getContext(),
+                                                    Types, false);
       return llvm::ConstantStruct::get(STy, Elts);
     }
     
@@ -463,7 +465,8 @@
       std::vector<const llvm::Type*> Types;
       for (unsigned i = 0; i < Elts.size(); ++i)
         Types.push_back(Elts[i]->getType());
-      const llvm::StructType *SType = llvm::StructType::get(Types, true);
+      const llvm::StructType *SType = llvm::StructType::get(AType->getContext(), 
+                                                            Types, true);
       return llvm::ConstantStruct::get(SType, Elts);
     }
 
@@ -731,7 +734,7 @@
       Complex[1] = llvm::ConstantInt::get(VMContext, 
                                           Result.Val.getComplexIntImag());
       
-      return llvm::ConstantStruct::get(Complex, 2);
+      return llvm::ConstantStruct::get(VMContext, Complex, 2);
     }
     case APValue::Float:
       return llvm::ConstantFP::get(VMContext, Result.Val.getFloat());
@@ -743,7 +746,7 @@
       Complex[1] = llvm::ConstantFP::get(VMContext,
                                          Result.Val.getComplexFloatImag());
       
-      return llvm::ConstantStruct::get(Complex, 2);
+      return llvm::ConstantStruct::get(VMContext, Complex, 2);
     }
     case APValue::Vector: {
       llvm::SmallVector<llvm::Constant *, 4> Inits;

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Wed Aug  5 18:18:46 2009
@@ -324,7 +324,7 @@
   Ivars.push_back(MakeConstantString(Str));
   Ivars.push_back(llvm::ConstantInt::get(IntTy, Str.size()));
   llvm::Constant *ObjCStr = MakeGlobal(
-    llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, IntTy, NULL),
+    llvm::StructType::get(VMContext, PtrToInt8Ty, PtrToInt8Ty, IntTy, NULL),
     Ivars, ".objc_str");
   ConstantStrings.push_back(
       llvm::ConstantExpr::getBitCast(ObjCStr, PtrToInt8Ty));
@@ -397,14 +397,14 @@
   // Cast the pointer to a simplified version of the class structure
   ReceiverClass = CGF.Builder.CreateBitCast(ReceiverClass, 
       llvm::PointerType::getUnqual(
-        llvm::StructType::get(IdTy, IdTy, NULL)));
+        llvm::StructType::get(VMContext, IdTy, IdTy, NULL)));
   // Get the superclass pointer
   ReceiverClass = CGF.Builder.CreateStructGEP(ReceiverClass, 1);
   // Load the superclass pointer
   ReceiverClass = CGF.Builder.CreateLoad(ReceiverClass);
   // Construct the structure used to look up the IMP
-  llvm::StructType *ObjCSuperTy = llvm::StructType::get(Receiver->getType(),
-      IdTy, NULL);
+  llvm::StructType *ObjCSuperTy = llvm::StructType::get(VMContext,
+      Receiver->getType(), IdTy, NULL);
   llvm::Value *ObjCSuper = CGF.Builder.CreateAlloca(ObjCSuperTy);
 
   CGF.Builder.CreateStore(Receiver, CGF.Builder.CreateStructGEP(ObjCSuper, 0));
@@ -496,7 +496,7 @@
     const llvm::SmallVectorImpl<llvm::Constant *> &MethodTypes, 
     bool isClassMethodList) {
   // Get the method structure type.  
-  llvm::StructType *ObjCMethodTy = llvm::StructType::get(
+  llvm::StructType *ObjCMethodTy = llvm::StructType::get(VMContext,
     PtrToInt8Ty, // Really a selector, but the runtime creates it us.
     PtrToInt8Ty, // Method types
     llvm::PointerType::getUnqual(IMPTy), //Method pointer
@@ -531,7 +531,8 @@
   llvm::SmallVector<const llvm::Type*, 16> ObjCMethodListFields;
   llvm::PATypeHolder OpaqueNextTy = llvm::OpaqueType::get();
   llvm::Type *NextPtrTy = llvm::PointerType::getUnqual(OpaqueNextTy);
-  llvm::StructType *ObjCMethodListTy = llvm::StructType::get(NextPtrTy, 
+  llvm::StructType *ObjCMethodListTy = llvm::StructType::get(VMContext,
+      NextPtrTy, 
       IntTy, 
       ObjCMethodArrayTy,
       NULL);
@@ -557,7 +558,7 @@
     const llvm::SmallVectorImpl<llvm::Constant *>  &IvarTypes,
     const llvm::SmallVectorImpl<llvm::Constant *>  &IvarOffsets) {
   // Get the method structure type.  
-  llvm::StructType *ObjCIvarTy = llvm::StructType::get(
+  llvm::StructType *ObjCIvarTy = llvm::StructType::get(VMContext,
     PtrToInt8Ty,
     PtrToInt8Ty,
     IntTy,
@@ -583,7 +584,7 @@
   Elements.push_back(llvm::ConstantInt::get(IntTy, (int)IvarNames.size()));
   Elements.push_back(llvm::ConstantArray::get(ObjCIvarArrayTy, Ivars));
   // Structure containing array and array count
-  llvm::StructType *ObjCIvarListTy = llvm::StructType::get(IntTy,
+  llvm::StructType *ObjCIvarListTy = llvm::StructType::get(VMContext, IntTy,
     ObjCIvarArrayTy,
     NULL);
 
@@ -605,7 +606,7 @@
   // Set up the class structure
   // Note:  Several of these are char*s when they should be ids.  This is
   // because the runtime performs this translation on load.
-  llvm::StructType *ClassTy = llvm::StructType::get(
+  llvm::StructType *ClassTy = llvm::StructType::get(VMContext,
       PtrToInt8Ty,        // class_pointer
       PtrToInt8Ty,        // super_class
       PtrToInt8Ty,        // name
@@ -647,7 +648,7 @@
     const llvm::SmallVectorImpl<llvm::Constant *>  &MethodNames,
     const llvm::SmallVectorImpl<llvm::Constant *>  &MethodTypes) {
   // Get the method structure type.  
-  llvm::StructType *ObjCMethodDescTy = llvm::StructType::get(
+  llvm::StructType *ObjCMethodDescTy = llvm::StructType::get(VMContext,
     PtrToInt8Ty, // Really a selector, but the runtime does the casting for us.
     PtrToInt8Ty,
     NULL);
@@ -665,7 +666,7 @@
       MethodNames.size());
   llvm::Constant *Array = llvm::ConstantArray::get(ObjCMethodArrayTy,
                                                    Methods);
-  llvm::StructType *ObjCMethodDescListTy = llvm::StructType::get(
+  llvm::StructType *ObjCMethodDescListTy = llvm::StructType::get(VMContext,
       IntTy, ObjCMethodArrayTy, NULL);
   Methods.clear();
   Methods.push_back(llvm::ConstantInt::get(IntTy, MethodNames.size()));
@@ -678,7 +679,7 @@
     const llvm::SmallVectorImpl<std::string> &Protocols) {
   llvm::ArrayType *ProtocolArrayTy = llvm::ArrayType::get(PtrToInt8Ty,
       Protocols.size());
-  llvm::StructType *ProtocolListTy = llvm::StructType::get(
+  llvm::StructType *ProtocolListTy = llvm::StructType::get(VMContext,
       PtrTy, //Should be a recurisve pointer, but it's always NULL here.
       LongTy,//FIXME: Should be size_t
       ProtocolArrayTy,
@@ -722,7 +723,7 @@
     GenerateProtocolMethodList(EmptyConstantVector, EmptyConstantVector);
   // Protocols are objects containing lists of the methods implemented and
   // protocols adopted.
-  llvm::StructType *ProtocolTy = llvm::StructType::get(IdTy,
+  llvm::StructType *ProtocolTy = llvm::StructType::get(VMContext, IdTy,
       PtrToInt8Ty,
       ProtocolList->getType(),
       InstanceMethodList->getType(),
@@ -777,7 +778,7 @@
     GenerateProtocolMethodList(ClassMethodNames, ClassMethodTypes);
   // Protocols are objects containing lists of the methods implemented and
   // protocols adopted.
-  llvm::StructType *ProtocolTy = llvm::StructType::get(IdTy,
+  llvm::StructType *ProtocolTy = llvm::StructType::get(VMContext, IdTy,
       PtrToInt8Ty,
       ProtocolList->getType(),
       InstanceMethodList->getType(),
@@ -847,8 +848,8 @@
   Elements.push_back(llvm::ConstantExpr::getBitCast(
         GenerateProtocolList(Protocols), PtrTy));
   Categories.push_back(llvm::ConstantExpr::getBitCast(
-        MakeGlobal(llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, PtrTy,
-            PtrTy, PtrTy, NULL), Elements), PtrTy));
+        MakeGlobal(llvm::StructType::get(VMContext, PtrToInt8Ty, PtrToInt8Ty, 
+            PtrTy, PtrTy, PtrTy, NULL), Elements), PtrTy));
 }
 
 void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
@@ -1023,7 +1024,8 @@
   const llvm::Type *SelStructPtrTy = SelectorTy;
   bool isSelOpaque = false;
   if (SelStructTy == 0) {
-    SelStructTy = llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, NULL);
+    SelStructTy = llvm::StructType::get(VMContext, PtrToInt8Ty,
+                                        PtrToInt8Ty, NULL);
     SelStructPtrTy = llvm::PointerType::getUnqual(SelStructTy);
     isSelOpaque = true;
   }
@@ -1045,7 +1047,7 @@
     Elements.push_back(llvm::ConstantArray::get(StaticsArrayTy,
        ConstantStrings));
     llvm::StructType *StaticsListTy = 
-      llvm::StructType::get(PtrToInt8Ty, StaticsArrayTy, NULL);
+      llvm::StructType::get(VMContext, PtrToInt8Ty, StaticsArrayTy, NULL);
     llvm::Type *StaticsListPtrTy =
       llvm::PointerType::getUnqual(StaticsListTy);
     Statics = MakeGlobal(StaticsListTy, Elements, ".objc_statics");
@@ -1060,7 +1062,8 @@
   // Array of classes, categories, and constant objects
   llvm::ArrayType *ClassListTy = llvm::ArrayType::get(PtrToInt8Ty,
       Classes.size() + Categories.size()  + 2);
-  llvm::StructType *SymTabTy = llvm::StructType::get(LongTy, SelStructPtrTy,
+  llvm::StructType *SymTabTy = llvm::StructType::get(VMContext, 
+                                                     LongTy, SelStructPtrTy,
                                                      llvm::Type::Int16Ty,
                                                      llvm::Type::Int16Ty,
                                                      ClassListTy, NULL);
@@ -1153,7 +1156,7 @@
 
   // The symbol table is contained in a module which has some version-checking
   // constants
-  llvm::StructType * ModuleTy = llvm::StructType::get(LongTy, LongTy,
+  llvm::StructType * ModuleTy = llvm::StructType::get(VMContext, LongTy, LongTy,
       PtrToInt8Ty, llvm::PointerType::getUnqual(SymTabTy), NULL);
   Elements.clear();
   // Runtime version used for compatibility checking.

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Wed Aug  5 18:18:46 2009
@@ -1770,7 +1770,7 @@
                                                   ProtocolRefs.size()),
                              ProtocolRefs);
 
-  llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+  llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
   llvm::GlobalVariable *GV =
     CreateMetadataVar(Name, Init, "__OBJC,__cat_cls_meth,regular,no_dead_strip",
                       4, false);
@@ -1815,7 +1815,7 @@
   llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.PropertyTy,
                                              Properties.size());
   Values[2] = llvm::ConstantArray::get(AT, Properties);
-  llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+  llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
 
   llvm::GlobalVariable *GV =
     CreateMetadataVar(Name, Init,
@@ -1855,7 +1855,7 @@
   llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodDescriptionTy,
                                              Methods.size());
   Values[1] = llvm::ConstantArray::get(AT, Methods);
-  llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+  llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
 
   llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true);
   return llvm::ConstantExpr::getBitCast(GV,
@@ -2228,7 +2228,7 @@
   llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.IvarTy,
                                              Ivars.size());
   Values[1] = llvm::ConstantArray::get(AT, Ivars);
-  llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+  llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
 
   llvm::GlobalVariable *GV;
   if (ForClass)
@@ -2288,7 +2288,7 @@
   llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodTy,
                                              Methods.size());
   Values[2] = llvm::ConstantArray::get(AT, Methods);
-  llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+  llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
 
   llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true);
   return llvm::ConstantExpr::getBitCast(GV,
@@ -2924,7 +2924,7 @@
                                                   NumClasses + NumCategories),
                              Symbols);
 
-  llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+  llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
 
   llvm::GlobalVariable *GV =
     CreateMetadataVar("\01L_OBJC_SYMBOLS", Init,
@@ -3567,7 +3567,7 @@
   //   char *name;
   //   char *attributes;
   // }
-  PropertyTy = llvm::StructType::get(Int8PtrTy, Int8PtrTy, NULL);
+  PropertyTy = llvm::StructType::get(VMContext, Int8PtrTy, Int8PtrTy, NULL);
   CGM.getModule().addTypeName("struct._prop_t",
                               PropertyTy);
 
@@ -3576,7 +3576,7 @@
   //   uint32_t count_of_properties;
   //   struct _prop_t prop_list[count_of_properties];
   // }
-  PropertyListTy = llvm::StructType::get(IntTy,
+  PropertyListTy = llvm::StructType::get(VMContext, IntTy,
                                          IntTy,
                                          llvm::ArrayType::get(PropertyTy, 0),
                                          NULL);
@@ -3590,7 +3590,7 @@
   //   char *method_type;
   //   char *_imp;
   // }
-  MethodTy = llvm::StructType::get(SelectorPtrTy,
+  MethodTy = llvm::StructType::get(VMContext, SelectorPtrTy,
                                    Int8PtrTy,
                                    Int8PtrTy,
                                    NULL);
@@ -3610,7 +3610,7 @@
   //   char *types;
   // }
   MethodDescriptionTy =
-    llvm::StructType::get(SelectorPtrTy,
+    llvm::StructType::get(VMContext, SelectorPtrTy,
                           Int8PtrTy,
                           NULL);
   CGM.getModule().addTypeName("struct._objc_method_description",
@@ -3621,7 +3621,7 @@
   //   struct _objc_method_description[1];
   // }
   MethodDescriptionListTy =
-    llvm::StructType::get(IntTy,
+    llvm::StructType::get(VMContext, IntTy,
                           llvm::ArrayType::get(MethodDescriptionTy, 0),
                           NULL);
   CGM.getModule().addTypeName("struct._objc_method_description_list",
@@ -3640,7 +3640,7 @@
   //   struct _objc_property_list *instance_properties;
   // }
   ProtocolExtensionTy =
-    llvm::StructType::get(IntTy,
+    llvm::StructType::get(VMContext, IntTy,
                           MethodDescriptionListPtrTy,
                           MethodDescriptionListPtrTy,
                           PropertyListPtrTy,
@@ -3657,7 +3657,8 @@
   llvm::PATypeHolder ProtocolListTyHolder = llvm::OpaqueType::get();
 
   const llvm::Type *T =
-    llvm::StructType::get(llvm::PointerType::getUnqual(ProtocolListTyHolder),
+    llvm::StructType::get(VMContext, 
+                          llvm::PointerType::getUnqual(ProtocolListTyHolder),
                           LongTy,
                           llvm::ArrayType::get(ProtocolTyHolder, 0),
                           NULL);
@@ -3670,7 +3671,7 @@
   //   struct _objc_method_description_list *instance_methods;
   //   struct _objc_method_description_list *class_methods;
   // }
-  T = llvm::StructType::get(ProtocolExtensionPtrTy,
+  T = llvm::StructType::get(VMContext, ProtocolExtensionPtrTy,
                             Int8PtrTy,
                             llvm::PointerType::getUnqual(ProtocolListTyHolder),
                             MethodDescriptionListPtrTy,
@@ -3695,7 +3696,7 @@
   //   char *ivar_type;
   //   int  ivar_offset;
   // }
-  IvarTy = llvm::StructType::get(Int8PtrTy,
+  IvarTy = llvm::StructType::get(VMContext, Int8PtrTy,
                                  Int8PtrTy,
                                  IntTy,
                                  NULL);
@@ -3713,7 +3714,7 @@
 
   // struct _objc_class_extension *
   ClassExtensionTy =
-    llvm::StructType::get(IntTy,
+    llvm::StructType::get(VMContext, IntTy,
                           Int8PtrTy,
                           PropertyListPtrTy,
                           NULL);
@@ -3736,7 +3737,8 @@
   //   char *ivar_layout;
   //   struct _objc_class_ext *ext;
   // };
-  T = llvm::StructType::get(llvm::PointerType::getUnqual(ClassTyHolder),
+  T = llvm::StructType::get(VMContext,
+                            llvm::PointerType::getUnqual(ClassTyHolder),
                             llvm::PointerType::getUnqual(ClassTyHolder),
                             Int8PtrTy,
                             LongTy,
@@ -3763,7 +3765,7 @@
   //   uint32_t size;  // sizeof(struct _objc_category)
   //   struct _objc_property_list *instance_properties;// category's @property
   // }
-  CategoryTy = llvm::StructType::get(Int8PtrTy,
+  CategoryTy = llvm::StructType::get(VMContext, Int8PtrTy,
                                      Int8PtrTy,
                                      MethodListPtrTy,
                                      MethodListPtrTy,
@@ -3782,7 +3784,7 @@
   //   short cat_def_cnt;
   //   char *defs[cls_def_cnt + cat_def_cnt];
   // }
-  SymtabTy = llvm::StructType::get(LongTy,
+  SymtabTy = llvm::StructType::get(VMContext, LongTy,
                                    SelectorPtrTy,
                                    ShortTy,
                                    ShortTy,
@@ -3798,7 +3800,7 @@
   //   struct _objc_symtab* symtab;
   //  }
   ModuleTy =
-    llvm::StructType::get(LongTy,
+    llvm::StructType::get(VMContext, LongTy,
                           LongTy,
                           Int8PtrTy,
                           SymtabPtrTy,
@@ -3815,8 +3817,8 @@
     llvm::PointerType::getUnqual(llvm::Type::Int8Ty), 4);
 
   ExceptionDataTy =
-    llvm::StructType::get(llvm::ArrayType::get(llvm::Type::Int32Ty,
-                                               SetJmpBufferSize),
+    llvm::StructType::get(VMContext, llvm::ArrayType::get(llvm::Type::Int32Ty,
+                                                          SetJmpBufferSize),
                           StackPtrTy, NULL);
   CGM.getModule().addTypeName("struct._objc_exception_data",
                               ExceptionDataTy);
@@ -3831,7 +3833,7 @@
   //   uint32_t method_count;
   //   struct _objc_method method_list[method_count];
   // }
-  MethodListnfABITy = llvm::StructType::get(IntTy,
+  MethodListnfABITy = llvm::StructType::get(VMContext, IntTy,
                                             IntTy,
                                             llvm::ArrayType::get(MethodTy, 0),
                                             NULL);
@@ -3856,7 +3858,7 @@
   // Holder for struct _protocol_list_t *
   llvm::PATypeHolder ProtocolListTyHolder = llvm::OpaqueType::get();
 
-  ProtocolnfABITy = llvm::StructType::get(ObjectPtrTy,
+  ProtocolnfABITy = llvm::StructType::get(VMContext, ObjectPtrTy,
                                           Int8PtrTy,
                                           llvm::PointerType::getUnqual(
                                             ProtocolListTyHolder),
@@ -3878,7 +3880,7 @@
   //   long protocol_count;   // Note, this is 32/64 bit
   //   struct _protocol_t *[protocol_count];
   // }
-  ProtocolListnfABITy = llvm::StructType::get(LongTy,
+  ProtocolListnfABITy = llvm::StructType::get(VMContext, LongTy,
                                               llvm::ArrayType::get(
                                                 ProtocolnfABIPtrTy, 0),
                                               NULL);
@@ -3897,7 +3899,8 @@
   //   uint32_t alignment;
   //   uint32_t size;
   // }
-  IvarnfABITy = llvm::StructType::get(llvm::PointerType::getUnqual(LongTy),
+  IvarnfABITy = llvm::StructType::get(VMContext, 
+                                      llvm::PointerType::getUnqual(LongTy),
                                       Int8PtrTy,
                                       Int8PtrTy,
                                       IntTy,
@@ -3910,7 +3913,7 @@
   //   uint32 count;
   //   struct _iver_t list[count];
   // }
-  IvarListnfABITy = llvm::StructType::get(IntTy,
+  IvarListnfABITy = llvm::StructType::get(VMContext, IntTy,
                                           IntTy,
                                           llvm::ArrayType::get(
                                             IvarnfABITy, 0),
@@ -3934,7 +3937,7 @@
   // }
 
   // FIXME. Add 'reserved' field in 64bit abi mode!
-  ClassRonfABITy = llvm::StructType::get(IntTy,
+  ClassRonfABITy = llvm::StructType::get(VMContext, IntTy,
                                          IntTy,
                                          IntTy,
                                          Int8PtrTy,
@@ -3965,7 +3968,8 @@
 
   llvm::PATypeHolder ClassTyHolder = llvm::OpaqueType::get();
   ClassnfABITy =
-    llvm::StructType::get(llvm::PointerType::getUnqual(ClassTyHolder),
+    llvm::StructType::get(VMContext,
+                          llvm::PointerType::getUnqual(ClassTyHolder),
                           llvm::PointerType::getUnqual(ClassTyHolder),
                           CachePtrTy,
                           llvm::PointerType::getUnqual(ImpnfABITy),
@@ -3987,7 +3991,7 @@
   //   const struct _protocol_list_t * const protocols;
   //   const struct _prop_list_t * const properties;
   // }
-  CategorynfABITy = llvm::StructType::get(Int8PtrTy,
+  CategorynfABITy = llvm::StructType::get(VMContext, Int8PtrTy,
                                           ClassnfABIPtrTy,
                                           MethodListnfABIPtrTy,
                                           MethodListnfABIPtrTy,
@@ -4028,7 +4032,7 @@
   //   SUPER_IMP messenger;
   //   SEL name;
   // };
-  SuperMessageRefTy = llvm::StructType::get(ImpnfABITy,
+  SuperMessageRefTy = llvm::StructType::get(VMContext, ImpnfABITy,
                                             SelectorPtrTy,
                                             NULL);
   CGM.getModule().addTypeName("struct._super_message_ref_t", SuperMessageRefTy);
@@ -4042,7 +4046,8 @@
   //   const char*  name;    // c++ typeinfo string
   //   Class        cls;
   // };
-  EHTypeTy = llvm::StructType::get(llvm::PointerType::getUnqual(Int8PtrTy),
+  EHTypeTy = llvm::StructType::get(VMContext,
+                                   llvm::PointerType::getUnqual(Int8PtrTy),
                                    Int8PtrTy,
                                    ClassnfABIPtrTy,
                                    NULL);
@@ -4598,7 +4603,7 @@
   llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodTy,
                                              Methods.size());
   Values[2] = llvm::ConstantArray::get(AT, Methods);
-  llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+  llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
 
   llvm::GlobalVariable *GV =
     new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
@@ -4724,7 +4729,7 @@
   llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.IvarnfABITy,
                                              Ivars.size());
   Values[2] = llvm::ConstantArray::get(AT, Ivars);
-  llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+  llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
   const char *Prefix = "\01l_OBJC_$_INSTANCE_VARIABLES_";
   llvm::GlobalVariable *GV =
     new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
@@ -4918,7 +4923,7 @@
                            ProtocolRefs.size()),
       ProtocolRefs);
 
-  llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+  llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
   GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
                                 llvm::GlobalValue::InternalLinkage,
                                 Init,
@@ -5052,7 +5057,7 @@
     std::vector<llvm::Constant*> Values(2);
     Values[0] = Fn;
     Values[1] = GetMethodVarName(Sel);
-    llvm::Constant *Init = llvm::ConstantStruct::get(Values);
+    llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values);
     GV =  new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
                                    llvm::GlobalValue::WeakAnyLinkage,
                                    Init,

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Wed Aug  5 18:18:46 2009
@@ -298,7 +298,8 @@
   
   Builder.Layout(D);
 
-  const llvm::Type *Ty = llvm::StructType::get(Builder.FieldTypes,
+  const llvm::Type *Ty = llvm::StructType::get(Types.getLLVMContext(),
+                                               Builder.FieldTypes,
                                                Builder.Packed);
   
   // Add all the field numbers.

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Wed Aug  5 18:18:46 2009
@@ -1002,7 +1002,7 @@
   else if (ResultRegTypes.size() == 1)
     ResultType = ResultRegTypes[0];
   else
-    ResultType = llvm::StructType::get(ResultRegTypes);
+    ResultType = llvm::StructType::get(VMContext, ResultRegTypes);
   
   const llvm::FunctionType *FTy = 
     llvm::FunctionType::get(ResultType, ArgTypes, false);

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=78259&r1=78258&r2=78259&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Aug  5 18:18:46 2009
@@ -31,7 +31,7 @@
 
 namespace llvm {
   class BasicBlock;
-  class LLVMContext;
+  struct LLVMContext;
   class Module;
   class SwitchInst;
   class Value;

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Aug  5 18:18:46 2009
@@ -203,7 +203,7 @@
 
   // Get the type of a ctor entry, { i32, void ()* }.
   llvm::StructType* CtorStructTy = 
-    llvm::StructType::get(llvm::Type::Int32Ty, 
+    llvm::StructType::get(VMContext, llvm::Type::Int32Ty, 
                           llvm::PointerType::getUnqual(CtorFTy), NULL);
 
   // Construct the constructor and destructor arrays.
@@ -507,7 +507,7 @@
     llvm::ConstantExpr::getBitCast(unitGV, SBP),
     llvm::ConstantInt::get(llvm::Type::Int32Ty, LineNo)
   };
-  return llvm::ConstantStruct::get(Fields, 4, false);
+  return llvm::ConstantStruct::get(VMContext, Fields, 4, false);
 }
 
 bool CodeGenModule::MayDeferGeneration(const ValueDecl *Global) {

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=78259&r1=78258&r2=78259&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Wed Aug  5 18:18:46 2009
@@ -35,7 +35,7 @@
   class GlobalValue;
   class TargetData;
   class FunctionType;
-  class LLVMContext;
+  struct LLVMContext;
 }
 
 namespace clang {

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Wed Aug  5 18:18:46 2009
@@ -237,7 +237,7 @@
   case Type::Complex: {
     const llvm::Type *EltTy = 
       ConvertTypeRecursive(cast<ComplexType>(Ty).getElementType());
-    return llvm::StructType::get(EltTy, EltTy, NULL);
+    return llvm::StructType::get(TheModule.getContext(), EltTy, EltTy, NULL);
   }
   case Type::LValueReference:
   case Type::RValueReference: {
@@ -360,7 +360,8 @@
 
     QualType ETy = cast<MemberPointerType>(Ty).getPointeeType();
     if (ETy->isFunctionType()) {
-      return llvm::StructType::get(ConvertType(Context.getPointerDiffType()), 
+      return llvm::StructType::get(TheModule.getContext(),
+                                   ConvertType(Context.getPointerDiffType()), 
                                    ConvertType(Context.getPointerDiffType()),
                                    NULL);
     } else

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.h Wed Aug  5 18:18:46 2009
@@ -14,6 +14,7 @@
 #ifndef CLANG_CODEGEN_CODEGENTYPES_H
 #define CLANG_CODEGEN_CODEGENTYPES_H
 
+#include "llvm/Module.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallSet.h"
 #include <vector>
@@ -27,6 +28,7 @@
   class PATypeHolder;
   class TargetData;
   class Type;
+  struct LLVMContext;
 }
 
 namespace clang {
@@ -146,6 +148,7 @@
   TargetInfo &getTarget() const { return Target; }
   ASTContext &getContext() const { return Context; }
   const ABIInfo &getABIInfo() const;
+  llvm::LLVMContext &getLLVMContext() { return TheModule.getContext(); }
 
   /// ConvertType - Convert type T into a llvm::Type.  
   const llvm::Type *ConvertType(QualType T);

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

==============================================================================
--- cfe/trunk/lib/CodeGen/TargetABIInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetABIInfo.cpp Wed Aug  5 18:18:46 2009
@@ -875,7 +875,7 @@
     // %st1.
   case ComplexX87:
     assert(Hi == ComplexX87 && "Unexpected ComplexX87 classification.");
-    ResType = llvm::StructType::get(llvm::Type::X86_FP80Ty,
+    ResType = llvm::StructType::get(VMContext, llvm::Type::X86_FP80Ty,
                                     llvm::Type::X86_FP80Ty,
                                     NULL);
     break;
@@ -892,10 +892,12 @@
   case NoClass: break;
 
   case Integer:
-    ResType = llvm::StructType::get(ResType, llvm::Type::Int64Ty, NULL);
+    ResType = llvm::StructType::get(VMContext, ResType,
+                                    llvm::Type::Int64Ty, NULL);
     break;
   case SSE:
-    ResType = llvm::StructType::get(ResType, llvm::Type::DoubleTy, NULL);
+    ResType = llvm::StructType::get(VMContext, ResType,
+                                    llvm::Type::DoubleTy, NULL);
     break;
 
     // AMD64-ABI 3.2.3p4: Rule 5. If the class is SSEUP, the eightbyte
@@ -915,7 +917,8 @@
     // preceeded by X87. In such situations we follow gcc and pass the
     // extra bits in an SSE reg.
     if (Lo != X87)
-      ResType = llvm::StructType::get(ResType, llvm::Type::DoubleTy, NULL);
+      ResType = llvm::StructType::get(VMContext, ResType,
+                                      llvm::Type::DoubleTy, NULL);
     break;
   }
 
@@ -985,7 +988,8 @@
 
   case NoClass: break;
   case Integer:
-    ResType = llvm::StructType::get(ResType, llvm::Type::Int64Ty, NULL);
+    ResType = llvm::StructType::get(VMContext, ResType,
+                                    llvm::Type::Int64Ty, NULL);
     ++neededInt;
     break;
 
@@ -993,7 +997,8 @@
     // memory), except in situations involving unions.
   case X87Up:
   case SSE:
-    ResType = llvm::StructType::get(ResType, llvm::Type::DoubleTy, NULL);
+    ResType = llvm::StructType::get(VMContext, ResType,
+                                    llvm::Type::DoubleTy, NULL);
     ++neededSSE;
     break;
 
@@ -1214,7 +1219,8 @@
                             llvm::ConstantInt::get(llvm::Type::Int32Ty, 16));
       const llvm::Type *DblPtrTy =
         llvm::PointerType::getUnqual(llvm::Type::DoubleTy);
-      const llvm::StructType *ST = llvm::StructType::get(llvm::Type::DoubleTy,
+      const llvm::StructType *ST = llvm::StructType::get(VMContext,
+                                                         llvm::Type::DoubleTy,
                                                          llvm::Type::DoubleTy,
                                                          NULL);
       llvm::Value *V, *Tmp = CGF.CreateTempAlloca(ST);
@@ -1355,7 +1361,7 @@
   }
   std::vector<const llvm::Type*> LLVMFields;
   LLVMFields.push_back(llvm::ArrayType::get(ElemTy, SizeRegs));
-  const llvm::Type* STy = llvm::StructType::get(LLVMFields, true);
+  const llvm::Type* STy = llvm::StructType::get(VMContext, LLVMFields, true);
   return ABIArgInfo::getCoerce(STy);
 }
 





More information about the cfe-commits mailing list