stage2: tiny improvements all over the place

* pass more x64 behavior tests
* return with a TODO error when lowering a decl with no runtime bits
* insert some debug logs for tracing recursive descent down the
type-value tree when lowering types
* print `Decl`'s name when print debugging `decl_ref` value
This commit is contained in:
Jakub Konka
2022-02-08 18:05:54 +01:00
parent f50203c836
commit 9981b3fd2f
8 changed files with 27 additions and 9 deletions

View File

@@ -150,6 +150,8 @@ pub fn generateSymbol(
const tracy = trace(@src());
defer tracy.end();
log.debug("generateSymbol: ty = {}, val = {}", .{ typed_value.ty, typed_value.val });
if (typed_value.val.isUndefDeep()) {
const target = bin_file.options.target;
const abi_size = try math.cast(usize, typed_value.ty.abiSize(target));
@@ -485,6 +487,18 @@ fn lowerDeclRef(
return Result{ .appended = {} };
}
const is_fn_body = decl.ty.zigTypeTag() == .Fn;
if (!is_fn_body and !decl.ty.hasRuntimeBits()) {
return Result{
.fail = try ErrorMsg.create(
bin_file.allocator,
src_loc,
"TODO handle void types when lowering decl ref",
.{},
),
};
}
if (decl.analysis != .complete) return error.AnalysisFail;
decl.markAlive();
const vaddr = vaddr: {