Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Clang] Restore replace_path_prefix instead of startswith
In D49466, sys::path::replace_path_prefix was used instead startswith for -f[macro/debug/file]-prefix-map options. However those were reverted later (commit rG3bb24bf25767ef5bbcef958b484e7a06d8689204) due to broken Windows tests. This patch restores those replace_path_prefix calls. It also modifies the prefix matching to be case-insensitive under Windows. Differential Revision : https://reviews.llvm.org/D76869
- Loading branch information
1 parent
33d96bf
commit 7a8edcb
Showing
10 changed files
with
125 additions
and
39 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
File renamed without changes.
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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
// XFAIL: system-windows | ||
// UNSUPPORTED: system-windows | ||
// RUN: %clang -E -ffile-prefix-map=%p=/UNLIKELY_PATH/empty -c -o - %s | FileCheck %s | ||
// RUN: %clang -E -fmacro-prefix-map=%p=/UNLIKELY_PATH/empty -c -o - %s | FileCheck %s | ||
// RUN: %clang -E -fmacro-prefix-map=%p=/UNLIKELY_PATH=empty -c -o - %s | FileCheck %s -check-prefix CHECK-EVIL | ||
// RUN: %clang -E -fmacro-prefix-map=%p/= -c -o - %s | FileCheck %s --check-prefix CHECK-REMOVE | ||
|
||
filename: __FILE__ | ||
#include "file_test.h" | ||
#include "Inputs/include-file-test/file_test.h" | ||
|
||
// CHECK: filename: "/UNLIKELY_PATH/empty{{/|\\\\}}file_test.c" | ||
// CHECK: filename: "/UNLIKELY_PATH/empty{{/|\\\\}}file_test.h" | ||
// CHECK: basefile: "/UNLIKELY_PATH/empty{{/|\\\\}}file_test.c" | ||
// CHECK: filename: "/UNLIKELY_PATH/empty/file_test.c" | ||
// CHECK: filename: "/UNLIKELY_PATH/empty/Inputs/include-file-test/file_test.h" | ||
// CHECK: basefile: "/UNLIKELY_PATH/empty/file_test.c" | ||
// CHECK-NOT: filename: | ||
|
||
// CHECK-EVIL: filename: "/UNLIKELY_PATH=empty{{/|\\\\}}file_test.c" | ||
// CHECK-EVIL: filename: "/UNLIKELY_PATH=empty{{/|\\\\}}file_test.h" | ||
// CHECK-EVIL: basefile: "/UNLIKELY_PATH=empty{{/|\\\\}}file_test.c" | ||
// CHECK-EVIL: filename: "/UNLIKELY_PATH=empty/file_test.c" | ||
// CHECK-EVIL: filename: "/UNLIKELY_PATH=empty/Inputs/include-file-test/file_test.h" | ||
// CHECK-EVIL: basefile: "/UNLIKELY_PATH=empty/file_test.c" | ||
// CHECK-EVIL-NOT: filename: | ||
|
||
// CHECK-REMOVE: filename: "file_test.c" | ||
// CHECK-REMOVE: filename: "file_test.h" | ||
// CHECK-REMOVE: filename: "Inputs/include-file-test/file_test.h" | ||
// CHECK-REMOVE: basefile: "file_test.c" | ||
// CHECK-REMOVE-NOT: filename: |
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,29 @@ | ||
// REQUIRES: system-windows | ||
// RUN: %clang -E -ffile-prefix-map=%p=A:\UNLIKELY_PATH\empty -c -o - %s | FileCheck %s | ||
// RUN: %clang -E -fmacro-prefix-map=%p=A:\UNLIKELY_PATH\empty -c -o - %s | FileCheck %s | ||
// RUN: %clang -E -fmacro-prefix-map=%p=A:\UNLIKELY_PATH=empty -c -o - %s | FileCheck %s -check-prefix CHECK-EVIL | ||
// RUN: %clang -E -fmacro-prefix-map=%p/iNPUTS\=A:\UNLIKELY_PATH_INC\ -fmacro-prefix-map=%p/=A:\UNLIKELY_PATH_BASE\ -c -o - %s | FileCheck %s -check-prefix CHECK-CASE | ||
// RUN: %clang -E -fmacro-prefix-map=%p\= -c -o - %s | FileCheck %s --check-prefix CHECK-REMOVE | ||
|
||
filename: __FILE__ | ||
#include "Inputs/include-file-test/file_test.h" | ||
|
||
// CHECK: filename: "A:\\UNLIKELY_PATH\\empty\\file_test_windows.c" | ||
// CHECK: filename: "A:\\UNLIKELY_PATH\\empty/Inputs/include-file-test/file_test.h" | ||
// CHECK: basefile: "A:\\UNLIKELY_PATH\\empty\\file_test_windows.c" | ||
// CHECK-NOT: filename: | ||
|
||
// CHECK-EVIL: filename: "A:\\UNLIKELY_PATH=empty\\file_test_windows.c" | ||
// CHECK-EVIL: filename: "A:\\UNLIKELY_PATH=empty/Inputs/include-file-test/file_test.h" | ||
// CHECK-EVIL: basefile: "A:\\UNLIKELY_PATH=empty\\file_test_windows.c" | ||
// CHECK-EVIL-NOT: filename: | ||
|
||
// CHECK-CASE: filename: "A:\\UNLIKELY_PATH_BASE\\file_test_windows.c" | ||
// CHECK-CASE: filename: "A:\\UNLIKELY_PATH_INC\\include-file-test/file_test.h" | ||
// CHECK-CASE: basefile: "A:\\UNLIKELY_PATH_BASE\\file_test_windows.c" | ||
// CHECK-CASE-NOT: filename: | ||
|
||
// CHECK-REMOVE: filename: "file_test_windows.c" | ||
// CHECK-REMOVE: filename: "Inputs/include-file-test/file_test.h" | ||
// CHECK-REMOVE: basefile: "file_test_windows.c" | ||
// CHECK-REMOVE-NOT: filename: |
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
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
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