Page MenuHomePhabricator

[llvm-objcopy][NFC] Refactor symbol/section matching

Authored by rupprecht on Aug 19 2019, 11:04 AM.



The matchers for section/symbol related flags (e.g. --keep-symbol=Name or --regex --keep-symbol=foo.*) are currently just vectors that are matched linearlly. However, adding wildcard support would require negative matching too, e.g. a symbol should be removed if it matches a wildcard *but* doesn't match some other wildcard.

To make the next patch simpler, consolidate matching logic to a class defined in CopyConfig that takes care of matching.

Diff Detail


Event Timeline

rupprecht created this revision.Aug 19 2019, 11:04 AM

Looks good. With a nit:

108 ↗(On Diff #215952)

AddMatcher and Matches should not be capitalized.

jhenderson added inline comments.Aug 20 2019, 2:23 AM
101 ↗(On Diff #215952)

Maybe worth a comment?

Also MatcherSet probably is a bad name, since it's more a vector than a set...

How about NameMatcher?

rupprecht marked 2 inline comments as done.
  • Fix method casing
  • Change class name to NameMatcher
MaskRay accepted this revision.Aug 20 2019, 5:51 PM
This revision is now accepted and ready to land.Aug 20 2019, 5:51 PM
seiya accepted this revision.Aug 22 2019, 1:09 AM
This revision was automatically updated to reflect the committed changes.