[Clangd] Disable ExtractVariable for all types of assignments
Reviewers: sammccall, kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65332 llvm-svn: 367113
This commit is contained in:
parent
7ee0867a85
commit
76ba1cf1f1
|
@ -272,7 +272,7 @@ bool ExtractVariable::computeExtractionContext(const SelectionTree::Node *N,
|
|||
// 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
|
||||
|
|
|
@ -371,6 +371,8 @@ TEST(TweakTest, ExtractVariable) {
|
|||
auto lamb = [&[[a]], &[[b]]](int r = [[1]]) {return 1;}
|
||||
// assigment
|
||||
[[a = 5]];
|
||||
[[a >>= 5]];
|
||||
[[a *= 5]];
|
||||
// Variable DeclRefExpr
|
||||
a = [[b]];
|
||||
// label statement
|
||||
|
|
Loading…
Reference in New Issue