Skip to content

Conversation

hubert-reinterpretcast
Copy link
Collaborator

... in preparation for -finput-charset and -fexec-charset tests that rely on the availability of one or the other; however, this does not address the problem of varying iconv support of (and names for) character encodings.

... in preparation for `-finput-charset` and `-fexec-charset` tests that
rely on the availability of one or the other; however, this does not
address the problem of varying `iconv` support of (and names for)
character encodings.

Co-authored-by: Abhina Sreeskantharajan <Abhina.Sreeskantharajan@ibm.com>
@llvmbot llvmbot added cmake Build system in general and CMake in particular clang Clang issues not falling into any other category llvm-lit testing-tools labels Sep 17, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 17, 2025

@llvm/pr-subscribers-clang

Author: Hubert Tong (hubert-reinterpretcast)

Changes

... in preparation for -finput-charset and -fexec-charset tests that rely on the availability of one or the other; however, this does not address the problem of varying iconv support of (and names for) character encodings.


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

4 Files Affected:

  • (modified) clang/test/CMakeLists.txt (+2)
  • (modified) clang/test/lit.site.cfg.py.in (+2)
  • (modified) llvm/cmake/config-ix.cmake (+2)
  • (modified) llvm/utils/lit/lit/llvm/config.py (+6)
diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index e9f4f83f98923..cf746367202ad 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -16,6 +16,8 @@ llvm_canonicalize_cmake_booleans(
   LLVM_BUILD_EXAMPLES
   LLVM_BYE_LINK_INTO_TOOLS
   LLVM_ENABLE_PLUGINS
+  HAVE_ICU
+  HAVE_ICONV
   LLVM_ENABLE_ZLIB
   LLVM_ENABLE_ZSTD
   LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index f50953a93a412..c6d2164a5041c 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -18,6 +18,8 @@ config.clang_lib_dir = path(r"@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
 config.host_triple = "@LLVM_HOST_TRIPLE@"
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
+config.have_icu = @HAVE_ICU@
+config.have_iconv = @HAVE_ICONV@
 config.have_zlib = @LLVM_ENABLE_ZLIB@
 config.have_zstd = @LLVM_ENABLE_ZSTD@
 config.clang_objc_rewriter = @CLANG_ENABLE_OBJC_REWRITER@
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index ed2bfa6df68f4..ebc2a7c6cf890 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -310,6 +310,7 @@ if (LLVM_ENABLE_ICU STREQUAL FORCE_ON AND LLVM_ENABLE_ICONV STREQUAL FORCE_ON)
 endif()
 
 # Check for ICU. Only allow an optional, dynamic link for ICU so we don't impact LLVM's licensing.
+set(HAVE_ICU 0)
 if(LLVM_ENABLE_ICU AND NOT(LLVM_ENABLE_ICONV STREQUAL FORCE_ON))
   set(LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
   set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}")
@@ -326,6 +327,7 @@ if(LLVM_ENABLE_ICU AND NOT(LLVM_ENABLE_ICONV STREQUAL FORCE_ON))
 endif()
 
 # Check only for builtin iconv to avoid licensing issues.
+set(HAVE_ICONV 0)
 if(LLVM_ENABLE_ICONV AND NOT HAVE_ICU)
   if (LLVM_ENABLE_ICONV STREQUAL FORCE_ON)
     find_package(Iconv REQUIRED)
diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index 2f2df68ac0cff..b2f5e0f965940 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -145,6 +145,12 @@ def __init__(self, lit_config, config):
         have_zstd = getattr(config, "have_zstd", None)
         if have_zstd:
             features.add("zstd")
+        have_icu = getattr(config, "have_icu", None)
+        if have_icu:
+            features.add("icu")
+        have_iconv = getattr(config, "have_iconv", None)
+        if have_iconv:
+            features.add("iconv")
 
         if getattr(config, "reverse_iteration", None):
             features.add("reverse_iteration")

@llvmbot
Copy link
Member

llvmbot commented Sep 17, 2025

@llvm/pr-subscribers-testing-tools

Author: Hubert Tong (hubert-reinterpretcast)

Changes

... in preparation for -finput-charset and -fexec-charset tests that rely on the availability of one or the other; however, this does not address the problem of varying iconv support of (and names for) character encodings.


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

4 Files Affected:

  • (modified) clang/test/CMakeLists.txt (+2)
  • (modified) clang/test/lit.site.cfg.py.in (+2)
  • (modified) llvm/cmake/config-ix.cmake (+2)
  • (modified) llvm/utils/lit/lit/llvm/config.py (+6)
diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index e9f4f83f98923..cf746367202ad 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -16,6 +16,8 @@ llvm_canonicalize_cmake_booleans(
   LLVM_BUILD_EXAMPLES
   LLVM_BYE_LINK_INTO_TOOLS
   LLVM_ENABLE_PLUGINS
+  HAVE_ICU
+  HAVE_ICONV
   LLVM_ENABLE_ZLIB
   LLVM_ENABLE_ZSTD
   LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index f50953a93a412..c6d2164a5041c 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -18,6 +18,8 @@ config.clang_lib_dir = path(r"@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
 config.host_triple = "@LLVM_HOST_TRIPLE@"
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
+config.have_icu = @HAVE_ICU@
+config.have_iconv = @HAVE_ICONV@
 config.have_zlib = @LLVM_ENABLE_ZLIB@
 config.have_zstd = @LLVM_ENABLE_ZSTD@
 config.clang_objc_rewriter = @CLANG_ENABLE_OBJC_REWRITER@
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index ed2bfa6df68f4..ebc2a7c6cf890 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -310,6 +310,7 @@ if (LLVM_ENABLE_ICU STREQUAL FORCE_ON AND LLVM_ENABLE_ICONV STREQUAL FORCE_ON)
 endif()
 
 # Check for ICU. Only allow an optional, dynamic link for ICU so we don't impact LLVM's licensing.
+set(HAVE_ICU 0)
 if(LLVM_ENABLE_ICU AND NOT(LLVM_ENABLE_ICONV STREQUAL FORCE_ON))
   set(LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
   set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}")
@@ -326,6 +327,7 @@ if(LLVM_ENABLE_ICU AND NOT(LLVM_ENABLE_ICONV STREQUAL FORCE_ON))
 endif()
 
 # Check only for builtin iconv to avoid licensing issues.
+set(HAVE_ICONV 0)
 if(LLVM_ENABLE_ICONV AND NOT HAVE_ICU)
   if (LLVM_ENABLE_ICONV STREQUAL FORCE_ON)
     find_package(Iconv REQUIRED)
diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index 2f2df68ac0cff..b2f5e0f965940 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -145,6 +145,12 @@ def __init__(self, lit_config, config):
         have_zstd = getattr(config, "have_zstd", None)
         if have_zstd:
             features.add("zstd")
+        have_icu = getattr(config, "have_icu", None)
+        if have_icu:
+            features.add("icu")
+        have_iconv = getattr(config, "have_iconv", None)
+        if have_iconv:
+            features.add("iconv")
 
         if getattr(config, "reverse_iteration", None):
             features.add("reverse_iteration")

Copy link
Contributor

@abhina-sree abhina-sree left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category cmake Build system in general and CMake in particular llvm-lit testing-tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants