[libc-commits] [libc] 473dea9 - [libc] Output all headers with LIBC_CONF_OUTPUT_ALL_HEADERS (#144114)
via libc-commits
libc-commits at lists.llvm.org
Fri Jun 13 14:37:29 PDT 2025
Author: William Huynh
Date: 2025-06-13T14:37:25-07:00
New Revision: 473dea9b0b86d48db805079fa3e68b37e1dbcdd9
URL: https://github.com/llvm/llvm-project/commit/473dea9b0b86d48db805079fa3e68b37e1dbcdd9
DIFF: https://github.com/llvm/llvm-project/commit/473dea9b0b86d48db805079fa3e68b37e1dbcdd9.diff
LOG: [libc] Output all headers with LIBC_CONF_OUTPUT_ALL_HEADERS (#144114)
Following discussion from
https://discourse.llvm.org/t/missing-declarations-in-header-files/86678,
we decided to add a flag to output all headers. Requires #144049.
- Allows outputting all headers
- Minor whitespace change for alignment
---------
Co-authored-by: Michael Jones <michaelrj at google.com>
Added:
Modified:
libc/CMakeLists.txt
libc/cmake/modules/LLVMLibCHeaderRules.cmake
libc/test/UnitTest/CMakeLists.txt
Removed:
################################################################################
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index f21fc2fba7305..9907adfc55a5f 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -135,6 +135,7 @@ endif()
option(LLVM_LIBC_FULL_BUILD "Build and test LLVM libc as if it is the full libc" ${default_to_full_build})
option(LLVM_LIBC_IMPLEMENTATION_DEFINED_TEST_BEHAVIOR "Build LLVM libc tests assuming our implementation-defined behavior" ON)
option(LLVM_LIBC_ENABLE_LINTING "Enables linting of libc source files" OFF)
+option(LLVM_LIBC_ALL_HEADERS "Outputs all functions in header files, regardless of whether they are enabled on this target" OFF)
option(LIBC_CONFIG_PATH "The path to user provided folder that configures the build for the target system." OFF)
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index 99f90244e0134..01c288f0b9198 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -97,8 +97,13 @@ function(add_gen_header target_name)
set(out_file ${LIBC_INCLUDE_DIR}/${relative_path})
set(dep_file "${out_file}.d")
set(yaml_file ${CMAKE_SOURCE_DIR}/${ADD_GEN_HDR_YAML_FILE})
+
+ if(LLVM_LIBC_ALL_HEADERS)
+ set(entry_points "")
+ else()
+ set(entry_points "${TARGET_ENTRYPOINT_NAME_LIST}")
+ endif()
- set(entry_points "${TARGET_ENTRYPOINT_NAME_LIST}")
list(TRANSFORM entry_points PREPEND "--entry-point=")
add_custom_command(
diff --git a/libc/test/UnitTest/CMakeLists.txt b/libc/test/UnitTest/CMakeLists.txt
index b0a3a7431c222..c32809da577d4 100644
--- a/libc/test/UnitTest/CMakeLists.txt
+++ b/libc/test/UnitTest/CMakeLists.txt
@@ -35,7 +35,7 @@ function(add_unittest_framework_library name)
else()
_get_common_test_compile_options(compile_options "" "")
target_compile_options(${name}.unit PRIVATE ${compile_options})
-endif()
+ endif()
_get_hermetic_test_compile_options(compile_options "")
target_include_directories(${name}.hermetic PRIVATE ${LIBC_INCLUDE_DIR})
More information about the libc-commits
mailing list