diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -444,6 +444,12 @@ StringRef Dir; StringRef File; std::string RemappedFile = remapDIPath(FileName); +#ifdef _WIN32 + // Convert RemappedFile to native style when Windows + SmallString<128> NativeFileName = StringRef(RemappedFile); + llvm::sys::path::native(NativeFileName); + RemappedFile = (std::string)NativeFileName.str(); +#endif std::string CurDir = remapDIPath(getCurrentDirname()); SmallString<128> DirBuf; SmallString<128> FileBuf; @@ -618,9 +624,16 @@ // file was specified with an absolute path. if (CSKind) CSInfo.emplace(*CSKind, Checksum); - llvm::DIFile *CUFile = DBuilder.createFile( - remapDIPath(MainFileName), remapDIPath(getCurrentDirname()), CSInfo, - getSource(SM, SM.getMainFileID())); + MainFileName = remapDIPath(MainFileName); +#ifdef _WIN32 + // Convert MainFileName to native style when windows + SmallString<128> NativeMainFileName = (StringRef)MainFileName; + llvm::sys::path::native(NativeMainFileName); + MainFileName = (std::string)NativeMainFileName.str(); +#endif + llvm::DIFile *CUFile = + DBuilder.createFile(MainFileName, remapDIPath(getCurrentDirname()), + CSInfo, getSource(SM, SM.getMainFileID())); StringRef Sysroot, SDK; if (CGM.getCodeGenOpts().getDebuggerTuning() == llvm::DebuggerKind::LLDB) { diff --git a/clang/test/CodeGen/debug-info-preprocessed-file.i b/clang/test/CodeGen/debug-info-preprocessed-file.i --- a/clang/test/CodeGen/debug-info-preprocessed-file.i +++ b/clang/test/CodeGen/debug-info-preprocessed-file.i @@ -1,3 +1,4 @@ +// UNSUPPORTED: system-windows # 1 "/foo/bar/preprocessed-input.c" # 1 "" 1 # 1 "" 3 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,3 +1,4 @@ +// UNSUPPORTED: system-windows // 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 diff --git a/clang/test/CodeGenCXX/debug-info-mingw.cpp b/clang/test/CodeGenCXX/debug-info-mingw.cpp new file mode 100644 --- /dev/null +++ b/clang/test/CodeGenCXX/debug-info-mingw.cpp @@ -0,0 +1,9 @@ +// UNSUPPORTED: !system-windows +// RUN: rm -rf %t/UNIQUE_DIR && mkdir -p %t/UNIQUE_DIR +// RUN: cp %s %t/UNIQUE_DIR/debug-info-mingw.cpp +// RUN: %clang_cc1 -triple x86_64-w64-windows-gnu -debug-info-kind=limited \ +// RUN: -main-file-name debug-info-mingw.cpp %t/UNIQUE_DIR/debug-info-mingw.cpp \ +// RUN: -emit-llvm -o - | FileCheck %s +int main() { +} +// CHECK: !DIFile(filename: "{{.+}}\\UNIQUE_DIR\\debug-info-mingw.cpp", diff --git a/clang/test/CodeGenCXX/linetable-fnbegin.cpp b/clang/test/CodeGenCXX/linetable-fnbegin.cpp --- a/clang/test/CodeGenCXX/linetable-fnbegin.cpp +++ b/clang/test/CodeGenCXX/linetable-fnbegin.cpp @@ -1,3 +1,4 @@ +// UNSUPPORTED: system-windows // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s // Test that the line table info for Foo::bar() is pointing to the // right header file. @@ -11,7 +12,6 @@ // We shouldn't need a lexical block for this function. // CHECK: [[DBG]] = !DILocation(line: 23, column: 3, scope: [[SP]]) - # 1 "./template.h" 1 template class Foo { diff --git a/clang/test/Frontend/optimization-remark-line-directive.c b/clang/test/Frontend/optimization-remark-line-directive.c --- a/clang/test/Frontend/optimization-remark-line-directive.c +++ b/clang/test/Frontend/optimization-remark-line-directive.c @@ -1,3 +1,4 @@ +// UNSUPPORTED: system-windows // This file tests -Rpass diagnostics together with #line // directives. We cannot map #line directives back to // a SourceLocation. diff --git a/clang/test/Frontend/stdin-input.c b/clang/test/Frontend/stdin-input.c --- a/clang/test/Frontend/stdin-input.c +++ b/clang/test/Frontend/stdin-input.c @@ -1,3 +1,4 @@ +// UNSUPPORTED: system-windows // RUN: cat %s | %clang -emit-llvm -g -S \ // RUN: -Xclang -main-file-name -Xclang test/foo.c -x c - -o - | FileCheck %s // CHECK: ; ModuleID = 'test/foo.c' diff --git a/clang/test/Modules/module-debuginfo-prefix.m b/clang/test/Modules/module-debuginfo-prefix.m --- a/clang/test/Modules/module-debuginfo-prefix.m +++ b/clang/test/Modules/module-debuginfo-prefix.m @@ -1,3 +1,4 @@ +// UNSUPPORTED: system-windows // REQUIRES: asserts // Modules: diff --git a/clang/test/PCH/debug-info-pch-container-path.c b/clang/test/PCH/debug-info-pch-container-path.c --- a/clang/test/PCH/debug-info-pch-container-path.c +++ b/clang/test/PCH/debug-info-pch-container-path.c @@ -1,3 +1,4 @@ +// UNSUPPORTED: system-windows // REQUIRES: asserts // Modules: