[libcxx-commits] [libcxx] [RFC][libc++] Use IWYU pragma's. (PR #102191)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 6 11:00:34 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Mark de Wever (mordante)

<details>
<summary>Changes</summary>

The tools IWYU/clangd can suggest to remove unused headers. This suggests to remove test_macros.h. Removing this header can break tests.

For example tests use
   #ifndef TEST_HAS_NO_WIDE_CHARACTERS
     test<wchar_t>();
   #endif

Since typically developers have wide characters the header is not used. The removal of the header breaks configurations that have wide characters disabled.

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


1 Files Affected:

- (modified) libcxx/test/support/test_macros.h (+6) 


``````````diff
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index 15fc5b69b52076..9dab5750a5f917 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -7,6 +7,12 @@
 //
 //===----------------------------------------------------------------------===//
 
+// This header contains several configuration defines.
+// Removing the header would #ifndef TEST_FOO to unconditionally pass when
+// it's optionally defined in this header.
+//
+// IWYU pragma: always_keep
+
 #ifndef SUPPORT_TEST_MACROS_HPP
 #define SUPPORT_TEST_MACROS_HPP
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/102191


More information about the libcxx-commits mailing list