[PATCH] D131963: [libc++] Add custom clang-tidy checks

Louis Dionne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 23 08:33:06 PDT 2022


ldionne accepted this revision.
ldionne added subscribers: smeenai, beanz.
ldionne added a comment.
This revision is now accepted and ready to land.

I'd be fine with this as-is if it works in the CI.

IIUC, the current blocker for this is that the `ClangConfig.cmake` installed by LLVM is not robust to the dev packages missing. If you do `find_package(Clang 16.0)`, it will error out if the dev packages are not present, since it will try to reference static libraries (and other artifacts) that don't exist and try to create IMPORTED targets for those. @smeenai @beanz do you know more about that, or do you know someone that does? Do you know who set up the CMake config files so that `find_package(Clang)` would work in the first place? I'd also welcome your input on the `ClangConfigVersion.cmake.in` changes.

Just for the context, what we're trying to do here is simply use `clang-tidy`'s development packages from the libc++ build to add our own custom clang-tidy checks.

Accepting because this LGTM, although we do have some stuff to resolve before this can be shipped.



================
Comment at: libcxx/test/tools/clang_tidy_checks/CMakeLists.txt:39
+set_target_properties(cxx-tidy PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+set(CMAKE_SHARED_MODULE_SUFFIX_CXX .plugin) # Use a single suffix to simplify how we can find it from Lit
----------------



================
Comment at: libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp:22
+AST_MATCHER(clang::UnresolvedLookupExpr, isCustomizationPoint) {
+  // TODO: Are make_error_code and make_error_condition actually customization points?
+  return std::ranges::any_of(
----------------
This is funny, I actually saw a LWG issue about that go by a few weeks ago. I'll try to get more details.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131963



More information about the cfe-commits mailing list