Files
clang-p2996/clang/test/Lexer/case-insensitive-include-absolute.c
Jan Svoboda f0691bcdf9 [clang][lex] Fix non-portability diagnostics with absolute path (#74782)
The existing code incorrectly assumes that `Path` can be empty. It
can't, it always contains at least `<` or `"`. On Unix, this patch fixes
an incorrect diagnostics that instead of `"/Users/blah"` suggested
`"Userss/blah"`. In assert builds, this would outright crash.

This patch also fixes a bug on Windows that would prevent the diagnostic
being triggered due to separator mismatch.

rdar://91172342
2023-12-18 12:11:27 -08:00

14 lines
564 B
C

// 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
//--- header.h
//--- tu.c.in
#import "DIR/Header.h"
// CHECK: tu.c:1:9: warning: non-portable path to file '"[[DIR]]/header.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
// CHECK-NEXT: 1 | #import "[[DIR]]/Header.h"
// CHECK-NEXT: | ^~~~~~~~~~~~~~~~~~
// CHECK-NEXT: | "[[DIR]]/header.h"