]> granicus.if.org Git - clang/commitdiff
IRgen: Lift BitFieldInfo to CGBitFieldInfo at namespace level.
authorDaniel Dunbar <daniel@zuster.org>
Mon, 5 Apr 2010 16:20:44 +0000 (16:20 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 5 Apr 2010 16:20:44 +0000 (16:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100433 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp
lib/CodeGen/CGObjCMac.cpp
lib/CodeGen/CGRecordLayout.h
lib/CodeGen/CGRecordLayoutBuilder.cpp

index 87ec159a60109691e6996591d4abf1e76534308a..f1115531e917736a4cc2974bf4f7deacb138cc8b 100644 (file)
@@ -1471,7 +1471,7 @@ LValue CodeGenFunction::EmitLValueForBitfield(llvm::Value* BaseValue,
                                               unsigned CVRQualifiers) {
   const CGRecordLayout &RL =
     CGM.getTypes().getCGRecordLayout(Field->getParent());
-  const CGRecordLayout::BitFieldInfo &Info = RL.getBitFieldInfo(Field);
+  const CGBitFieldInfo &Info = RL.getBitFieldInfo(Field);
 
   // FIXME: CodeGenTypes should expose a method to get the appropriate type for
   // FieldTy (the appropriate type is ABI-dependent).
index 9ca0bc0c29617db487c897e29bebe36224ab432b..e4df872d35b995d8e1db5fc4aba2dd4dc1326954 100644 (file)
@@ -3126,7 +3126,7 @@ void CGObjCCommonMac::BuildAggrIvarLayout(const ObjCImplementationDecl *OI,
       const CGRecordLayout &RL =
         CGM.getTypes().getCGRecordLayout(Field->getParent());
       if (Field->isBitField()) {
-        const CGRecordLayout::BitFieldInfo &Info = RL.getBitFieldInfo(Field);
+        const CGBitFieldInfo &Info = RL.getBitFieldInfo(Field);
 
         const llvm::Type *Ty =
           CGM.getTypes().ConvertTypeForMemRecursive(Field->getType());
index d0d8f984a9efaed712cfa17535e08626633532bd..5e2abb1bb38fc21e3f1afeeac0e74e0b96643c1a 100644 (file)
@@ -19,6 +19,16 @@ namespace llvm {
 namespace clang {
 namespace CodeGen {
 
+class CGBitFieldInfo {
+public:
+  CGBitFieldInfo(unsigned FieldNo, unsigned Start, unsigned Size)
+    : FieldNo(FieldNo), Start(Start), Size(Size) {}
+
+  unsigned FieldNo;
+  unsigned Start;
+  unsigned Size;
+};
+
 /// CGRecordLayout - This class handles struct and union layout info while
 /// lowering AST types to LLVM types.
 ///
@@ -29,18 +39,6 @@ class CGRecordLayout {
   CGRecordLayout(const CGRecordLayout&); // DO NOT IMPLEMENT
   void operator=(const CGRecordLayout&); // DO NOT IMPLEMENT
 
-public:
-  struct BitFieldInfo {
-    BitFieldInfo(unsigned FieldNo,
-                 unsigned Start,
-                 unsigned Size)
-      : FieldNo(FieldNo), Start(Start), Size(Size) {}
-
-    unsigned FieldNo;
-    unsigned Start;
-    unsigned Size;
-  };
-
 private:
   /// The LLVMType corresponding to this record layout.
   const llvm::Type *LLVMType;
@@ -51,7 +49,7 @@ private:
 
   /// Map from (bit-field) struct field to the corresponding llvm struct type
   /// field no. This info is populated by record builder.
-  llvm::DenseMap<const FieldDecl *, BitFieldInfo> BitFields;
+  llvm::DenseMap<const FieldDecl *, CGBitFieldInfo> BitFields;
 
   /// Whether one of the fields in this record layout is a pointer to data
   /// member, or a struct that contains pointer to data member.
@@ -80,9 +78,9 @@ public:
 
   /// \brief Return llvm::StructType element number that corresponds to the
   /// field FD.
-  const BitFieldInfo &getBitFieldInfo(const FieldDecl *FD) const {
+  const CGBitFieldInfo &getBitFieldInfo(const FieldDecl *FD) const {
     assert(FD->isBitField() && "Invalid call for non bit-field decl!");
-    llvm::DenseMap<const FieldDecl *, BitFieldInfo>::const_iterator
+    llvm::DenseMap<const FieldDecl *, CGBitFieldInfo>::const_iterator
       it = BitFields.find(FD);
     assert(it != BitFields.end()  && "Unable to find bitfield info");
     return it->second;
index daebabddc61fb832082969efa536f684cdb65e3f..864f557f766a61647b9c907a033da1f0ffb7143f 100644 (file)
@@ -506,7 +506,7 @@ CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const RecordDecl *D) {
     const CGRecordLayoutBuilder::LLVMBitFieldInfo &Info =
       Builder.LLVMBitFields[i];
 
-    CGRecordLayout::BitFieldInfo BFI(Info.FieldNo, Info.Start, Info.Size);
+    CGBitFieldInfo BFI(Info.FieldNo, Info.Start, Info.Size);
     RL->BitFields.insert(std::make_pair(Info.FD, BFI));
   }