[lld] [lld][ELF] remove `consumeLabel` in ScriptLexer (PR #99567)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 13:59:44 PDT 2024


================
@@ -1719,19 +1719,20 @@ ScriptParser::readSymbols() {
   while (!errorCount()) {
     if (consume("}"))
       break;
-    if (consumeLabel("local")) {
-      v = &locals;
-      continue;
-    }
-    if (consumeLabel("global")) {
-      v = &globals;
-      continue;
-    }
 
     if (consume("extern")) {
       SmallVector<SymbolVersion, 0> ext = readVersionExtern();
       v->insert(v->end(), ext.begin(), ext.end());
     } else {
+      if (consume("local:") || (consume("local") && consume(":"))) {
----------------
MaskRay wrote:

I think this introduces a bug that a symbol named `local` or `global` will not be accepted.

The "local" and "global" name check should be performed after `next()`. 

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


More information about the llvm-commits mailing list