Reformat source files with clang-format 19.1.7

This commit is contained in:
Rangi42
2025-01-27 17:27:52 -05:00
committed by Rangi
parent 20c18256ed
commit a354af3d08
18 changed files with 75 additions and 81 deletions

View File

@@ -45,7 +45,10 @@ bool charmap_ForEach(
for (Charmap const &charmap : charmapList) {
// Traverse the trie depth-first to derive the character mappings in definition order
std::map<size_t, std::string> mappings;
for (std::stack<std::pair<size_t, std::string>> prefixes({{0, ""}}); !prefixes.empty();) {
// clang-format off: nested initializers
for (std::stack<std::pair<size_t, std::string>> prefixes({{0, ""}});
!prefixes.empty();) {
// clang-format on
auto [nodeIdx, mapping] = std::move(prefixes.top());
prefixes.pop();
CharmapNode const &node = charmap.nodes[nodeIdx];

View File

@@ -190,7 +190,7 @@ static std::unordered_map<std::string, int, CaseInsensitive, CaseInsensitive> ke
{"NZ", T_(CC_NZ) },
{"Z", T_(CC_Z) },
{"NC", T_(CC_NC) },
// There is no `T_(CC_C)`; it's handled before as `T_(TOKEN_C)`
// There is no `T_(CC_C)`; it's handled before as `T_(TOKEN_C)`
{"AF", T_(MODE_AF) },
{"BC", T_(MODE_BC) },
@@ -315,7 +315,7 @@ static std::unordered_map<std::string, int, CaseInsensitive, CaseInsensitive> ke
{"RB", T_(POP_RB) },
{"RW", T_(POP_RW) },
// There is no `T_(POP_RL)`; it's handled before as `T_(SM83_RL)`
// There is no `T_(POP_RL)`; it's handled before as `T_(SM83_RL)`
{"EQU", T_(POP_EQU) },
{"EQUS", T_(POP_EQUS) },
@@ -2286,14 +2286,14 @@ static Capture startCapture() {
auto &view = lexerState->content.get<ViewedContent>();
return {
.lineNo = lineNo, .span = {.ptr = view.makeSharedContentPtr(), .size = 0}
};
};
} else {
assume(lexerState->captureBuf == nullptr);
lexerState->captureBuf = std::make_shared<std::vector<char>>();
// `.span.ptr == nullptr`; indicates to retrieve the capture buffer when done capturing
return {
.lineNo = lineNo, .span = {.ptr = nullptr, .size = 0}
};
};
}
}

View File

@@ -77,9 +77,9 @@ void Expression::makeSymbol(std::string const &symName) {
isSymbol = true;
data = sym_IsPC(sym) ? "PC is not constant at assembly time"
: sym_IsPurgedScoped(symName)
? "'"s + symName + "' is not constant at assembly time; it was purged"
: "'"s + symName + "' is not constant at assembly time";
: sym_IsPurgedScoped(symName)
? "'"s + symName + "' is not constant at assembly time; it was purged"
: "'"s + symName + "' is not constant at assembly time";
sym = sym_Ref(symName);
size_t nameLen = sym->name.length() + 1; // Don't forget NUL!
@@ -120,8 +120,8 @@ void Expression::makeBankSymbol(std::string const &symName) {
data = static_cast<int32_t>(sym->getSection()->bank);
} else {
data = sym_IsPurgedScoped(symName)
? "\""s + symName + "\"'s bank is not known; it was purged"
: "\""s + symName + "\"'s bank is not known";
? "\""s + symName + "\"'s bank is not known; it was purged"
: "\""s + symName + "\"'s bank is not known";
size_t nameLen = sym->name.length() + 1; // Room for NUL!

View File

@@ -477,9 +477,7 @@ void sect_SetLoadSection(
void sect_EndLoadSection(char const *cause) {
if (cause)
warning(
WARNING_UNTERMINATED_LOAD,
"`LOAD` block without `ENDL` terminated by `%s`\n",
cause
WARNING_UNTERMINATED_LOAD, "`LOAD` block without `ENDL` terminated by `%s`\n", cause
);
if (!currentLoadSection) {

View File

@@ -35,13 +35,13 @@ struct WarningFlag {
WarningLevel level;
};
static const WarningFlag metaWarnings[] = {
static WarningFlag const metaWarnings[] = {
{"all", LEVEL_ALL },
{"extra", LEVEL_EXTRA },
{"everything", LEVEL_EVERYTHING},
};
static const WarningFlag warningFlags[NB_WARNINGS] = {
static WarningFlag const warningFlags[NB_WARNINGS] = {
{"assert", LEVEL_DEFAULT },
{"backwards-for", LEVEL_ALL },
{"builtin-args", LEVEL_ALL },