[PATCH] D99580: [CLANG] [DebugInfo] Convert File name to native format

2021-04-12 Thread Adrian McCarthy via Phabricator via cfe-commits
amccarth added a comment.

Sorry, I think I've lost track of some context while I was on vacation.  I 
don't understand why several of the tests are now unsupported on Windows.  Some 
of those seem like important tests.

If canonicalizing the file names to the platform's native style creates new 
test failures, then I think we need to wonder whether canonicalization is the 
right solution (and whether it's done at the right point.  If it is, then I 
think we need to find a way to make these tests work cross-platform.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99580/new/

https://reviews.llvm.org/D99580

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99580: [CLANG] [DebugInfo] Convert File name to native format

2021-04-08 Thread kamlesh kumar via Phabricator via cfe-commits
kamleshbhalui updated this revision to Diff 336057.
kamleshbhalui added a comment.

Making changes effective only for windows


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99580/new/

https://reviews.llvm.org/D99580

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-info-preprocessed-file.i
  clang/test/CodeGen/debug-prefix-map.c
  clang/test/CodeGenCXX/debug-info-mingw.cpp
  clang/test/CodeGenCXX/linetable-fnbegin.cpp
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/stdin-input.c
  clang/test/Modules/module-debuginfo-prefix.m
  clang/test/PCH/debug-info-pch-container-path.c

Index: clang/test/PCH/debug-info-pch-container-path.c
===
--- clang/test/PCH/debug-info-pch-container-path.c
+++ clang/test/PCH/debug-info-pch-container-path.c
@@ -1,3 +1,4 @@
+// UNSUPPORTED: system-windows
 // REQUIRES: asserts
 
 // Modules:
Index: clang/test/Modules/module-debuginfo-prefix.m
===
--- clang/test/Modules/module-debuginfo-prefix.m
+++ clang/test/Modules/module-debuginfo-prefix.m
@@ -1,3 +1,4 @@
+// UNSUPPORTED: system-windows
 // REQUIRES: asserts
 
 // Modules:
Index: clang/test/Frontend/stdin-input.c
===
--- clang/test/Frontend/stdin-input.c
+++ 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'
Index: clang/test/Frontend/optimization-remark-line-directive.c
===
--- clang/test/Frontend/optimization-remark-line-directive.c
+++ 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.
Index: clang/test/CodeGenCXX/linetable-fnbegin.cpp
===
--- clang/test/CodeGenCXX/linetable-fnbegin.cpp
+++ 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 {
Index: clang/test/CodeGenCXX/debug-info-mingw.cpp
===
--- /dev/null
+++ 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",
Index: clang/test/CodeGen/debug-prefix-map.c
===
--- clang/test/CodeGen/debug-prefix-map.c
+++ 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
Index: clang/test/CodeGen/debug-info-preprocessed-file.i
===
--- clang/test/CodeGen/debug-info-preprocessed-file.i
+++ 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
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ 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 = 

[PATCH] D99580: [CLANG] [DebugInfo] Convert File name to native format

2021-04-07 Thread kamlesh kumar via Phabricator via cfe-commits
kamleshbhalui added a reviewer: rnk.
kamleshbhalui added a comment.

ping?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99580/new/

https://reviews.llvm.org/D99580

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99580: [CLANG] [DebugInfo] Convert File name to native format

2021-04-02 Thread kamlesh kumar via Phabricator via cfe-commits
kamleshbhalui updated this revision to Diff 334952.
kamleshbhalui added a comment.

Making changes effective only for windows


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99580/new/

https://reviews.llvm.org/D99580

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-info-preprocessed-file.i
  clang/test/CodeGen/debug-prefix-map.c
  clang/test/CodeGenCXX/debug-info-mingw.cpp
  clang/test/CodeGenCXX/linetable-fnbegin.cpp
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/stdin-input.c
  clang/test/Modules/module-debuginfo-prefix.m
  clang/test/PCH/debug-info-pch-container-path.c

Index: clang/test/PCH/debug-info-pch-container-path.c
===
--- clang/test/PCH/debug-info-pch-container-path.c
+++ clang/test/PCH/debug-info-pch-container-path.c
@@ -1,3 +1,4 @@
+// UNSUPPORTED: system-windows
 // REQUIRES: asserts
 
 // Modules:
Index: clang/test/Modules/module-debuginfo-prefix.m
===
--- clang/test/Modules/module-debuginfo-prefix.m
+++ clang/test/Modules/module-debuginfo-prefix.m
@@ -1,3 +1,4 @@
+// UNSUPPORTED: system-windows
 // REQUIRES: asserts
 
 // Modules:
Index: clang/test/Frontend/stdin-input.c
===
--- clang/test/Frontend/stdin-input.c
+++ 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'
Index: clang/test/Frontend/optimization-remark-line-directive.c
===
--- clang/test/Frontend/optimization-remark-line-directive.c
+++ 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.
Index: clang/test/CodeGenCXX/linetable-fnbegin.cpp
===
--- clang/test/CodeGenCXX/linetable-fnbegin.cpp
+++ 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 {
Index: clang/test/CodeGenCXX/debug-info-mingw.cpp
===
--- /dev/null
+++ 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",
Index: clang/test/CodeGen/debug-prefix-map.c
===
--- clang/test/CodeGen/debug-prefix-map.c
+++ 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
Index: clang/test/CodeGen/debug-info-preprocessed-file.i
===
--- clang/test/CodeGen/debug-info-preprocessed-file.i
+++ 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
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -444,6 +444,12 @@
   StringRef Dir;
   StringRef File;
   std::string RemappedFile = remapDIPath(FileName);
+  // Convert RemappedFile to native style when Windows
+  if (CGM.getTarget().getTriple().isOSWindows()) {
+SmallString<128> NativeFileName = StringRef(RemappedFile);
+llvm::sys::path::native(NativeFileName);
+RemappedFile = 

[PATCH] D99580: [CLANG] [DebugInfo] Convert File name to native format

2021-04-01 Thread Adrian McCarthy via Phabricator via cfe-commits
amccarth added a comment.

In D99580#2660040 , @kamleshbhalui 
wrote:

> In D99580#2659858 , @amccarth wrote:
>
>> It looks like the code change is for everyone, but the new test is specific 
>> to mingw.
>
> For Linux like platform it does not create problem because input file  path 
> is already in POSIX style, so having a test case will not test the change 
> because even without the change it will pass.

The fix is on the code path for all platforms, so running the test on all 
platforms could help catch future regressions.  There could also be unusual 
cases, such as cross compiling for Linux on Windows, and thus you could have 
Windows-style paths even though the target is Posix.  Or someone might further 
refine the fix to make more cases work correctly for mingw but inadvertently 
cause problems for other platforms.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99580/new/

https://reviews.llvm.org/D99580

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99580: [CLANG] [DebugInfo] Convert File name to native format

2021-03-31 Thread kamlesh kumar via Phabricator via cfe-commits
kamleshbhalui updated this revision to Diff 334359.
kamleshbhalui added a comment.

updated patch


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99580/new/

https://reviews.llvm.org/D99580

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-info-preprocessed-file.i
  clang/test/CodeGen/debug-prefix-map.c
  clang/test/CodeGenCXX/debug-info-mingw.cpp
  clang/test/CodeGenCXX/linetable-fnbegin.cpp
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/stdin-input.c
  clang/test/Modules/module-debuginfo-prefix.m
  clang/test/PCH/debug-info-pch-container-path.c

Index: clang/test/PCH/debug-info-pch-container-path.c
===
--- clang/test/PCH/debug-info-pch-container-path.c
+++ clang/test/PCH/debug-info-pch-container-path.c
@@ -1,3 +1,4 @@
+// UNSUPPORTED: system-windows
 // REQUIRES: asserts
 
 // Modules:
Index: clang/test/Modules/module-debuginfo-prefix.m
===
--- clang/test/Modules/module-debuginfo-prefix.m
+++ clang/test/Modules/module-debuginfo-prefix.m
@@ -1,3 +1,4 @@
+// UNSUPPORTED: system-windows
 // REQUIRES: asserts
 
 // Modules:
Index: clang/test/Frontend/stdin-input.c
===
--- clang/test/Frontend/stdin-input.c
+++ 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'
Index: clang/test/Frontend/optimization-remark-line-directive.c
===
--- clang/test/Frontend/optimization-remark-line-directive.c
+++ 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.
Index: clang/test/CodeGenCXX/linetable-fnbegin.cpp
===
--- clang/test/CodeGenCXX/linetable-fnbegin.cpp
+++ 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 {
Index: clang/test/CodeGenCXX/debug-info-mingw.cpp
===
--- /dev/null
+++ 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",
Index: clang/test/CodeGen/debug-prefix-map.c
===
--- clang/test/CodeGen/debug-prefix-map.c
+++ 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
Index: clang/test/CodeGen/debug-info-preprocessed-file.i
===
--- clang/test/CodeGen/debug-info-preprocessed-file.i
+++ 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
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -444,6 +444,10 @@
   StringRef Dir;
   StringRef File;
   std::string RemappedFile = remapDIPath(FileName);
+  // Convert RemappedFile to native style
+  SmallString<128> NativeFileName = StringRef(RemappedFile);
+  llvm::sys::path::native(NativeFileName);
+  RemappedFile = (std::string)NativeFileName.str();
   std::string CurDir = remapDIPath(getCurrentDirname());
   SmallString<128> DirBuf;
   

[PATCH] D99580: [CLANG] [DebugInfo] Convert File name to native format

2021-03-31 Thread kamlesh kumar via Phabricator via cfe-commits
kamleshbhalui updated this revision to Diff 334356.
kamleshbhalui added a comment.

clang formatting the patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99580/new/

https://reviews.llvm.org/D99580

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenCXX/linetable-fnbegin.cpp


Index: clang/test/CodeGenCXX/linetable-fnbegin.cpp
===
--- clang/test/CodeGenCXX/linetable-fnbegin.cpp
+++ clang/test/CodeGenCXX/linetable-fnbegin.cpp
@@ -12,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 {
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -627,9 +627,9 @@
   llvm::sys::path::native(NativeMainFileName);
   MainFileName = (std::string)NativeMainFileName.str();
 
-  llvm::DIFile *CUFile = DBuilder.createFile(
-  MainFileName, remapDIPath(getCurrentDirname()), CSInfo,
-  getSource(SM, SM.getMainFileID()));
+  llvm::DIFile *CUFile =
+  DBuilder.createFile(MainFileName, remapDIPath(getCurrentDirname()),
+  CSInfo, getSource(SM, SM.getMainFileID()));
 
   StringRef Sysroot, SDK;
   if (CGM.getCodeGenOpts().getDebuggerTuning() == llvm::DebuggerKind::LLDB) {


Index: clang/test/CodeGenCXX/linetable-fnbegin.cpp
===
--- clang/test/CodeGenCXX/linetable-fnbegin.cpp
+++ clang/test/CodeGenCXX/linetable-fnbegin.cpp
@@ -12,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 {
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -627,9 +627,9 @@
   llvm::sys::path::native(NativeMainFileName);
   MainFileName = (std::string)NativeMainFileName.str();
 
-  llvm::DIFile *CUFile = DBuilder.createFile(
-  MainFileName, remapDIPath(getCurrentDirname()), CSInfo,
-  getSource(SM, SM.getMainFileID()));
+  llvm::DIFile *CUFile =
+  DBuilder.createFile(MainFileName, remapDIPath(getCurrentDirname()),
+  CSInfo, getSource(SM, SM.getMainFileID()));
 
   StringRef Sysroot, SDK;
   if (CGM.getCodeGenOpts().getDebuggerTuning() == llvm::DebuggerKind::LLDB) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99580: [CLANG] [DebugInfo] Convert File name to native format

2021-03-30 Thread kamlesh kumar via Phabricator via cfe-commits
kamleshbhalui updated this revision to Diff 334338.
kamleshbhalui added a comment.

Marked failed tests as unsupported on windows system
Because now clang emits native path for DIFile.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99580/new/

https://reviews.llvm.org/D99580

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-info-preprocessed-file.i
  clang/test/CodeGen/debug-prefix-map.c
  clang/test/CodeGenCXX/debug-info-mingw.cpp
  clang/test/CodeGenCXX/linetable-fnbegin.cpp
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/stdin-input.c
  clang/test/Modules/module-debuginfo-prefix.m
  clang/test/PCH/debug-info-pch-container-path.c

Index: clang/test/PCH/debug-info-pch-container-path.c
===
--- clang/test/PCH/debug-info-pch-container-path.c
+++ clang/test/PCH/debug-info-pch-container-path.c
@@ -1,3 +1,4 @@
+// UNSUPPORTED: system-windows
 // REQUIRES: asserts
 
 // Modules:
Index: clang/test/Modules/module-debuginfo-prefix.m
===
--- clang/test/Modules/module-debuginfo-prefix.m
+++ clang/test/Modules/module-debuginfo-prefix.m
@@ -1,3 +1,4 @@
+// UNSUPPORTED: system-windows
 // REQUIRES: asserts
 
 // Modules:
Index: clang/test/Frontend/stdin-input.c
===
--- clang/test/Frontend/stdin-input.c
+++ 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'
Index: clang/test/Frontend/optimization-remark-line-directive.c
===
--- clang/test/Frontend/optimization-remark-line-directive.c
+++ 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.
Index: clang/test/CodeGenCXX/linetable-fnbegin.cpp
===
--- clang/test/CodeGenCXX/linetable-fnbegin.cpp
+++ 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.
Index: clang/test/CodeGenCXX/debug-info-mingw.cpp
===
--- /dev/null
+++ 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",
Index: clang/test/CodeGen/debug-prefix-map.c
===
--- clang/test/CodeGen/debug-prefix-map.c
+++ 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
Index: clang/test/CodeGen/debug-info-preprocessed-file.i
===
--- clang/test/CodeGen/debug-info-preprocessed-file.i
+++ 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
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -444,6 +444,10 @@
   StringRef Dir;
   StringRef File;
   std::string RemappedFile = remapDIPath(FileName);
+  // Convert RemappedFile to native style
+  SmallString<128> NativeFileName = StringRef(RemappedFile);
+  llvm::sys::path::native(NativeFileName);
+  RemappedFile = (std::string)NativeFileName.str();
   std::string CurDir = remapDIPath(getCurrentDirname());
   SmallString<128> DirBuf;
   SmallString<128> FileBuf;
@@ -618,8 +622,13 @@
   // file was specified with an absolute path.
   if (CSKind)
  

[PATCH] D99580: [CLANG] [DebugInfo] Convert File name to native format

2021-03-30 Thread kamlesh kumar via Phabricator via cfe-commits
kamleshbhalui added a comment.

In D99580#2659352 , @dblaikie wrote:

> @rnk @akhuang - I think we touched on this before maybe in some other 
> thread/patch/discussion?
>
> Ah, @probinson mentioned in the linked thread:
>
>> Is this https://bugs.llvm.org/show_bug.cgi?id=44170 which had a tentative 
>> patch at https://reviews.llvm.org/D71508 ?
>> The original complaint wasn't for Windows, but the lack of filepath 
>> canonicalization seems like a common symptom.
>
> Might be best, @kamleshbhalui, if you could check if the other (D71508 
> ) patch relates to the same issue & if so, 
> continue the discussion over there instead of forking it here.

@dblaikie It's not exactly same problem because PR44170  pops up only when 
compiling with -gdwarf-5 (on both linux and windows) although IR looks similar 
as when compiled with -gdwarf-4.
But this bug(for which current patch D99580  
created) only can be reproduced on windows and with all dwarf version.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99580/new/

https://reviews.llvm.org/D99580

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99580: [CLANG] [DebugInfo] Convert File name to native format

2021-03-30 Thread kamlesh kumar via Phabricator via cfe-commits
kamleshbhalui added a comment.

In D99580#2659858 , @amccarth wrote:

> Another possible issue is that llvm::sys::path and other functions try to map 
> Windows filesystem concepts to Posix ones. There are many cases where there 
> isn't a perfect mapping. For example: Windows has a current working directory 
> _per drive_, and so it can be hard to resolve paths like D:foo.ext, which are 
> relative to something other than the "current working directory." Details 
> like this can come into play in the immediate vicinity of the code change, so 
> I have some trepidation.

Agree with you but this problem exist with and without this patch.

> It looks like the code change is for everyone, but the new test is specific 
> to mingw.

For Linux like platform it does not create problem because input file  path is 
already in POSIX style, so having a test case will not test the change because 
even without the change it will pass.
Even on windows problem occur only when input file path specified in POSIX 
style(i.e. C:/foo/bar/test.c), if specify the path windows style(i.e. 
C:\foo\bar\test.c) then the fix not required.

>   Is that the right place for the new test?

In same directory their are many mingw related test, so added this test their, 
still if everyone strongly feels it should be in separate directory I will do 
that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99580/new/

https://reviews.llvm.org/D99580

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99580: [CLANG] [DebugInfo] Convert File name to native format

2021-03-30 Thread Adrian McCarthy via Phabricator via cfe-commits
amccarth added a comment.

The previous discussions (that I participated in) were centered around the 
redirecting virtual filesystem, which creates paths in hybrid style and there 
is no "correct" way to make those native without taking breaking changes and 
making it less useful for writing platform-agnostic tests.  But it's not clear 
that's relevant here.

I'm also told that clang _generally_ tries to avoid canonicalization and 
instead treats file paths as mostly opaque strings that can be concatenated.  
Personally, I prefer file paths in the style that the native system prefers, so 
I'd like to see this go through, but I'm not sure how compatible this would be 
with other aspects of clang's file path handling.

Another possible issue is that `llvm::sys::path` and other functions try to map 
Windows filesystem concepts to Posix ones.  There are many cases where there 
isn't a perfect mapping.  For example:  Windows has a current working directory 
_per drive_, and so it can be hard to resolve paths like `D:foo.ext`, which are 
relative to something other than the "current working directory."  Details like 
this can come into play in the immediate vicinity of the code change, so I have 
some trepidation.

It looks like the code change is for everyone, but the new test is specific to 
mingw.  Is that the right place for the new test?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99580/new/

https://reviews.llvm.org/D99580

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99580: [CLANG] [DebugInfo] Convert File name to native format

2021-03-30 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added subscribers: akhuang, probinson, rnk.
dblaikie added a comment.

@rnk @akhuang - I think we touched on this before maybe in some other 
thread/patch/discussion?

Ah, @probinson mentioned in the linked thread:

> Is this https://bugs.llvm.org/show_bug.cgi?id=44170 which had a tentative 
> patch at https://reviews.llvm.org/D71508 ?
> The original complaint wasn't for Windows, but the lack of filepath 
> canonicalization seems like a common symptom.

Might be best, @kamleshbhalui, if you could check if the other (D71508 
) patch relates to the same issue & if so, 
continue the discussion over there instead of forking it here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99580/new/

https://reviews.llvm.org/D99580

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99580: [CLANG] [DebugInfo] Convert File name to native format

2021-03-30 Thread kamlesh kumar via Phabricator via cfe-commits
kamleshbhalui created this revision.
kamleshbhalui added reviewers: dblaikie, aprantl.
kamleshbhalui added a project: LLVM.
Herald added a subscriber: mstorsjo.
kamleshbhalui requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Clang emits duplicate file entry in object file on windows platform(when 
windows style path appended with posix style path or vice versa).
which becomes problem for some debugger(not able to put break point on the file 
which has duplicate entry).

By making sure it's native path before creating DIFile above problem goes away.

Testcase Demonstration of problem on llvm-dev:
https://lists.llvm.org/pipermail/llvm-dev/2021-March/149501.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99580

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-info-mingw.c


Index: clang/test/CodeGen/debug-info-mingw.c
===
--- /dev/null
+++ clang/test/CodeGen/debug-info-mingw.c
@@ -0,0 +1,7 @@
+// RUN: rm -rf %t/UNIQUE_DIR && mkdir -p %t/UNIQUE_DIR
+// RUN: cp %s %t/UNIQUE_DIR/debug-info-mingw.c
+// RUN: %clang_cc1 -triple x86_64-w64-windows-gnu -debug-info-kind=limited 
-main-file-name debug-info-mingw.c %t/UNIQUE_DIR/debug-info-mingw.c -emit-llvm 
-o - | FileCheck %s
+int main() {
+}
+// CHECK: !DIFile(filename: "{{.+}}\\UNIQUE_DIR\\debug-info-mingw.c",
+// UNSUPPORTED: !system-windows
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -443,6 +443,10 @@
 Optional Source) {
   StringRef Dir;
   StringRef File;
+  // Convert FileName to native path
+  SmallString<128> NativePath = FileName;
+  llvm::sys::path::native(NativePath);
+  FileName = NativePath.str();
   std::string RemappedFile = remapDIPath(FileName);
   std::string CurDir = remapDIPath(getCurrentDirname());
   SmallString<128> DirBuf;
@@ -558,7 +562,10 @@
 MainFile->getName().rsplit('.').second)
 .isPreprocessed())
   MainFileName = CGM.getModule().getName().str();
-
+// Convert MainFileName to native path
+SmallString<128> NativePath = (StringRef)MainFileName;
+llvm::sys::path::native(NativePath);
+MainFileName = (std::string)NativePath.str();
 CSKind = computeChecksum(SM.getMainFileID(), Checksum);
   }
 


Index: clang/test/CodeGen/debug-info-mingw.c
===
--- /dev/null
+++ clang/test/CodeGen/debug-info-mingw.c
@@ -0,0 +1,7 @@
+// RUN: rm -rf %t/UNIQUE_DIR && mkdir -p %t/UNIQUE_DIR
+// RUN: cp %s %t/UNIQUE_DIR/debug-info-mingw.c
+// RUN: %clang_cc1 -triple x86_64-w64-windows-gnu -debug-info-kind=limited -main-file-name debug-info-mingw.c %t/UNIQUE_DIR/debug-info-mingw.c -emit-llvm -o - | FileCheck %s
+int main() {
+}
+// CHECK: !DIFile(filename: "{{.+}}\\UNIQUE_DIR\\debug-info-mingw.c",
+// UNSUPPORTED: !system-windows
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -443,6 +443,10 @@
 Optional Source) {
   StringRef Dir;
   StringRef File;
+  // Convert FileName to native path
+  SmallString<128> NativePath = FileName;
+  llvm::sys::path::native(NativePath);
+  FileName = NativePath.str();
   std::string RemappedFile = remapDIPath(FileName);
   std::string CurDir = remapDIPath(getCurrentDirname());
   SmallString<128> DirBuf;
@@ -558,7 +562,10 @@
 MainFile->getName().rsplit('.').second)
 .isPreprocessed())
   MainFileName = CGM.getModule().getName().str();
-
+// Convert MainFileName to native path
+SmallString<128> NativePath = (StringRef)MainFileName;
+llvm::sys::path::native(NativePath);
+MainFileName = (std::string)NativePath.str();
 CSKind = computeChecksum(SM.getMainFileID(), Checksum);
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits