This is an archive of the discontinued LLVM Phabricator instance.

[NFC][Driver] Change Multilib flag representation
ClosedPublic

Authored by michaelplatings on May 25 2023, 6:10 AM.

Details

Summary

This new representation means that if a string is a valid command line
option then it can also be used to indicate that the option is required
by a multilib.

To indicate that a flag is required not to be present, its first
character is replaced with '!', which is intended for consistency with
the logical not operator in many programming languages.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2023, 6:10 AM
michaelplatings requested review of this revision.May 25 2023, 6:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2023, 6:10 AM

@phosek you made some alternative suggestions:

  1. Have two separate lists of include and exclude flags.
  2. Store flags as a tuple (or a struct?) of string and a tag (that is include or exclude).

The reason for not doing that is to keep multilib selection method conceptually simple: a multilib is a match if its flags are a subset of flags generated from command line arguments. Although historically the Multilib class has had the concept of flags being indicated or contraindicated, I've found that's not needed for the proposed configurable multilib scheme. Therefore I'd prefer not to codify that concept within the Multilib class any more than it already is. Over time I expect "contraindicated" flags like !fexceptions to be used less and less, in favour of real flags like -fno-exceptions.

simon_tatham accepted this revision.Jun 5 2023, 8:50 AM
simon_tatham added a subscriber: simon_tatham.

LGTM, but please wait at least a day for other people to have last-minute thoughts.

This revision is now accepted and ready to land.Jun 5 2023, 8:50 AM

Update unit tests

This revision was automatically updated to reflect the committed changes.