[clangd] Rewrite TweakTesting helpers to avoid reparsing the same code. NFC
authorSam McCall <sam.mccall@gmail.com>
Fri, 6 May 2022 17:51:59 +0000 (19:51 +0200)
committerSam McCall <sam.mccall@gmail.com>
Mon, 9 May 2022 12:53:00 +0000 (14:53 +0200)
commita316a9815a4f4105bb96420e85e93fe5f0033ed0
treea43eed30570813fb4c5e24e2312f8f723bdc96a1
parent41e142fdc797fead0b64f51dd9051c81853efa06
[clangd] Rewrite TweakTesting helpers to avoid reparsing the same code. NFC

Previously the EXPECT_AVAILABLE macros would rebuild the code at each marked
point, by expanding the cases textually.
There were often lots, and it's nice to have lots!

This reduces total unittest time by ~10% on my machine.
I did have to sacrifice a little apply() coverage in AddUsingTests (was calling
expandCases directly, which was otherwise unused), but we have
EXPECT_AVAILABLE tests covering that, I don't think there's real risk here.

Differential Revision: https://reviews.llvm.org/D125109
clang-tools-extra/clangd/unittests/tweaks/AddUsingTests.cpp
clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp
clang-tools-extra/clangd/unittests/tweaks/TweakTesting.h