[PATCH] D115715: [clang-tidy] Fix llvm-header-guard for Windows paths containing drive letter (e.g. C:).

Salman Javed via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 14 02:15:58 PST 2021


salman-javed-nz added a comment.

The problem at the root of all this is that llvm-header-guard isn't written flexible enough to support non-LLVM project structures.

See https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp#L44

For a path like `C:\llvm-project\path\to\file`, the `llvm-project` portion is replaced with `llvm` to give `C:\llvm\path\to\file`, then a `substr()` call strips everything up to and including `lvm`, resulting in `path\to\file`.
The path separators and replaced with underscores, resulting in `PATH_TO_FILE`.

The whole check falls apart if it can't find strings like "llvm-project" in the path.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115715/new/

https://reviews.llvm.org/D115715



More information about the cfe-commits mailing list