[PATCH] D65332: [Clangd] Disable ExtractVariable for all types of assignments
Shaurya Gupta via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 26 06:22:33 PDT 2019
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65332.211927.patch
Type: text/x-patch
Size: 1140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190726/9eab333a/attachment.bin>
More information about the cfe-commits
mailing list