[libc-commits] [libc] [libc][clang-tidy] Add llvm-header-guard to get consistant naming and prevent file copy/paste issues. (PR #66477)

Siva Chandra via libc-commits libc-commits at lists.llvm.org
Wed Sep 20 11:29:53 PDT 2023


sivachandra wrote:

> The goal of this particular patch is to enable `clang-tidy` to make sure sources under `libc/src` have properly formatted header guards. Let me know if you believe they should start with `__` if so I'll create a new `clang-tidy` to enforce this rule.

If `include` and/or `${LIBC_INCLUDE_DIR}` are beyond the scope of this change, then we can discuss that topic separately.

> EDIT: Question, the `__` prefix is mandatory for headers in both `include/*` and `src/*` because the libc can be compiled as part of a wider binary? Or only for `include/*`?

This is only for the `include` directory (which means, for `${LIBC_INCLUDE_DIR}` directory). Even if libc is compiled as part of the wider binary, the user source code for that binary will not include libc-internal headers and hence we do not have to worry about user code pollution.

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


More information about the libc-commits mailing list