[clang] [clang][CFG] Sequence RHS before LHS for overloaded assignment operators in CFG to match C++17 rules (PR #181113)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 12 04:53:03 PST 2026


================
@@ -2542,6 +2543,19 @@ CFGBlock *CFGBuilder::VisitChildren(Stmt *S) {
   return B;
 }
 
+CFGBlock *CFGBuilder::VisitCallExprChildren(CallExpr *C) {
+  // C++17 onwards require that the right operand is sequenced before the left
+  // operand.
----------------
usx95 wrote:

nit: Add a comment about why we do the reverse of what is said in this comment.

Something similar to the docs for `VisitChildren`. Suggestion

```
// For overloaded assignment operators, visit arguments in reverse order
// (LHS then RHS) so that RHS is sequenced before LHS in the CFG,
// matching C++17 sequencing rules.
```

https://github.com/llvm/llvm-project/pull/181113


More information about the cfe-commits mailing list