[llvm] [Support] Add IWYU pragma (PR #117001)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 08:22:27 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

The pragma prevents clang-tidy's misc-include-cleaner from reporting
that Allocator.h is not used.  Note that we need the header for
safe_malloc on macos.


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


1 Files Affected:

- (modified) llvm/lib/Support/RWMutex.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/Support/RWMutex.cpp b/llvm/lib/Support/RWMutex.cpp
index 4294c4356f4762..bc17fe6ba084cc 100644
--- a/llvm/lib/Support/RWMutex.cpp
+++ b/llvm/lib/Support/RWMutex.cpp
@@ -13,7 +13,7 @@
 #include "llvm/Support/RWMutex.h"
 #include "llvm/Config/config.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_THREADS
-#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Allocator.h"  // IWYU pragma: keep
 
 #if defined(LLVM_USE_RW_MUTEX_IMPL)
 using namespace llvm;

``````````

</details>


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


More information about the llvm-commits mailing list