Skip to content

Commit 853b133

Browse files
authored
[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.
1 parent d9c8edf commit 853b133

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/test/Lexer/case-insensitive-include-absolute.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: case-insensitive-filesystem
22

33
// RUN: rm -rf %t && split-file %s %t
4-
// RUN: sed "s|DIR|%/t|g" %t/tu.c.in > %t/tu.c
5-
// RUN: %clang_cc1 -fsyntax-only %t/tu.c 2>&1 | FileCheck %s --DDIR=%/t
4+
// RUN: sed "s|DIR|%{/t:real}|g" %t/tu.c.in > %t/tu.c
5+
// RUN: %clang_cc1 -fsyntax-only %t/tu.c 2>&1 | FileCheck %s -DDIR=%{/t:real}
66

77
//--- header.h
88
//--- tu.c.in

0 commit comments

Comments
 (0)