Refactor to avoid redundant obj_CheckAssertions function

This commit is contained in:
Rangi42
2024-03-27 16:19:01 -04:00
parent dcb4e40388
commit 506911d7d0
7 changed files with 38 additions and 54 deletions

View File

@@ -5,6 +5,7 @@
// GUIDELINE: external code MUST NOT BE AWARE of the data structure used!
#include <deque>
#include <memory>
#include <stdint.h>
#include <string>
@@ -13,6 +14,7 @@
#include "linkdefs.hpp"
#include "link/main.hpp"
#include "link/patch.hpp"
struct FileStackNode;
struct Section;
@@ -53,6 +55,15 @@ struct Section {
std::unique_ptr<Section> nextu; // The next "component" of this unionized sect
};
struct Assertion {
Patch patch; // Also used for its `.type`
std::string message;
// This would be redundant with `.section->fileSymbols`, but `section` is sometimes `nullptr`!
std::vector<Symbol> *fileSymbols;
};
extern std::deque<Assertion> assertions;
/*
* Execute a callback for each section currently registered.
* This is to avoid exposing the data structure in which sections are stored.