[clang-tools-extra] added option `llvm-header-guard.HeaderDirs` (PR #176940)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 21 05:36:58 PST 2026


vbvictor wrote:

> As it is said in [#71732 (comment)](https://github.com/llvm/llvm-project/issues/71732#issuecomment-1850372207) , this check is designed only for llvm-project. ~We~ I will not accept this patch because we don't need this option. But you can

I agree, before exposing this check to wider audience and adding user-options we should extract a new generic `readability`/`misc` check that will not have LLVM-hardcoded values in it.
Looking at check code, we already have `utils::HeaderGuardCheck` so I suppose it will not be hard to create a new check from it.


> 3. Redirect llvm-header-guard to the new check with specified options (You can refer to cert-dcl16-c).

We may not need to redirect a new check if the new check will be just derived from `utils::HeaderGuardCheck`. LLVMHeaderGuard itself is ~60 lines long so It may not be worth to decompose everything into options. (but I didn't look closely on how generic `utils::HeaderGuardCheck` is and can it be used to create other checks)


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


More information about the cfe-commits mailing list