Fix file paths in debug info

This commit is contained in:
Alexey Prokhin
2011-04-30 17:35:40 +04:00
parent 316e3b6fe7
commit 3a0dfac597

View File

@@ -428,18 +428,21 @@ void DtoDwarfCompileUnit(Module* m)
LOG_SCOPE;
// prepare srcpath
std::string srcpath(FileName::path(m->srcfile->name->toChars()));
const char *srcname = m->srcfile->name->toChars();
std::string srcpath(FileName::path(srcname));
if (!FileName::absolute(srcpath.c_str())) {
llvm::sys::Path tmp = llvm::sys::Path::GetCurrentDirectory();
tmp.appendComponent(srcpath);
srcpath = tmp.str();
if (!srcpath.empty() && *srcpath.rbegin() != '/' && *srcpath.rbegin() != '\\')
srcpath = srcpath + '/';
} else {
srcname = FileName::name(srcname);
}
gIR->dibuilder.createCompileUnit(
global.params.symdebug == 2 ? DW_LANG_C : DW_LANG_D,
m->srcfile->name->toChars(),
srcname,
srcpath,
"LDC (http://www.dsource.org/projects/ldc)",
false, // isOptimized TODO