[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
Mon Sep 18 12:39:47 PDT 2023


sivachandra wrote:

> * What are the rules for formatting headers in `include`? (I couldn't find the documentation)

We are not uniform, but I think we should follow this:

`__LLVM_LIBC_<FILE_NAME_IN_UPPER_SNAKE_CASE>_H__`

For header files in nested directories:

`__LLVM_LIBC_<RELATIVE_PATH_TO_DIR_IN_UPPER_SNAKE_CASE>_<FILE_NAME_IN_UPPER_SNAKE_CASE>_H__`

> * What should we do for directories starting with two underscores? Currently `llvm-header-guard` suggests the following edits but I think it doesn't really add any value.

Just putting the file name as is, including the double-underscores, seems fine to me. The header guards don't really come in the way of almost anything.


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


More information about the libc-commits mailing list