[PATCH] D30500: [ELF] - Do not treat colon(":") as separate token in script parser.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 09:37:38 PST 2017


grimar added inline comments.


================
Comment at: ELF/LinkerScript.cpp:1943-1944
   // no label, we assume global symbols.
-  if (peek() != "local") {
-    if (consume("global"))
-      expect(":");
+  if (!peekLabel("local:")) {
+    consumeLabel("global:");
     for (SymbolVersion V : readSymbols())
----------------
ruiu wrote:
> grimar wrote:
> > ruiu wrote:
> > > I think you can do that without defining `peekLabel`. You should remove the first two lines from readLocals().
> > This place is not a problem to avoid use of peekLabel. But 
> > ScriptParser::readSymbols() need it anyways I believe:
> > ```
> >     if (peek() == "}" || Error || peekLabel("local:"))
> >       break;
> > ```
> > 
> > We have to know when to get out from readSymbols, one of conditions is when we meet "local"
> Do you mean it is impossible? If not, please try to edit other functions.
Almost nothing is impossible usually.
I'll try tomorrow though don`t think I understand why it is ok to have peek()/consume() and not ok to have peekLable + consumeLable. Isn't that consistent ?


https://reviews.llvm.org/D30500





More information about the llvm-commits mailing list