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

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 08:21:47 PST 2024


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

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.


>From 0a21e2ffc6d0661a8d6a5e896c5e0da2ecf8cf73 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 20 Nov 2024 08:17:10 -0800
Subject: [PATCH] [Support] Add IWYU pragma

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.
---
 llvm/lib/Support/RWMutex.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;



More information about the llvm-commits mailing list