Skip to content

Conversation

@evelez7
Copy link
Member

@evelez7 evelez7 commented Oct 31, 2025

To avoid depending on all of the tools in clang-tools-extra, the
check-clang-extra-clang-doc target is specialized in its own CMake
file in clang-tools-extra/test/clang-doc. This eliminates around 800
files to be processed when building that target, plus linking every
tool. Similar to #155929.

@evelez7 evelez7 marked this pull request as ready for review October 31, 2025 22:51
@llvmbot
Copy link
Member

llvmbot commented Oct 31, 2025

@llvm/pr-subscribers-clang-tools-extra

Author: Erick Velez (evelez7)

Changes

To avoid depending on all of the tools in clang-tools-extra, the
check-clang-extra-clang-doc target is specialized in its own CMake
file in clang-tools-extra/test/clang-doc. This eliminates around 800
files to be processed when building that target, plus linking every
tool.


Full diff: https://github.com/llvm/llvm-project/pull/165935.diff

2 Files Affected:

  • (modified) clang-tools-extra/test/CMakeLists.txt (+3)
  • (added) clang-tools-extra/test/clang-doc/CMakeLists.txt (+6)
diff --git a/clang-tools-extra/test/CMakeLists.txt b/clang-tools-extra/test/CMakeLists.txt
index a70d2ef2d92f2..78447e7a00db8 100644
--- a/clang-tools-extra/test/CMakeLists.txt
+++ b/clang-tools-extra/test/CMakeLists.txt
@@ -87,4 +87,7 @@ add_lit_testsuite(check-clang-extra "Running clang-tools-extra/test"
 
 add_lit_testsuites(CLANG-EXTRA ${CMAKE_CURRENT_SOURCE_DIR}
   DEPENDS ${CLANG_TOOLS_TEST_DEPS}
+   SKIP "^clang-doc"
   )
+
+add_subdirectory(clang-doc)
diff --git a/clang-tools-extra/test/clang-doc/CMakeLists.txt b/clang-tools-extra/test/clang-doc/CMakeLists.txt
new file mode 100644
index 0000000000000..fd2230660bdef
--- /dev/null
+++ b/clang-tools-extra/test/clang-doc/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Specialize the clang-doc target to avoid building other projects
+add_lit_testsuite(check-clang-extra-clang-doc "Running clang-doc tests"
+  ${CMAKE_CURRENT_BINARY_DIR}
+  DEPENDS clang-doc
+  DEPENDS ${LLVM_UTILS_DEPS}
+)

@evelez7 evelez7 changed the title [clang-doc] create a separate cmake file for clang-doc's LIT tests [clang-doc] add separate test target for clang-doc Oct 31, 2025
@evelez7 evelez7 changed the title [clang-doc] add separate test target for clang-doc [clang-doc] create a separate cmake file for clang-doc's lit tests Oct 31, 2025
To avoid depending on all of the tools in clang-tools-extra, the
`check-clang-extra-clang-doc` target is specialized in its own CMake
file in clang-tools-extra/test/clang-doc. This eliminates around 800
files to be processed when building that target, plus linking every
tool.
@evelez7 evelez7 force-pushed the users/evelez7/clang-doc-test-specialize-cmake branch from 5cf1030 to 07c3be5 Compare October 31, 2025 23:01
Copy link
Member Author

evelez7 commented Oct 31, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ilovepi
Copy link
Contributor

ilovepi commented Oct 31, 2025

If we're doing that, should we also consider having our own unittests target?

Copy link
Member Author

evelez7 commented Oct 31, 2025

If we're doing that, should we also consider having our own unittests target?

Yes, we should. I want to do that next. The thing is that the add_lit_testsuite CMake macro thing exposes a target in build.ninja. AFAIK, no project in clang-tools-extra has a special command for unittests (like check-clang-extra-unit-clangd). So I'll have to do some CMake digging. 🙃

@boomanaiden154
Copy link
Contributor

I think having a separate unittest target is also perfectly reasonable to do in a follow up patch.

@ilovepi
Copy link
Contributor

ilovepi commented Nov 1, 2025

I think having a separate unittest target is also perfectly reasonable to do in a follow up patch.

Right. I'm not suggesting its a requirement to land. just an observation that we probably should.


add_lit_testsuites(CLANG-EXTRA ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${CLANG_TOOLS_TEST_DEPS}
SKIP "^clang-doc"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not something that needs to be done in this patch, but I think we should consider adding CMakeLists.txt files for all other subdirectories and then remove this target altogether.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this as well. I opened #165820. I thought about closing it after merging this but I might keep it open. I don't know how tied the other projects are to that target and CMake file.

Copy link
Member Author

evelez7 commented Nov 1, 2025

Merge activity

  • Nov 1, 3:36 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Nov 1, 3:38 AM UTC: @evelez7 merged this pull request with Graphite.

@evelez7 evelez7 merged commit 197de78 into main Nov 1, 2025
10 checks passed
@evelez7 evelez7 deleted the users/evelez7/clang-doc-test-specialize-cmake branch November 1, 2025 03:38
DEBADRIBASAK pushed a commit to DEBADRIBASAK/llvm-project that referenced this pull request Nov 3, 2025
…lvm#165935)

To avoid depending on all of the tools in clang-tools-extra, the
`check-clang-extra-clang-doc` target is specialized in its own CMake
file in clang-tools-extra/test/clang-doc. This eliminates around 800
files to be processed when building that target, plus linking every
tool. Similar to [llvm#155929](llvm#155929).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants