[all-commits] [llvm/llvm-project] 853b13: [clang] Fix test for case-insensitive absolute inc...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Fri Jan 5 13:42:04 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 853b13342a131e06d61293ec6e840642054c6c85
      https://github.com/llvm/llvm-project/commit/853b13342a131e06d61293ec6e840642054c6c85
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2024-01-05 (Fri, 05 Jan 2024)

  Changed paths:
    M clang/test/Lexer/case-insensitive-include-absolute.c

  Log Message:
  -----------
  [clang] Fix test for case-insensitive absolute includes (#76985)

When CMake on Windows is told to generate the build into a directory
whose real path has a different drive letter (e.g. due to a symlink),
the "clang/test/Lexer/case-insensitive-include-absolute.c" test fails.
That happens because because `trySimplifyPath()` in `PPDirectives.cpp`
finds out there's more than a case difference between the `#include`
path (containing `%/t`) and the real path, which prevents the diagnostic
to fire.

I thought this is only an issue on Windows due to the fact that LIT does
not drag the path to the build directory through `os.path.realpath()`
like it does on other systems (see `abs_path_preserve_drive()` in
"llvm/utils/lit/lit/util.py"). However, even after only using
`os.path.abspath()` on a Unix system, build generated into a symlinked
directory tests correctly. I assume there must be something else at
play, but I don't have the time to dig deeper.

The fix is is fairly straightforward: use the real path in the
`#include` (with `%{/t:real}`), which removes the non-case difference
and unblocks the diagnostic.




More information about the All-commits mailing list