[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 07:12:16 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367113: [Clangd] Disable ExtractVariable for all types of assignments (authored by SureYeaah, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D65332?vs=211927&id=211937#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65332/new/
https://reviews.llvm.org/D65332
Files:
clang-tools-extra/trunk/clangd/refactor/tweaks/ExtractVariable.cpp
clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp
Index: clang-tools-extra/trunk/clangd/refactor/tweaks/ExtractVariable.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/refactor/tweaks/ExtractVariable.cpp
+++ clang-tools-extra/trunk/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/trunk/clangd/unittests/TweakTests.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/trunk/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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65332.211937.patch
Type: text/x-patch
Size: 1176 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190726/b2680217/attachment.bin>
More information about the cfe-commits
mailing list