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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 17:27:58 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("}")) {
----------------
MaskRay wrote:

I neglected `while (... consume("}"))` in #100493 , which might lead to bad diagnostics or dead loops.

I introduced `till()` in 2a89356d64a274f7171b45d8b7b05b6315a6f627 and refactored some `while (... consume("}"))` to use `till`. Use that instead?

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


More information about the llvm-commits mailing list