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 0f6e404..ee0ccd6 100644
--- a/CodeGen/CGExprScalar.cpp
+++ b/CodeGen/CGExprScalar.cpp
@@ -188,16 +188,16 @@
}
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 @@
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 @@
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 @@
OpInfo.RHS = Visit(E->getRHS());
// Convert the LHS/RHS values to the computation type.
- const CompoundAssignOperator *CAO = cast<CompoundAssignOperator>(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!