[PATCH] D65337: [clangd] Disallow extraction of expression-statements.
Shaurya Gupta via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 29 07:37:15 PDT 2019
SureYeaah added a comment.
What was the bug in getCallExpr() ?
================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp:391
+ return false;
+ Outer->dumpColor();
+ // Blacklist the most common places where an expr can appear but be unused.
----------------
Remove dump.
================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp:445
+
+ // FIXME: ban extracting the RHS of an assignment: `a = [[foo()]]`
return true;
----------------
Check if parent is an assignment binaryoperator or a vardecl?
================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp:461
+ // For function and member function DeclRefs, extract the whole call.
+ if (const DeclRefExpr *DeclRef = dyn_cast_or_null<DeclRefExpr>(SelectedExpr))
TargetNode = getCallExpr(N);
----------------
Can we combine both these IFs and remove the unused assignment?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65337/new/
https://reviews.llvm.org/D65337
More information about the cfe-commits
mailing list