Skip to content

Commit 0e7c7d4

Browse files
committed
[clangd] Set FileSystem for tweaks in Check tool.
Tweaks like DefineOutline depend on FS to be set at `apply()` time. After https://reviews.llvm.org/D93978, tweaks run from Check tool lost access to FS. This makes the available to apply() once again. Differential Revision: https://reviews.llvm.org/D102519
1 parent 4112f5e commit 0e7c7d4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

clang-tools-extra/clangd/tool/Check.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,13 @@ class Checker {
212212
AST->getTokens(), Start, End);
213213
Tweak::Selection Selection(&Index, *AST, Start, End, std::move(Tree),
214214
nullptr);
215-
for (const auto &T :
216-
prepareTweaks(Selection, Opts.TweakFilter, Opts.FeatureModules)) {
215+
// FS is only populated when applying a tweak, not during prepare as
216+
// prepare should not do any I/O to be fast.
217+
auto Tweaks =
218+
prepareTweaks(Selection, Opts.TweakFilter, Opts.FeatureModules);
219+
Selection.FS =
220+
&AST->getSourceManager().getFileManager().getVirtualFileSystem();
221+
for (const auto &T : Tweaks) {
217222
auto Result = T->apply(Selection);
218223
if (!Result) {
219224
elog(" tweak: {0} ==> FAIL: {1}", T->id(), Result.takeError());

0 commit comments

Comments
 (0)