rsmith added inline comments.
================
Comment at: lib/AST/Expr.cpp:2865-2867
@@ +2864,5 @@
+ case CXXOperatorCallExprClass: {
+ // If it is an operator call expr it can have side effects when the
+ // underlaying operator is of assignment kind.
+ // Othrwise fall through the rest of cases.
+ OverloadedOperatorKind Op = cast<CXXOperatorCallExpr>(this)->getOperator();
----------------
Well, this is true for any overloaded operator. Perhaps something like
"When looking for potential side-effects, we assume that an overloaded
assignment operator is intended to have a side-effect and other overloaded
operators are not."
================
Comment at: lib/AST/Expr.cpp:2869-2871
@@ +2868,5 @@
+ OverloadedOperatorKind Op = cast<CXXOperatorCallExpr>(this)->getOperator();
+ if (CXXOperatorCallExpr::isAssignmentOp(Op)) {
+ return true;
+ }
+ }
----------------
I think this should go after the check for a pure callee -- if for whatever
reason someone has defined an `operator=` with `__attribute__((pure))`, we
shouldn't claim it has a side-effect.
https://reviews.llvm.org/D22910
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits