[PATCH] D102519: [clangd] Set FileSystem for tweaks in Check tool.

Utkarsh Saxena via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 14 11:27:01 PDT 2021


usaxena95 created this revision.
usaxena95 added a reviewer: kadircet.
Herald added a subscriber: arphaman.
usaxena95 requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102519

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


Index: clang-tools-extra/clangd/tool/Check.cpp
===================================================================
--- clang-tools-extra/clangd/tool/Check.cpp
+++ clang-tools-extra/clangd/tool/Check.cpp
@@ -212,8 +212,11 @@
                                              AST->getTokens(), Start, End);
       Tweak::Selection Selection(&Index, *AST, Start, End, std::move(Tree),
                                  nullptr);
-      for (const auto &T :
-           prepareTweaks(Selection, Opts.TweakFilter, Opts.FeatureModules)) {
+      auto Tweaks =
+          prepareTweaks(Selection, Opts.TweakFilter, Opts.FeatureModules);
+      Selection.FS =
+          &AST->getSourceManager().getFileManager().getVirtualFileSystem();
+      for (const auto &T : Tweaks) {
         auto Result = T->apply(Selection);
         if (!Result) {
           elog("    tweak: {0} ==> FAIL: {1}", T->id(), Result.takeError());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102519.345511.patch
Type: text/x-patch
Size: 909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210514/141dbbb7/attachment-0001.bin>


More information about the cfe-commits mailing list