[PATCH] D41535: Add -vfsoverlay option for Clang-Tidy

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 28 02:29:52 PST 2017


ilya-biryukov added a comment.

In https://reviews.llvm.org/D41535#963859, @vladimir.plyashkun wrote:

> Unfortunately, `-ivfsoverlay` in the compile commands works for the compiler invocation, but it doesn't work for tooling.


This looks like a bug in tooling, but let's wait for responses on the other therad.

It seems that `clang-tidy` will terribly broken with per-translation-unit overlays anyway. The problem is that clang-tidy seems to report errors and fixits in `ErrorReporter` class after running the tooling invocation, therefore it won't see any overlays that were local to each translation unit and may report wrong ranges, etc.
Probably global overlays (i.e. this patch) is probably the way to go.



================
Comment at: clang-tidy/ClangTidy.cpp:549
+  if (Context.getOptions().VfsOverlay) {
+    pushVfsOverlayFromFile(*Context.getOptions().VfsOverlay, Tool.getOverlayFileSystem());
+  }
----------------
Could we add a defaulted `vfs::FileSystem BaseFS = getRealFileSystem()` parameter to a constructor of `ClangTool` instead?
It seems like we're exposing implementation details of `ClangTool` here for no good reason.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D41535





More information about the cfe-commits mailing list