diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp b/clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp index 8f8bd7a..53c1e3c 100644 --- a/clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp +++ b/clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp @@ -8,6 +8,7 @@ #include "HeaderGuardCheck.h" #include "clang/Tooling/Tooling.h" +#include "llvm/Support/Path.h" namespace clang { namespace tidy { @@ -21,6 +22,10 @@ std::string LLVMHeaderGuardCheck::getHeaderGuard(StringRef Filename, StringRef OldGuard) { std::string Guard = tooling::getAbsolutePath(Filename); + // When running under Windows, need to convert the path separators from + // `\` to `/`. + Guard = llvm::sys::path::convert_to_slash(Guard); + // Sanitize the path. There are some rules for compatibility with the historic // style in include/llvm and include/clang which we want to preserve. |