@@ -108,6 +108,7 @@ static GlobalVariable *jlboundserr_var;
108
108
// important functions
109
109
static Function *jlnew_func;
110
110
static Function *jlraise_func;
111
+ static Function *jlraise_line_func;
111
112
static Function *jlerror_func;
112
113
static Function *jltypeerror_func;
113
114
static Function *jlcheckassign_func;
@@ -331,6 +332,7 @@ typedef struct {
331
332
jl_sym_t *vaName; // name of vararg argument
332
333
bool vaStack; // varargs stack-allocated
333
334
int nReqArgs;
335
+ int lineno;
334
336
} jl_codectx_t ;
335
337
336
338
static Value *emit_expr (jl_value_t *expr, jl_codectx_t *ctx, bool boxed=true ,
@@ -1913,6 +1915,7 @@ static Function *emit_function(jl_lambda_info_t *lam)
1913
1915
filename = ((jl_sym_t *)jl_exprarg (stmt, 1 ))->name ;
1914
1916
}
1915
1917
}
1918
+ ctx.lineno = lno;
1916
1919
1917
1920
// TODO: Fix when moving to new LLVM version
1918
1921
dbuilder->createCompileUnit (0x01 , filename, " ." , " julia" , true , " " , 0 );
@@ -2213,10 +2216,12 @@ static Function *emit_function(jl_lambda_info_t *lam)
2213
2216
if (jl_is_linenode (stmt)) {
2214
2217
int lno = jl_linenode_line (stmt);
2215
2218
builder.SetCurrentDebugLocation (DebugLoc::get (lno, 1 , (MDNode*)SP, NULL ));
2219
+ ctx.lineno = lno;
2216
2220
}
2217
2221
else if (jl_is_expr (stmt) && ((jl_expr_t *)stmt)->head == line_sym) {
2218
2222
int lno = jl_unbox_long (jl_exprarg (stmt, 0 ));
2219
2223
builder.SetCurrentDebugLocation (DebugLoc::get (lno, 1 , (MDNode*)SP, NULL ));
2224
+ ctx.lineno = lno;
2220
2225
}
2221
2226
if (jl_is_labelnode (stmt)) {
2222
2227
if (prevlabel) continue ;
@@ -2430,6 +2435,14 @@ static void init_julia_llvm_env(Module *m)
2430
2435
jlraise_func->setDoesNotReturn ();
2431
2436
jl_ExecutionEngine->addGlobalMapping (jlraise_func, (void *)&jl_raise);
2432
2437
2438
+ std::vector<Type*> args2_raise (0 );
2439
+ args2_raise.push_back (jl_pvalue_llvmt);
2440
+ args2_raise.push_back (T_int32);
2441
+ jlraise_line_func =
2442
+ (Function*)jl_Module->getOrInsertFunction (" jl_raise_with_superfluous_argument" ,
2443
+ FunctionType::get (T_void, args2_raise, false ));
2444
+ jlraise_line_func->setDoesNotReturn ();
2445
+
2433
2446
jlnew_func =
2434
2447
Function::Create (FunctionType::get (jl_pvalue_llvmt, args1_, false ),
2435
2448
Function::ExternalLinkage,
0 commit comments