diff --git a/clang/test/CodeGen/debug-prefix-map.c b/clang/test/CodeGen/debug-prefix-map.c --- a/clang/test/CodeGen/debug-prefix-map.c +++ b/clang/test/CodeGen/debug-prefix-map.c @@ -1,10 +1,10 @@ -// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - | FileCheck %s -check-prefix CHECK-NO-MAIN-FILE-NAME -// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=/UNLIKELY_PATH=empty %s -emit-llvm -o - | FileCheck %s -check-prefix CHECK-EVIL -// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - -main-file-name debug-prefix-map.c | FileCheck %s -// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - -fdebug-compilation-dir %p | FileCheck %s -check-prefix CHECK-COMPILATION-DIR -// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - -isysroot %p -debugger-tuning=lldb | FileCheck %s -check-prefix CHECK-SYSROOT -// RUN: %clang -g -fdebug-prefix-map=%p=/UNLIKELY_PATH/empty -S -c %s -emit-llvm -o - | FileCheck %s -// RUN: %clang -g -ffile-prefix-map=%p=/UNLIKELY_PATH/empty -S -c %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=%{rootsep}UNLIKELY_PATH%{sep}empty %s -emit-llvm -o - | FileCheck %s -check-prefix CHECK-NO-MAIN-FILE-NAME +// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=%{rootsep}UNLIKELY_PATH=empty %s -emit-llvm -o - | FileCheck %s -check-prefix CHECK-EVIL +// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=%{rootsep}UNLIKELY_PATH%{sep}empty %s -emit-llvm -o - -main-file-name debug-prefix-map.c | FileCheck %s +// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=%{rootsep}UNLIKELY_PATH%{sep}empty %s -emit-llvm -o - -fdebug-compilation-dir %p | FileCheck %s -check-prefix CHECK-COMPILATION-DIR +// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=%{rootsep}UNLIKELY_PATH%{sep}empty %s -emit-llvm -o - -isysroot %p -debugger-tuning=lldb | FileCheck %s -check-prefix CHECK-SYSROOT +// RUN: %clang -g -fdebug-prefix-map=%p=%{rootsep}UNLIKELY_PATH%{sep}empty -S -c %s -emit-llvm -o - | FileCheck %s +// RUN: %clang -g -ffile-prefix-map=%p=%{rootsep}UNLIKELY_PATH%{sep}empty -S -c %s -emit-llvm -o - | FileCheck %s #include "Inputs/stdio.h" @@ -19,26 +19,26 @@ vprintf("string", argp); } -// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|\\\\}}" -// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|\\\\}}{{.*}}", +// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "{{/|C:\\\\|()}}UNLIKELY_PATH{{/|\\\\}}empty{{/|\\\\}}" +// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "{{/|C:\\\\|()}}UNLIKELY_PATH{{/|\\\\}}empty{{/|\\\\}}{{.*}}", // On POSIX systems "Dir" should actually be empty, but on Windows we // can't recognize "/UNLIKELY_PATH" as being an absolute path. // CHECK-NO-MAIN-FILE-NAME-SAME: directory: "{{()|(.*:.*)}}") -// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|\\\\}}Inputs/stdio.h", +// CHECK-NO-MAIN-FILE-NAME: !DIFile(filename: "{{/|C:\\\\|()}}UNLIKELY_PATH{{/|\\\\}}empty{{/|\\\\}}Inputs{{/|\\\\}}stdio.h", // CHECK-NO-MAIN-FILE-NAME-SAME: directory: "{{()|(.*:.*)}}") // CHECK-NO-MAIN-FILE-NAME-NOT: !DIFile(filename: -// CHECK-EVIL: !DIFile(filename: "/UNLIKELY_PATH=empty{{/|\\\\}}{{.*}}" -// CHECK-EVIL: !DIFile(filename: "/UNLIKELY_PATH=empty{{/|\\\\}}{{.*}}Inputs/stdio.h", +// CHECK-EVIL: !DIFile(filename: "{{/|C:\\\\|()}}UNLIKELY_PATH=empty{{/|\\\\}}{{.*}}" +// CHECK-EVIL: !DIFile(filename: "{{/|C:\\\\|()}}UNLIKELY_PATH=empty{{/|\\\\}}{{.*}}Inputs{{/|\\\\}}stdio.h", // CHECK-EVIL-SAME: directory: "{{()|(.*:.*)}}") // CHECK-EVIL-NOT: !DIFile(filename: -// CHECK: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|\\\\}}{{.*}}" -// CHECK: !DIFile(filename: "/UNLIKELY_PATH/empty{{/|\\\\}}{{.*}}Inputs/stdio.h", +// CHECK: !DIFile(filename: "{{/|C:\\\\|()}}UNLIKELY_PATH{{/|\\\\}}empty{{/|\\\\}}{{.*}}" +// CHECK: !DIFile(filename: "{{/|C:\\\\|()}}UNLIKELY_PATH{{/|\\\\}}empty{{/|\\\\}}{{.*}}Inputs{{/|\\\\}}stdio.h", // CHECK-SAME: directory: "{{()|(.*:.*)}}") // CHECK-NOT: !DIFile(filename: -// CHECK-COMPILATION-DIR: !DIFile(filename: "{{.*}}", directory: "/UNLIKELY_PATH/empty") -// CHECK-COMPILATION-DIR: !DIFile(filename: "{{.*}}Inputs/stdio.h", directory: "/UNLIKELY_PATH/empty") +// CHECK-COMPILATION-DIR: !DIFile(filename: "{{.*}}", directory: "{{/|C:\\\\}}UNLIKELY_PATH{{/|\\\\}}empty") +// CHECK-COMPILATION-DIR: !DIFile(filename: "{{.*}}Inputs{{/|\\\\}}stdio.h", directory: "{{/|C:\\\\}}UNLIKELY_PATH{{/|\\\\}}empty") // CHECK-COMPILATION-DIR-NOT: !DIFile(filename: -// CHECK-SYSROOT: !DICompileUnit({{.*}}sysroot: "/UNLIKELY_PATH/empty" +// CHECK-SYSROOT: !DICompileUnit({{.*}}sysroot: "{{/|C:\\\\}}UNLIKELY_PATH{{/|\\\\}}empty" diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py --- a/clang/test/lit.cfg.py +++ b/clang/test/lit.cfg.py @@ -56,6 +56,16 @@ config.substitutions.append(('%PATH%', config.environment['PATH'])) +if platform.system() == 'Windows': + root_sep = 'C:\\' +else: + root_sep = os.path.sep + +config.substitutions.extend([ + ('%{rootsep}', root_sep), + ('%{sep}', os.path.sep), +]) + # For each occurrence of a clang tool name, replace it with the full path to # the build directory holding that tool. We explicitly specify the directories # to search to ensure that we get the tools just built and not some random