This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Handle every global as unversioned export in versioned script.
ClosedPublic

Authored by grimar on Jun 16 2016, 10:04 AM.

Diff Detail

Event Timeline

grimar updated this revision to Diff 60990.Jun 16 2016, 10:04 AM
grimar retitled this revision from to [ELF] - Handle every global as unversioned export in versioned script..
grimar updated this object.
grimar added reviewers: rafael, ruiu.
grimar added subscribers: llvm-commits, grimar.
ruiu edited edge metadata.Jun 16 2016, 10:17 AM

Can you organize this as a part of recursive descendant parser? You can create a function parseVersion and do something like this.

if (peek() == "{") {
  parseVersin();
  if (!atEOF())
    setError("anonymous version definition is used in combination with other version definitions");
  return;
}
while (!atEOF()) {
  StringRef Version = next();
  parseVersion();
}
grimar updated this revision to Diff 60995.Jun 16 2016, 10:59 AM
grimar edited edge metadata.
  • Reimplemented using recursive descendant parser.
  • Improved testcase.
In D21439#460016, @ruiu wrote:

Can you organize this as a part of recursive descendant parser? You can create a function parseVersion and do something like this.

if (peek() == "{") {
  parseVersin();
  if (!atEOF())
    setError("anonymous version definition is used in combination with other version definitions");
  return;
}
while (!atEOF()) {
  StringRef Version = next();
  parseVersion();
}

Looks really better IMO. Thanks for hint !

ruiu added a comment.Jun 16 2016, 11:05 AM

LGTM with nits.

ELF/SymbolListFile.cpp
111

I'd call it Msg.

Acutally, my preference is to use goto to jump to the end of the function and call setError("anonymous version def..."), but probably there are many people who don't like it, so I'm okay with this.

122

Let's return after setError(). (And remove else.)

This revision was automatically updated to reflect the committed changes.
grimar marked an inline comment as done.