I want to use clang-tidy (LLVM v7.0.0) with the llvm-header-guard on Windows 10 with CMake for following header file
#ifndef _BAR_H_
#define _BAR_H_
namespace FOO {
namespace BAR {
class BarC {
public:
BarC() = default;
~BarC() = default;
BarC(const BarC &iValue) = delete;
const BarC &operator=(const BarC &iValue) = delete;
BarC(BarC &&iValue) = delete;
BarC &operator=(BarC &&iValue) = delete;
};
} // namespace BAR
} // namespace FOO
#endif // _BAR_H_
where the ROOT is C:\User\Zlatan\Project\Guard and the header file Bar.h is located at ROOT\Foo\Bar\src\include\Bar\Bar.h
This creates unfortunately following warning
warning: header guard does not follow preferred style [llvm-header-guard]
I read What is proper LLVM header guard style? but I didn't found the correct style with
#ifndef BAR_BAR_H
#ifndef INCLUDE_BAR_BAR_H
#ifndef SRC_INCLUDE_BAR_BAR_H
#ifndef BAR_SRC_INCLUDE_BAR_BAR_H
#ifndef FOO_BAR_SRC_INCLUDE_BAR_BAR_H
#ifndef C_USERS_ZLATAN_PROJECT_GUARD_FOO_BAR_SRC_INCLUDE_BAR_BAR_H
and received for all again
warning: header guard does not follow preferred style [llvm-header-guard]
What is the correct style for my use case? Do I have to configure something in CMake (already use CMAKE_EXPORT_COMPILE_COMMANDS=ON)?
Update
Running
cd C:/Users/Zlatan/Project/Guard/build/Release
clang-tidy -checks='llvm-header-guard' -header-filter=.* -p=. ../../Foo/Bar/src/Bar.cpp
as suggested in cmd generates following output
C:\Users\Zlatan\Project\Guard\build\Release\../../Foo/Bar/src/include/Bar/Bar.h: warning: header guard does not follow preferred style [llvm-header-guard]
#ifndef BAR_BAR_H
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\USERS\ZLATAN\PROJECT\GUARD\BUILD\RELEASE\__\__\FOO\BAR\SRC\INCLUDE\BAR\BAR_H
Best regards Zlatan