[clang-tools-extra] clang tidy: add header ignore option to include duplicate files (PR #167046)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 8 12:55:12 PST 2025


================
@@ -33,3 +33,21 @@ Because of the intervening macro definitions, this code remains unchanged:
   #define NDEBUG
   #include "assertion.h"
   // ...code with assertions disabled
+
+Option: ``AllowedDuplicateIncludes``
+------------------------------------
+
+Headers listed in this option are exempt from warnings. For example:
+
+.. code-block:: c++
+
+  -config='{CheckOptions: [{key: readability-duplicate-include.AllowedDuplicateIncludes, value: "pack_begin.h,pack_end.h"}]}'
+
+This allows regex matches with ``pack_begin.h`` and ``pack_end.h`` to be included multiple times
+without triggering diagnostics.
+
+Notes
+-----
+
+- Only direct includes in the current translation unit are checked.
+- Useful for removing redundant includes and improving compile times in large codebases.
----------------
vbvictor wrote:

Wrong option formatting, please see how other documents with options are formatted

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


More information about the cfe-commits mailing list