Search code examples
c++llvmllvm-clanginclude-guardsclang-tidy

What is proper LLVM header guard style?


In clang tidy, the check [llvm-header-guard] looks for LLVM style header guards, but I can't find any examples of proper LLVM header guard style, specifically the structure of the name given to the define, the coding standards pages does not mention anything.


Solution

  • Looking at the unit tests:

    it seems to accept a few variations on the commonly used patterns. For a file named include/llvm/ADT/foo.h the convention seems to be:

    #ifndef LLVM_ADT_FOO_H
    #define LLVM_ADT_FOO_H
    //...
    #endif // LLVM_ADT_FOO_H