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,9 @@ +// RUN: rm -rf %t/test_dir +// RUN: mkdir -p %t/test_dir +// RUN: cd %t/test_dir +// RUN: cp %s . +// RUN: %clang_cc1 -main-file-name difile_entry.cpp -debug-info-kind=limited ../test_dir/difile_entry.cpp -std=c++11 -emit-llvm -o - | FileCheck --implicit-check-not=DIFile ../test_dir/difile_entry.cpp +extern int i; +int i; +// CHECK: {{.*}} = distinct !DIGlobalVariable(name: "i", scope: {{.*}}, file: {{.*}}, +// CHECK: {{.*}} = !DIFile(filename: "{{.*}}",