Index: lib/CodeGen/CGDebugInfo.cpp =================================================================== --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -606,8 +606,7 @@ // file was specified with an absolute path. if (CSKind) CSInfo.emplace(*CSKind, Checksum); - llvm::DIFile *CUFile = DBuilder.createFile( - remapDIPath(MainFileName), remapDIPath(getCurrentDirname()), CSInfo, + llvm::DIFile *CUFile = createFile(MainFileName, CSInfo, getSource(SM, SM.getMainFileID())); // Create new compile unit. Index: test/CodeGenCXX/difile_entry.cpp =================================================================== --- test/CodeGenCXX/difile_entry.cpp +++ test/CodeGenCXX/difile_entry.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -main-file-name difile_entry.cpp -debug-info-kind=limited %s -std=c++11 -emit-llvm -o - | FileCheck --implicit-check-not=DIFiles %s +class pr47391 +{ + public : + pr47391(void); + ~pr47391(); + +}; +static pr47391 pp; +// CHECK: [[FILE:.*]] = !DIFile(filename: "{{.*}}", +// CHECK: !4 = !{} +// CHECK: !5 = !{!0} +// CHECK: !8 = !DISubprogram(name: "pr47391", scope: !6, file: [[FILE]] +// CHECK: !12 = !DISubprogram(name: "~pr47391", scope: !6, file: [[FILE]] +// CHECK: !20 = distinct !DISubprogram(linkageName: "_GLOBAL__sub_I_difile_entry.cpp", scope: !3, file: [[FILE]],