[PATCH] D135257: [clangd][Tweak] Make sure enclosing function doesnt have invalid children
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 7 03:06:15 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe09aa0d192e0: [clangd][Tweak] Make sure enclosing function doesnt have invalid children (authored by kadircet).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135257/new/
https://reviews.llvm.org/D135257
Files:
clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
Index: clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
===================================================================
--- clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
@@ -248,6 +248,13 @@
// FIXME: Support extraction from templated functions.
if (Func->isTemplated())
return nullptr;
+ for (const auto *S : Func->getBody()->children()) {
+ // During apply phase, we perform semantic analysis (e.g. figure out
+ // what variables requires hoisting). We cannot perform those when the
+ // body has invalid statements, so fail up front.
+ if (!S)
+ return nullptr;
+ }
return Func;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135257.466019.patch
Type: text/x-patch
Size: 767 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221007/6d2b615e/attachment.bin>
More information about the cfe-commits
mailing list