[lld] [LLD] Add CLASS syntax to SECTIONS (PR #95323)

Daniel Thornburgh via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 15:43:56 PDT 2024


================
@@ -611,6 +613,34 @@ SmallVector<SectionCommand *, 0> ScriptParser::readOverlay() {
   return v;
 }
 
+SectionClassDesc *ScriptParser::readSectionClassDescription() {
+  StringRef name = readSectionClassName();
+  SectionClassDesc *desc = make<SectionClassDesc>(name);
+  if (!script->sectionClasses.insert({CachedHashStringRef(name), desc}).second)
+    setError("section class '" + name + "' already defined");
+  expect("{");
+  while (!errorCount() && !consume("}")) {
----------------
mysterymath wrote:

Hmm, I had used `readOutputSectionDescription` as a reference for the parsing idioms, but that didn't change in #100493 . Is there a substantive difference between that and `readSectionClassDescription`, or was the loop in `readOutputSectionDescription` missed? It appears that there are still 15 instances of the `while(!errorCount() && !consume(...` idiom in ScriptParser.cpp, but it isn't obvious to me what the differences are between those changed and those that remain.

https://github.com/llvm/llvm-project/pull/95323


More information about the llvm-commits mailing list