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

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 07:59:07 PST 2018


ilya-biryukov requested changes to this revision.
ilya-biryukov added inline comments.
This revision now requires changes to proceed.


================
Comment at: clang-tidy/tool/ClangTidyMain.cpp:345
+  if (!Buffer) {
+    llvm::errs() << diag::err_missing_vfs_overlay_file << OverlayFile;
+    return;
----------------
This code will print only the enum's integral value, we want to print an actual error message.
I don't think there's an easy way to reuse clang's diagnostics here, we should spell out the error message explicitly.


================
Comment at: clang-tidy/tool/ClangTidyMain.cpp:430
 
+  llvm::IntrusiveRefCntPtr<vfs::OverlayFileSystem> BaseFS(
+      new vfs::OverlayFileSystem(vfs::getRealFileSystem()));
----------------
We should only create an overlay is `-vfsoverlay` was passed and use `getRealFileSystem` without wrappers in the common case.


================
Comment at: clang-tidy/tool/ClangTidyMain.cpp:433
+  if (!VfsOverlay.empty()) {
+    pushVfsOverlayFromFile(VfsOverlay, *BaseFS);
+  }
----------------
Could we stop clang-tidy with an error if we couldn't create an overlay? That seems like a better option than silently running without an overlay when it was actually specified.



Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D41535





More information about the cfe-commits mailing list