llvm: add assert to reliably catch undefined value use

This assert makes it possible to detect a regression of #13030 in the
future without relying on undefined value tracking.
This commit is contained in:
Jacob Young 2022-10-01 09:03:28 -04:00
parent b7bd44a654
commit 272e31227c

View File

@ -2332,10 +2332,13 @@ pub const Object = struct {
// buffer is only used for int_type, `builtin` is a struct.
const builtin_ty = mod.declPtr(builtin_decl).val.toType(undefined);
const builtin_namespace = builtin_ty.getNamespace().?;
const stack_trace_decl = builtin_namespace.decls
const stack_trace_decl_index = builtin_namespace.decls
.getKeyAdapted(stack_trace_str, Module.DeclAdapter{ .mod = mod }).?;
const stack_trace_decl = mod.declPtr(stack_trace_decl_index);
return mod.declPtr(stack_trace_decl).val.toType(undefined);
// Sema should have ensured that StackTrace was analyzed.
assert(stack_trace_decl.has_tv);
return stack_trace_decl.val.toType(undefined);
}
};