[PATCH] D45095: [clang-tidy] Align usage of ClangTool interface with new VFS injection

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 19 07:22:28 PDT 2018


whisperity added inline comments.


================
Comment at: clang-tidy/tool/CMakeLists.txt:19
   clangBasic
+  clangFrontend
   clangTidy
----------------
ilya-biryukov wrote:
> whisperity wrote:
> > ilya-biryukov wrote:
> > > Why do we need an extra dependency?
> > In the current state of the patch, `clang-tidy/tool/ClangTidyMain.cpp` constructs the `ClangTool` which constructor requires a `std::shared_ptr<PCHContainerOperations>`. `PCHContainerOperations`'s definition and implementation is part of the `clangFrontend` library, and without this dependency, there would be a symbol resolution error.
> Thanks for clarification.
> Does it mean that to use `ClangTool` one needs both a dependency on `clangTooling` and `clangFrontend`?
> That's weird, given that `clangTooling` itself depends on `clangFrontend` and it would be nice if the buildsystem actually propagated those.
I'm not sure if you need to have both as a dependency just to use `ClangTool`. If you want to construct an empty `PCHContainerOperations` to pass as an argument, though, it seems you do.

One can wonder where the default argument's (which is a shared pointer to a default constructed object) expression's evaluation is in the object code or if passing `nullptr` breaks something.

You need the dependency because it's **your** code who wants to run the constructor of the PCH class.


https://reviews.llvm.org/D45095





More information about the cfe-commits mailing list