From: Chris Lattner Date: Sun, 26 Aug 2007 21:41:21 +0000 (+0000) Subject: compound assignment operators are of type CompoundAssignOperator X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3ccf774256382ef9aa95028eaad82f54a3d0b0ad;p=clang compound assignment operators are of type CompoundAssignOperator git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41460 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/CodeGen/CGExprScalar.cpp b/CodeGen/CGExprScalar.cpp index 0f6e4044b4..ee0ccd644e 100644 --- a/CodeGen/CGExprScalar.cpp +++ b/CodeGen/CGExprScalar.cpp @@ -188,16 +188,16 @@ public: } BinOpInfo EmitBinOps(const BinaryOperator *E); - Value *EmitCompoundAssign(const BinaryOperator *E, + Value *EmitCompoundAssign(const CompoundAssignOperator *E, Value *(ScalarExprEmitter::*F)(const BinOpInfo &)); // Binary operators and binary compound assignment operators. #define HANDLEBINOP(OP) \ - Value *VisitBin ## OP(const BinaryOperator *E) { \ - return Emit ## OP(EmitBinOps(E)); \ - } \ - Value *VisitBin ## OP ## Assign(const BinaryOperator *E) { \ - return EmitCompoundAssign(E, &ScalarExprEmitter::Emit ## OP); \ + Value *VisitBin ## OP(const BinaryOperator *E) { \ + return Emit ## OP(EmitBinOps(E)); \ + } \ + Value *VisitBin ## OP ## Assign(const CompoundAssignOperator *E) { \ + return EmitCompoundAssign(E, &ScalarExprEmitter::Emit ## OP); \ } HANDLEBINOP(Mul); HANDLEBINOP(Div); @@ -211,7 +211,7 @@ public: HANDLEBINOP(Or); #undef HANDLEBINOP Value *VisitBinSub(const BinaryOperator *E); - Value *VisitBinSubAssign(const BinaryOperator *E) { + Value *VisitBinSubAssign(const CompoundAssignOperator *E) { return EmitCompoundAssign(E, &ScalarExprEmitter::EmitSub); } @@ -545,7 +545,7 @@ BinOpInfo ScalarExprEmitter::EmitBinOps(const BinaryOperator *E) { return Result; } -Value *ScalarExprEmitter::EmitCompoundAssign(const BinaryOperator *E, +Value *ScalarExprEmitter::EmitCompoundAssign(const CompoundAssignOperator *E, Value *(ScalarExprEmitter::*Func)(const BinOpInfo &)) { QualType LHSTy = E->getLHS()->getType(), RHSTy = E->getRHS()->getType(); @@ -559,8 +559,7 @@ Value *ScalarExprEmitter::EmitCompoundAssign(const BinaryOperator *E, OpInfo.RHS = Visit(E->getRHS()); // Convert the LHS/RHS values to the computation type. - const CompoundAssignOperator *CAO = cast(E); - QualType ComputeType = CAO->getComputationType(); + QualType ComputeType = E->getComputationType(); // FIXME: it's possible for the computation type to be complex if the RHS // is complex. Handle this!