diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2024-01-05 22:41:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-05 22:41:51 +0100 |
commit | 853b13342a131e06d61293ec6e840642054c6c85 (patch) | |
tree | 5e26b181aa045cefc29109dd1f6694e880c766d0 | |
parent | d9c8edf08afce3d1e563e4521ae847a6809bb993 (diff) |
[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.
-rw-r--r-- | clang/test/Lexer/case-insensitive-include-absolute.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/Lexer/case-insensitive-include-absolute.c b/clang/test/Lexer/case-insensitive-include-absolute.c index 6247e4808c7f..ef9e131c45df 100644 --- a/clang/test/Lexer/case-insensitive-include-absolute.c +++ b/clang/test/Lexer/case-insensitive-include-absolute.c @@ -1,8 +1,8 @@ // REQUIRES: case-insensitive-filesystem // RUN: rm -rf %t && split-file %s %t -// RUN: sed "s|DIR|%/t|g" %t/tu.c.in > %t/tu.c -// RUN: %clang_cc1 -fsyntax-only %t/tu.c 2>&1 | FileCheck %s --DDIR=%/t +// RUN: sed "s|DIR|%{/t:real}|g" %t/tu.c.in > %t/tu.c +// RUN: %clang_cc1 -fsyntax-only %t/tu.c 2>&1 | FileCheck %s -DDIR=%{/t:real} //--- header.h //--- tu.c.in |