aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-04-05 16:20:44 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-04-05 16:20:44 +0000
commit2eec0b2e3e931de6cefbb266a7652a0622fe95b2 (patch)
tree2ca48c3267dd8b3d5c5b63171838dfac9c991664
parent56229f5889ee35495de7138f29712674f8f81ec1 (diff)
IRgen: Lift BitFieldInfo to CGBitFieldInfo at namespace level.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100433 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGExpr.cpp2
-rw-r--r--lib/CodeGen/CGObjCMac.cpp2
-rw-r--r--lib/CodeGen/CGRecordLayout.h28
-rw-r--r--lib/CodeGen/CGRecordLayoutBuilder.cpp2
4 files changed, 16 insertions, 18 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 87ec159a60..f1115531e9 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -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).
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 9ca0bc0c29..e4df872d35 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -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());
diff --git a/lib/CodeGen/CGRecordLayout.h b/lib/CodeGen/CGRecordLayout.h
index d0d8f984a9..5e2abb1bb3 100644
--- a/lib/CodeGen/CGRecordLayout.h
+++ b/lib/CodeGen/CGRecordLayout.h
@@ -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;
diff --git a/lib/CodeGen/CGRecordLayoutBuilder.cpp b/lib/CodeGen/CGRecordLayoutBuilder.cpp
index daebabddc6..864f557f76 100644
--- a/lib/CodeGen/CGRecordLayoutBuilder.cpp
+++ b/lib/CodeGen/CGRecordLayoutBuilder.cpp
@@ -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));
}