diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-04-06 15:53:59 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-04-06 15:53:59 +0000 |
commit | 71438373cd57f0d5d8c93bb5cf690844a0fbc9d0 (patch) | |
tree | 59c928209f8007777dd96568b026bdfe200691de /lib/CodeGen/CGRecordLayoutBuilder.cpp | |
parent | ac616af773f5062edaaf1a0bb5610b49a22ac41f (diff) | |
download | FreeBSD-src-71438373cd57f0d5d8c93bb5cf690844a0fbc9d0.zip FreeBSD-src-71438373cd57f0d5d8c93bb5cf690844a0fbc9d0.tar.gz |
Update clang to r100520.
Diffstat (limited to 'lib/CodeGen/CGRecordLayoutBuilder.cpp')
-rw-r--r-- | lib/CodeGen/CGRecordLayoutBuilder.cpp | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/lib/CodeGen/CGRecordLayoutBuilder.cpp b/lib/CodeGen/CGRecordLayoutBuilder.cpp index daebabd..4b9ec66 100644 --- a/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -37,17 +37,7 @@ public: llvm::SmallVector<LLVMFieldInfo, 16> LLVMFields; /// LLVMBitFieldInfo - Holds location and size information about a bit field. - struct LLVMBitFieldInfo { - LLVMBitFieldInfo(const FieldDecl *FD, unsigned FieldNo, unsigned Start, - unsigned Size) - : FD(FD), FieldNo(FieldNo), Start(Start), Size(Size) { } - - const FieldDecl *FD; - - unsigned FieldNo; - unsigned Start; - unsigned Size; - }; + typedef std::pair<const FieldDecl *, CGBitFieldInfo> LLVMBitFieldInfo; llvm::SmallVector<LLVMBitFieldInfo, 16> LLVMBitFields; /// ContainsPointerToDataMember - Whether one of the fields in this record @@ -188,9 +178,11 @@ void CGRecordLayoutBuilder::LayoutBitField(const FieldDecl *D, const llvm::Type *Ty = Types.ConvertTypeForMemRecursive(D->getType()); uint64_t TypeSizeInBits = getTypeSizeInBytes(Ty) * 8; - LLVMBitFields.push_back(LLVMBitFieldInfo(D, FieldOffset / TypeSizeInBits, - FieldOffset % TypeSizeInBits, - FieldSize)); + bool IsSigned = D->getType()->isSignedIntegerType(); + LLVMBitFields.push_back(LLVMBitFieldInfo( + D, CGBitFieldInfo(FieldOffset / TypeSizeInBits, + FieldOffset % TypeSizeInBits, + FieldSize, IsSigned))); AppendBytes(NumBytesToAppend); @@ -288,7 +280,10 @@ void CGRecordLayoutBuilder::LayoutUnion(const RecordDecl *D) { continue; // Add the bit field info. - LLVMBitFields.push_back(LLVMBitFieldInfo(*Field, 0, 0, FieldSize)); + bool IsSigned = Field->getType()->isSignedIntegerType(); + LLVMBitFields.push_back(LLVMBitFieldInfo( + *Field, CGBitFieldInfo(0, 0, FieldSize, + IsSigned))); } else { LLVMFields.push_back(LLVMFieldInfo(*Field, 0)); } @@ -494,21 +489,12 @@ CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const RecordDecl *D) { new CGRecordLayout(Ty, Builder.ContainsPointerToDataMember); // Add all the field numbers. - for (unsigned i = 0, e = Builder.LLVMFields.size(); i != e; ++i) { - const FieldDecl *FD = Builder.LLVMFields[i].first; - unsigned FieldNo = Builder.LLVMFields[i].second; - - RL->FieldInfo.insert(std::make_pair(FD, FieldNo)); - } + for (unsigned i = 0, e = Builder.LLVMFields.size(); i != e; ++i) + RL->FieldInfo.insert(Builder.LLVMFields[i]); // Add bitfield info. - for (unsigned i = 0, e = Builder.LLVMBitFields.size(); i != e; ++i) { - const CGRecordLayoutBuilder::LLVMBitFieldInfo &Info = - Builder.LLVMBitFields[i]; - - CGRecordLayout::BitFieldInfo BFI(Info.FieldNo, Info.Start, Info.Size); - RL->BitFields.insert(std::make_pair(Info.FD, BFI)); - } + for (unsigned i = 0, e = Builder.LLVMBitFields.size(); i != e; ++i) + RL->BitFields.insert(Builder.LLVMBitFields[i]); return RL; } |