Some refactoring and cleanup (#1806)

* Use clang-tidy `misc-include-cleaner` for IWYU `#include` cleanup

* Use `std::optional<size_t>` instead of `ssize_t`

* Rename some functions in linkdefs.hpp

* Fix header order
This commit is contained in:
Rangi
2025-08-20 16:09:04 -04:00
committed by GitHub
parent 92ed6ece53
commit 3d155d5695
63 changed files with 271 additions and 118 deletions

View File

@@ -11,18 +11,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>
#include <variant>
#include <vector>
#include "diagnostics.hpp"
#include "helpers.hpp"
#include "linkdefs.hpp"
#include "platform.hpp"
#include "verbosity.hpp"
#include "version.hpp"
#include "link/assign.hpp"
#include "link/fstack.hpp"
#include "link/main.hpp"
#include "link/patch.hpp"
#include "link/sdas_obj.hpp"
#include "link/section.hpp"
@@ -360,7 +360,7 @@ static void readSection(
}
section.alignOfs = tmp;
if (sect_HasData(section.type)) {
if (sectTypeHasData(section.type)) {
if (section.size) {
section.data.resize(section.size);
if (fread(section.data.data(), 1, section.size, file) != section.size) {
@@ -549,7 +549,7 @@ void obj_ReadFile(char const *fileName, unsigned int fileID) {
// Give patches' PC section pointers to their sections
for (uint32_t i = 0; i < nbSections; ++i) {
if (sect_HasData(fileSections[i]->type)) {
if (sectTypeHasData(fileSections[i]->type)) {
for (Patch &patch : fileSections[i]->patches) {
linkPatchToPCSect(patch, fileSections);
}