[clang] [clang][index] Fix processing of CompoundAssignOperator at setting up reference roles (PR #69370)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 19 00:19:31 PDT 2023


================
@@ -77,9 +77,15 @@ class BodyIndexer : public RecursiveASTVisitor<BodyIndexer> {
     const Stmt *Parent = *It;
 
     if (auto BO = dyn_cast<BinaryOperator>(Parent)) {
-      if (BO->getOpcode() == BO_Assign && BO->getLHS()->IgnoreParenCasts() == E)
-        Roles |= (unsigned)SymbolRole::Write;
-
+      if (BO->getOpcode() == BO_Assign) {
+        if (BO->getLHS()->IgnoreParenCasts() == E)
----------------
hokein wrote:

nit: consider inlining this `if` to the one above (like the original code) to the code less nested.

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


More information about the cfe-commits mailing list