Files
swift-mirror/test/DebugInfo/file_compilation_dir_windows.swift
Pofat 96231e2d5f Support -file-compilation-dir (#40735)
This PR adds a new flag -file-compilation-dir, which does the same thing as -ffile-compilation-dir in Clang.

swiftc -g -ffile-compilation-dir=. path/to/foo.swift gives us identical debug info paths regardless of what location we compiled the file from. It's useful to debug correctly using object files built on different machines in different locations.
There's also a long-existed TODO comment.

Resolves SR-5694
2022-01-27 20:56:10 -08:00

21 lines
946 B
Swift

// REQUIRES: OS=windows-msvc
// RUN: %target-swiftc_driver -g \
// RUN: -c -file-compilation-dir Z:\path\to \
// RUN: %s -o - -emit-ir | %FileCheck --check-prefix=CHECK-ABS %s
// RUN: %empty-directory(%t)
// RUN: mkdir -p %t
// RUN: cd %t
// RUN: xcopy %s .
// RUN: %target-swiftc_driver -g \
// RUN: -c -file-compilation-dir Z:\path\to \
// RUN: file_compilation_dir_windows.swift -o - -emit-ir | %FileCheck --check-prefix=CHECK-REL %s
// RUN: %target-swiftc_driver -g \
// RUN: -c -file-compilation-dir . \
// RUN: file_compilation_dir_windows.swift -o - -emit-ir | %FileCheck --check-prefix=CHECK-REL-CWD %s
func foo() {}
// CHECK-ABS: !DIFile(filename: "{{[a-zA-Z]:\\\\.*\\\\}}file_compilation_dir_windows.swift", directory: "Z:\\path\\to")
// CHECK-REL: !DIFile(filename: "file_compilation_dir_windows.swift", directory: "Z:\\path\\to")
// CHECK-REL-CWD: !DIFile(filename: "file_compilation_dir_windows.swift", directory: ".")