astgen: handle @frameAddress in rlBuiltinCall, enable debug.zig
rlBuiltinCall was always returning false (not consuming result location). The Zig reference marks @frameAddress as consuming the RL (workaround for llvm/llvm-project#68409), which affects declaration codegen path (pointer vs value based). Match the upstream behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18036,11 +18036,31 @@ static bool rlBlockExpr(AstGenCtx* ag, RlBlock* parent_block, RlResultInfo ri,
|
||||
}
|
||||
|
||||
// builtinCall (AstRlAnnotate.zig:816-1100).
|
||||
// Simplified: no builtin currently consumes its result location,
|
||||
// so we just recurse into all args with RL_RI_NONE.
|
||||
static bool rlBuiltinCall(AstGenCtx* ag, RlBlock* block, uint32_t node,
|
||||
const uint32_t* args, uint32_t nargs) {
|
||||
(void)node;
|
||||
const Ast* tree = ag->tree;
|
||||
uint32_t builtin_token = tree->nodes.main_tokens[node];
|
||||
uint32_t tok_start = tree->tokens.starts[builtin_token];
|
||||
const char* source = tree->source;
|
||||
uint32_t name_start = tok_start + 1; // skip '@'
|
||||
uint32_t name_end = name_start;
|
||||
while (name_end < tree->source_len
|
||||
&& ((source[name_end] >= 'a' && source[name_end] <= 'z')
|
||||
|| (source[name_end] >= 'A' && source[name_end] <= 'Z')
|
||||
|| (source[name_end] >= '0' && source[name_end] <= '9')
|
||||
|| source[name_end] == '_')) {
|
||||
name_end++;
|
||||
}
|
||||
uint32_t name_len = name_end - name_start;
|
||||
|
||||
// TODO: this is a workaround for llvm/llvm-project#68409
|
||||
// Zig tracking issue: #16876
|
||||
// @frameAddress consumes its result location
|
||||
// (AstRlAnnotate.zig:887-889).
|
||||
if (name_len == 12
|
||||
&& memcmp(source + name_start, "frameAddress", 12) == 0)
|
||||
return true;
|
||||
|
||||
for (uint32_t i = 0; i < nargs; i++)
|
||||
(void)rlExpr(ag, args[i], block, RL_RI_NONE);
|
||||
return false;
|
||||
|
||||
@@ -590,7 +590,7 @@ const corpus_files = .{
|
||||
"../lib/std/debug/Pdb.zig",
|
||||
"../lib/std/debug/SelfInfo.zig",
|
||||
"../lib/std/debug/simple_panic.zig",
|
||||
//"../lib/std/debug.zig",
|
||||
"../lib/std/debug.zig",
|
||||
"../lib/std/DoublyLinkedList.zig",
|
||||
"../lib/std/dwarf/ATE.zig",
|
||||
"../lib/std/dwarf/AT.zig",
|
||||
|
||||
Reference in New Issue
Block a user