diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2009-03-23 03:00:06 +0000 | 
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2009-03-23 03:00:06 +0000 | 
| commit | 7b4716750b6066274f9a99a0f45217ec4b2b3c35 (patch) | |
| tree | 55330df59864f79b206b1ca27fe10256f8f2ac06 /clang/lib | |
| parent | 43e2deee22c25bcef7fcc26acca23a9542c46a55 (diff) | |
| download | bcm5719-llvm-7b4716750b6066274f9a99a0f45217ec4b2b3c35.tar.gz bcm5719-llvm-7b4716750b6066274f9a99a0f45217ec4b2b3c35.zip  | |
Fix a subtle bug in CodeGen for the increment of a bitfield.
llvm-svn: 67499
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 12 | 
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 80aa755e189..89f28bea6d3 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -620,9 +620,8 @@ Value *ScalarExprEmitter::VisitBlockDeclRefExpr(const BlockDeclRefExpr *E) {  Value *ScalarExprEmitter::VisitPrePostIncDec(const UnaryOperator *E,                                               bool isInc, bool isPre) {    LValue LV = EmitLValue(E->getSubExpr()); -  // FIXME: Handle volatile! -  Value *InVal = CGF.EmitLoadOfLValue(LV, // false -                                     E->getSubExpr()->getType()).getScalarVal(); +  QualType ValTy = E->getSubExpr()->getType(); +  Value *InVal = CGF.EmitLoadOfLValue(LV, ValTy).getScalarVal();    int AmountVal = isInc ? 1 : -1; @@ -667,8 +666,11 @@ Value *ScalarExprEmitter::VisitPrePostIncDec(const UnaryOperator *E,    }    // Store the updated result through the lvalue. -  CGF.EmitStoreThroughLValue(RValue::get(NextVal), LV,  -                             E->getSubExpr()->getType()); +  if (LV.isBitfield()) +    CGF.EmitStoreThroughBitfieldLValue(RValue::get(NextVal), LV, ValTy, +                                       &NextVal); +  else +    CGF.EmitStoreThroughLValue(RValue::get(NextVal), LV, ValTy);    // If this is a postinc, return the value read from memory, otherwise use the    // updated value.  | 

