diff options
| author | Fangrui Song <i@maskray.me> | 2023-04-25 15:12:17 -0700 |
|---|---|---|
| committer | Fangrui Song <i@maskray.me> | 2023-04-25 15:12:17 -0700 |
| commit | daad48d6b236d74c6b29daebba46289b98104241 (patch) | |
| tree | ab1e8214d46ecacfb69c6241a6a9a6085f14d793 /clang/test/CodeGen/debug-prefix-map.c | |
| parent | a79e9096ca7659dd2d3b0a297ef0be3e5725530c (diff) | |
-fdebug-prefix-map=: make the last win when multiple prefixes match
For
`clang -c -g -fdebug-prefix-map=a/b=y -fdebug-prefix-map=a=x a/b/c.c`,
we apply the longest prefix substitution, but
GCC has always been picking the last applicable option (`a=x`, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109591).
I feel that GCC's behavior is reasonable given the convention that the last
value wins for the same option.
Before D49466, Clang appeared to apply the shortest prefix substitution,
which likely made the least sense.
Reviewed By: #debug-info, scott.linder
Differential Revision: https://reviews.llvm.org/D148975
Diffstat (limited to 'clang/test/CodeGen/debug-prefix-map.c')
| -rw-r--r-- | clang/test/CodeGen/debug-prefix-map.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/CodeGen/debug-prefix-map.c b/clang/test/CodeGen/debug-prefix-map.c index f604f1643ba0..e2421806b055 100644 --- a/clang/test/CodeGen/debug-prefix-map.c +++ b/clang/test/CodeGen/debug-prefix-map.c @@ -9,6 +9,10 @@ // RUN: %clang -g -fdebug-prefix-map=%p=./UNLIKELY_PATH/empty -S -c %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-REL // RUN: %clang -g -ffile-prefix-map=%p=./UNLIKELY_PATH/empty -S -c %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-REL +// RUN: rm -rf %t && mkdir -p %t/a/b && cp %s %t/a/b/c.c +// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -I%S -fdebug-prefix-map=%t/a/b=y -fdebug-prefix-map=%t/a=x %t/a/b/c.c -o - | FileCheck %s --check-prefix=CHECK-X +// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -I%S -fdebug-prefix-map=%t/a=x -fdebug-prefix-map=%t/a/b=y %t/a/b/c.c -o - | FileCheck %s --check-prefix=CHECK-Y + #include "Inputs/stdio.h" int main(int argc, char **argv) { @@ -47,3 +51,6 @@ void test_rewrite_includes(void) { // CHECK-REL: !DIFile(filename: "./UNLIKELY_PATH/empty{{/|\\\\}}{{.*}}", // CHECK-REL: !DIFile(filename: "./UNLIKELY_PATH/empty{{/|\\\\}}{{.*}}Inputs/stdio.h", // CHECK-REL-SAME: directory: "" + +// CHECK-X: !DIFile(filename: "x{{/|\\\\}}b{{/|\\\\}}c.c", directory: "") +// CHECK-Y: !DIFile(filename: "y{{/|\\\\}}c.c", directory: "") |
