Skip to content

Commit

Permalink
Revert "Revert kf/filediinfo"
Browse files Browse the repository at this point in the history
This reverts commit e494cb6.
  • Loading branch information
Keno committed Aug 13, 2014
1 parent 3769729 commit 067984e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
20 changes: 19 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3523,6 +3523,8 @@ static Function *emit_function(jl_lambda_info_t *lam, bool cstyle)
assert(SP.Verify() && SP.describes(f) && SP.getFunction() == f);
}

std::map<jl_sym_t *, MDNode *> filescopes;

Value *fArg=NULL, *argArray=NULL, *argCount=NULL;
if (!specsig) {
Function::arg_iterator AI = f->arg_begin();
Expand Down Expand Up @@ -3812,8 +3814,24 @@ static Function *emit_function(jl_lambda_info_t *lam, bool cstyle)
}
else if (jl_is_expr(stmt) && ((jl_expr_t*)stmt)->head == line_sym) {
lno = jl_unbox_long(jl_exprarg(stmt, 0));
MDNode *scope = (MDNode*)SP;
if (jl_array_dim0(((jl_expr_t*)stmt)->args) > 1) {
jl_value_t *a1 = jl_exprarg(stmt,1);
if (jl_is_symbol(a1)) {
jl_sym_t *file = (jl_sym_t*)a1;
// If the string is not empty
if(*file->name != '\0') {
std::map<jl_sym_t *, MDNode *>::iterator it = filescopes.find(file);
if (it != filescopes.end()) {
scope = it->second;
} else {
scope = filescopes[file] = dbuilder.createFile(file->name, ".");
}
}
}
}
if (debug_enabled)
builder.SetCurrentDebugLocation(DebugLoc::get(lno, 1, (MDNode*)SP, NULL));
builder.SetCurrentDebugLocation(DebugLoc::get(lno, 1, scope, NULL));
if (do_coverage)
coverageVisitLine(filename, lno);
ctx.lineno = lno;
Expand Down
8 changes: 6 additions & 2 deletions src/debuginfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,12 @@ void jl_getFunctionInfo(const char **name, size_t *line, const char **filename,
DISubprogram(prev.Loc.getScope((*it).second.func->getContext()));
*filename = debugscope.getFilename().data();
// the DISubprogram has the un-mangled name, so use that if
// available.
*name = debugscope.getName().data();
// available. However, if the scope need not be the current
// subprogram.
if (debugscope.getName().data() != NULL)
*name = debugscope.getName().data();
else
*name = jl_demangle(*name);
}

vit++;
Expand Down

0 comments on commit 067984e

Please sign in to comment.