Skip to content

Commit 797187d

Browse files
authored
[SYCL] Fix directory field of DIFile. (#8838)
The directory should be the current working directory of the compilation command that produced the DICompileUnit. In other words, it should be the directory where the app is running and not the directory where the source app resides.
1 parent 6cc3473 commit 797187d

File tree

4 files changed

+2
-9
lines changed

4 files changed

+2
-9
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -667,11 +667,8 @@ void CGDebugInfo::CreateCompileUnit() {
667667
if (CSKind)
668668
CSInfo.emplace(*CSKind, Checksum);
669669

670-
if (!CGM.getCodeGenOpts().SYCLUseMainFileName)
671-
MainFileDir = getCurrentDirname();
672-
673670
llvm::DIFile *CUFile =
674-
DBuilder.createFile(remapDIPath(MainFileName), remapDIPath(MainFileDir),
671+
DBuilder.createFile(remapDIPath(MainFileName), remapDIPath(getCurrentDirname()),
675672
CSInfo, getSource(SM, SM.getMainFileID()));
676673

677674
StringRef Sysroot, SDK;

clang/test/CodeGenSYCL/debug-info-checksum-temp-name.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
//
2525
// CHECK: !DICompileUnit({{.*}} file: ![[#FILE:]]
2626
// CHECK: ![[#FILE]] = !DIFile(filename: "{{.*}}clang{{.+}}test{{.+}}CodeGenSYCL{{.+}}Inputs{{.+}}debug-info-checksum.cpp"
27-
// CHECK-SAME: directory: "{{.*}}clang{{.+}}test{{.+}}CodeGenSYCL{{.+}}Inputs"
2827
// CHECK-SAME: checksumkind: CSK_MD5, checksum: "f1fb5d68350b47d90a53968ac8c40529"
2928

3029
#include "Inputs/debug-info-checksum.cpp"

clang/test/CodeGenSYCL/debug-info-file-checksum.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@
2626

2727
// COMP1: !DICompileUnit({{.*}} file: ![[#FILE1:]]
2828
// COMP1: ![[#FILE1]] = !DIFile(filename: "{{.*}}clang{{.+}}test{{.+}}CodeGenSYCL{{.+}}Inputs{{.+}}checksum.cpp"
29-
// COMP1-SAME: directory: "{{.*}}clang{{.+}}test{{.+}}CodeGenSYCL/Inputs"
3029
// COMP1-SAME: checksumkind: CSK_MD5, checksum: "259269f735d83ec32c46a11352458493")
3130

3231
// COMP2: !DICompileUnit({{.*}} file: ![[#FILE2:]]
3332
// COMP2: ![[#FILE2]] = !DIFile(filename: "{{.*}}clang{{.+}}test{{.+}}CodeGenSYCL{{.+}}Inputs{{.+}}checksum.cpp"
34-
// COMP2: directory: "{{.*}}clang{{.+}}test{{.+}}CodeGenSYCL/Output"
3533
// COMP2-SAME: checksumkind: CSK_MD5, checksum: "259269f735d83ec32c46a11352458493")
3634

3735
// TODO: Fails on windows because of the use of append-file command that returns

clang/test/CodeGenSYCL/debug-info-file-prefix-map.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515
// CHECK: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: ![[#FILE1:]]
1616
// CHECK-NEXT: ![[#FILE1]] = !DIFile(filename: "debug-info-file-prefix-map.cpp"
17-
// CHECK-SAME: directory: "{{.*}}clang{{.+}}test{{.+}}CodeGenSYCL"
18-
// CHECK: ![[#FILE2:]] = !DIFile(filename: "debug-info-file-prefix-map.cpp", directory: "")
17+
// CHECK: ![[#FILE2:]] = !DIFile(filename: "debug-info-file-prefix-map.cpp"
1918
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "__builtin_va_list", file: ![[#FILE2]]
2019

2120
void a(__builtin_va_list);

0 commit comments

Comments
 (0)