[PATCH] D111100: enable plugins for clang-tidy

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 16 11:19:13 PST 2021


aaron.ballman added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp:392-394
+  cl::Option *load_opt = cl::getRegisteredOptions().lookup("load");
+  if (load_opt)
+    load_opt->addCategory(ClangTidyCategory);
----------------



================
Comment at: clang-tools-extra/docs/clang-tidy/Contributing.rst:421-424
+If you want to develop this out-of-tree, the steps above are the largely same.
+External to the clang-tidy build system, put all of the new code into a single
+shared library. Build and link it against llvm, while allowing some symbols to
+be undefined during linking, almost exactly as you would define a clang plugin.
----------------
I wordsmithed a bit and this should be similar to what you already had. I did remove the "while allowing some symbols to be undefined during linking" bit because I wasn't certain what that was about.


================
Comment at: clang-tools-extra/docs/clang-tidy/Contributing.rst:426-427
+
+Then we can run it by passing `-load` to `clang-tidy`, in addition to the name
+of our new checks.
+
----------------



================
Comment at: clang-tools-extra/docs/clang-tidy/index.rst:223
+                                     Load the dynamic object ``plugin``. This
+                                     object should register new static analyzer or clang-tidy passes. Once loaded, the object
+                                     will add new command line options to run
----------------



================
Comment at: clang-tools-extra/test/clang-tidy/CTTestTidyModule.cpp:24-25
+
+  //void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+  //void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+
----------------
Shouldn't these functions be overloaded? We don't need it to be particularly functional, but the plugin should demonstrate that it works and can be run by clang-tidy (not just loaded and listed as a check).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111100/new/

https://reviews.llvm.org/D111100



More information about the cfe-commits mailing list