]> granicus.if.org Git - clang/commitdiff
Minor simplification.
authorEli Friedman <eli.friedman@gmail.com>
Sat, 25 Apr 2009 22:44:54 +0000 (22:44 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Sat, 25 Apr 2009 22:44:54 +0000 (22:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70091 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenTypes.cpp

index 94853b2e867d0334a4601e629bcd1fe117e91044..79aa705971cfaf7a670ef03c99c8f2c77bf40359 100644 (file)
@@ -529,13 +529,8 @@ void RecordOrganizer::layoutStructFields(const ASTRecordLayout &RL) {
     uint64_t size = CGT.getTargetData().getTypePaddedSizeInBits(Ty);
 
     if (Field->isBitField()) {
-      Expr *BitWidth = Field->getBitWidth();
-      llvm::APSInt FieldSize(32);
-      bool isBitField =
-        BitWidth->isIntegerConstantExpr(FieldSize, CGT.getContext());
-      assert(isBitField && "Invalid BitField size expression");
-      isBitField=isBitField; // silence warning.
-      uint64_t BitFieldSize = FieldSize.getZExtValue();
+      uint64_t BitFieldSize =
+          Field->getBitWidth()->EvaluateAsInt(CGT.getContext()).getZExtValue();
 
       // Bitfield field info is different from other field info;
       // it actually ignores the underlying LLVM struct because