[clang-tidy] Fix llvm-header-guard so that it works with Windows paths
authorSalman Javed <mail@salmanjaved.org>
Wed, 10 Nov 2021 05:34:41 +0000 (18:34 +1300)
committerSalman Javed <mail@salmanjaved.org>
Wed, 10 Nov 2021 05:35:57 +0000 (18:35 +1300)
commitb4f6f1c9369ec4bb1c10852283a8c7e8c39e1a8d
tree1c749c29defbae5fe1e720f6c72ab439a2e63e63
parent577c1eecf8c4b078eecb57e1c5b8d86adfc3c08a
[clang-tidy] Fix llvm-header-guard so that it works with Windows paths

Fixes pr40372 (https://bugs.llvm.org/show_bug.cgi?id=40372).

The llvm-header-guard check does not take into account that the path
separator on Windows is `\`, not `/`.

This means that instead of suggesting a header guard in the form of:
LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_FOO_H

it incorrectly suggests:
C:\LLVM_PROJECT\CLANG_TOOLS_EXTRA\CLANG_TIDY\FOO_H

Differential Revision: https://reviews.llvm.org/D113450
clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp
clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp