kadircet created this revision. kadircet added a reviewer: hokein. Herald added a subscriber: arphaman. Herald added a project: All. kadircet requested review of this revision. Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov. Herald added a project: clang-tools-extra.
Repository: rG LLVM Github Monorepo 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; } }
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; } }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits