================
@@ -298,11 +314,6 @@ computeEnclosingFuncRange(const FunctionDecl
*EnclosingFunction,
// returns true if Child can be a single RootStmt being extracted from
// EnclosingFunc.
bool validSingleChild(const Node *Child, const FunctionDecl *EnclosingFunc) {
- // Don't extract expressions.
- // FIXME: We should extract expressions that are "statements" i.e. not
- // subexpressions
- if (Child->ASTNode.get<Expr>())
----------------
timon-ul wrote:
Not sure if this is the cause, but currently I can extract subexpressions,
which I shouldn't be able to (and which produce broken code. Here my example:
```
void test() {
std::cout << ^3;
}
```
I get offered the "extract to function" (which I am sure I shouldn't get
offered) and it turns into
```
void extracted() { 3; }
void test() {
std::cout << extracted();
}
```
which obviously is broken code.
Maybe you should also add a test for this case.
https://github.com/llvm/llvm-project/pull/219945
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits