forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang][lex] Fix non-portability diagnostics with absolute path (llvm…
…#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
- Loading branch information
1 parent
2a8f40d
commit f0691bc
Showing
2 changed files
with
28 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// 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" |