mirror of
https://github.com/open-goal/jak-project
synced 2026-05-23 06:54:31 -04:00
decomp/lsp: Differentiate warnings from likely/definite errors (#1725)
* decomp: differentiate potential false positive warnings from likely/certain failures * lsp: handle IR2 errors * decomp: downgrade an expr building warning as often expressions build fine * tests: update reference tests since comments aren't ignored * decomp: simplify warnings interface * tests: update ref tests
This commit is contained in:
@@ -428,7 +428,7 @@ void ObjectFileDB::ir2_stack_spill_slot_pass(int seg, ObjectFileData& data) {
|
||||
auto spill_map = build_spill_map(func.instructions, {func.prologue_end, func.epilogue_start});
|
||||
func.ir2.env.set_stack_spills(spill_map);
|
||||
} catch (std::exception& e) {
|
||||
func.warnings.general_warning("stack spill failed: {}", e.what());
|
||||
func.warnings.warning("stack spill failed: {}", e.what());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -465,7 +465,7 @@ void ObjectFileDB::ir2_atomic_op_pass(int seg, const Config& config, ObjectFileD
|
||||
} catch (std::exception& e) {
|
||||
lg::warn("Function {} from {} could not be converted to atomic ops: {}", func.name(),
|
||||
data.to_unique_name(), e.what());
|
||||
func.warnings.general_warning("Failed to convert to atomic ops: {}", e.what());
|
||||
func.warnings.error("Failed to convert to atomic ops: {}", e.what());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -533,11 +533,11 @@ void ObjectFileDB::ir2_type_analysis_pass(int seg, const Config& config, ObjectF
|
||||
if (run_type_analysis_ir2(ts, dts, func)) {
|
||||
func.ir2.env.types_succeeded = true;
|
||||
} else {
|
||||
func.warnings.type_prop_warning("Type analysis failed");
|
||||
func.warnings.error("Type Propagation failed: Type analysis failed");
|
||||
}
|
||||
} else {
|
||||
lg::warn("Function {} didn't know its type", func.name());
|
||||
func.warnings.type_prop_warning("Function {} has unknown type", func.name());
|
||||
func.warnings.error("Function {} has unknown type", func.name());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -567,7 +567,7 @@ void ObjectFileDB::ir2_register_usage_pass(int seg, ObjectFileData& data) {
|
||||
for (auto& x : dep_regs) {
|
||||
if ((x.get_kind() == Reg::VF && x.get_vf() != 0) || x.get_kind() == Reg::SPECIAL) {
|
||||
lg::error("Bad vf dependency on {} in {}", x.to_charp(), func.name());
|
||||
func.warnings.bad_vf_dependency("{}", x.to_string());
|
||||
func.warnings.error("Bad vector register dependency: {}", x.to_string());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -581,8 +581,7 @@ void ObjectFileDB::ir2_register_usage_pass(int seg, ObjectFileData& data) {
|
||||
}
|
||||
|
||||
lg::error("Bad register dependency on {} in {}", x.to_charp(), func.name());
|
||||
func.warnings.general_warning("Function may read a register that is not set: {}",
|
||||
x.to_string());
|
||||
func.warnings.error("Function may read a register that is not set: {}", x.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -619,7 +618,7 @@ void ObjectFileDB::ir2_cfg_build_pass(int seg, ObjectFileData& data) {
|
||||
try {
|
||||
build_initial_forms(func);
|
||||
} catch (std::exception& e) {
|
||||
func.warnings.general_warning("Failed to structure: {}", e.what());
|
||||
func.warnings.error("Failed to structure: {}", e.what());
|
||||
func.ir2.top_form = nullptr;
|
||||
}
|
||||
}
|
||||
@@ -664,7 +663,7 @@ void ObjectFileDB::ir2_insert_lets(int seg, ObjectFileData& data) {
|
||||
"none if something is actually returned.",
|
||||
e.what());
|
||||
lg::warn(err);
|
||||
func.warnings.general_warning(err);
|
||||
func.warnings.error(err);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -688,7 +687,7 @@ void ObjectFileDB::ir2_insert_anonymous_functions(int seg, ObjectFileData& data)
|
||||
try {
|
||||
insert_static_refs(func.ir2.top_form, *func.ir2.form_pool, func, dts);
|
||||
} catch (std::exception& e) {
|
||||
func.warnings.general_warning("Failed static ref finding: {}\n", e.what());
|
||||
func.warnings.error("Failed static ref finding: {}\n", e.what());
|
||||
lg::error("Function {} failed static ref: {}\n", func.name(), e.what());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user