[clang-tools-extra] [clangd] Check for valid location in ExtractionContext::exprIsValidOutside (PR #71162)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 10 00:34:36 PST 2023


================
@@ -0,0 +1,11 @@
+// RUN: cp %s %t.c
----------------
HighCommander4 wrote:

I think it would be more consistent with the rest of the clangd subproject if this was expressed as a unit test.

It can take the form of a new section added to [this existing test](https://searchfox.org/llvm/rev/6a91b7051df7e108c8ffd79c084859f90559962d/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp#19), similar to [this section](https://searchfox.org/llvm/rev/6a91b7051df7e108c8ffd79c084859f90559962d/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp#61-66) but using `EXPECT_UNAVAILABLE` (since the refactoring does not end up being available on this test case, even though it passes this particular check). The `[[ ]]` in the input source code annotates the source range on which the refactoring is invoked.

https://github.com/llvm/llvm-project/pull/71162


More information about the cfe-commits mailing list