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.
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
- What is the correct way to declare and use a FILE
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:Presumably the LLVM codebase adheres to the LLVM coding standards, so one can simply look at a few LLVM header files to get an idea of what the guard looks like. Here are some random LLVM header files I looked at:
https://github.com/llvm-mirror/llvm/blob/master/include/llvm/CodeGen/SelectionDAG.h
https://github.com/llvm-mirror/llvm/blob/master/include/llvm/Support/AlignOf.h
Based on those files, I think the header guard looks like this:
The proper style for LLVM to detect and be happy with your header is to take the path used to include your header, convert it to uppercase, replace directory separators with underscores, and replace dots in file extensions with underscores.
For instance, if you use
#include <dopelib/dopestuff/whatitisyo.h>
, your header would be:Hope this helps!