Search code examples
c++llvmheader-filespragmaclang-tidy

How can I tell clang-tidy to check for pragma once instead of llvm-style header guards?


I would like to use clan-tidy. The program should check if I do have header guards, which is why I set the flag llvm-header-guard. Unfortunately this checks if the header guards are llvm-style, which I don't want. I want to use #pragma once.

Does anyone have an idea how to tell clang-tidy to check for #pragma once instead of llvm-style header guards?


Solution

  • There is no such check in clang-tidy.

    #pragma once is not part of the C++ standard (for good reasons) and until it becomes a part of the standard there is no reason to add it to clang-tidy.

    You can write your own check but I don't think it's worth the effort.