[PATCH] D22910: Add support for CXXOperatorCallExpr in Expr::HasSideEffects

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 21 08:50:09 PDT 2016


On 21 Sep 2016 6:10 am, "Aaron Ballman" <aaron.ballman at gmail.com> wrote:

aaron.ballman added a comment.

The other thing this patch is missing are tests, btw.


================
Comment at: lib/AST/Expr.cpp:2869
@@ +2868,3 @@
+    // assignment operator is intended to have a side-effect and other
overloaded
+    // operators are not. Otherwise fall through the logic of call
expression.
+    OverloadedOperatorKind Op = cast<CXXOperatorCallExpr>(
this)->getOperator();
----------------
I think that `operator++()` and `operator--()` should be handled as well as
the assignment operators. @rsmith, thoughts?


I agree; if we're going to assume that overloaded operators are intended to
mutate the object in the cases where the builtin form does, that should
apply to all such operators -- assignment, compound assignment, increment
and decrement.

https://reviews.llvm.org/D22910
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160921/5068422b/attachment.html>


More information about the cfe-commits mailing list