SureYeaah created this revision. SureYeaah added reviewers: sammccall, kadircet. Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay, ilya-biryukov. Herald added a project: clang.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D65332 Files: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp clang-tools-extra/clangd/unittests/TweakTests.cpp Index: clang-tools-extra/clangd/unittests/TweakTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/TweakTests.cpp +++ clang-tools-extra/clangd/unittests/TweakTests.cpp @@ -371,6 +371,8 @@ auto lamb = [&[[a]], &[[b]]](int r = [[1]]) {return 1;} // assigment [[a = 5]]; + [[a >>= 5]]; + [[a *= 5]]; // Variable DeclRefExpr a = [[b]]; // label statement Index: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp =================================================================== --- clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp +++ clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp @@ -272,7 +272,7 @@ // Extracting Exprs like a = 1 gives dummy = a = 1 which isn't useful. if (const BinaryOperator *BinOpExpr = dyn_cast_or_null<BinaryOperator>(SelectedExpr)) { - if (BinOpExpr->getOpcode() == BinaryOperatorKind::BO_Assign) + if (BinOpExpr->isAssignmentOp()) return false; } // For function and member function DeclRefs, we look for a parent that is a
Index: clang-tools-extra/clangd/unittests/TweakTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/TweakTests.cpp +++ clang-tools-extra/clangd/unittests/TweakTests.cpp @@ -371,6 +371,8 @@ auto lamb = [&[[a]], &[[b]]](int r = [[1]]) {return 1;} // assigment [[a = 5]]; + [[a >>= 5]]; + [[a *= 5]]; // Variable DeclRefExpr a = [[b]]; // label statement Index: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp =================================================================== --- clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp +++ clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp @@ -272,7 +272,7 @@ // Extracting Exprs like a = 1 gives dummy = a = 1 which isn't useful. if (const BinaryOperator *BinOpExpr = dyn_cast_or_null<BinaryOperator>(SelectedExpr)) { - if (BinOpExpr->getOpcode() == BinaryOperatorKind::BO_Assign) + if (BinOpExpr->isAssignmentOp()) return false; } // For function and member function DeclRefs, we look for a parent that is a
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits