This is an archive of the discontinued LLVM Phabricator instance.

[OptTable] Make explicitly included options override excluded ones
ClosedPublic

Authored by bogner on Jul 19 2023, 10:51 AM.

Details

Summary

When we have both explicitly included and excluded option sets, we
were excluding anything from the latter set regardless of what was in
the former. This doesn't compose well and led to an overly complicated
design around DXC options where a third flag was introduced to handle
options that overlapped between DXC and CL.

With this change we check the included options before excluding
anything from the exclude list, which allows for options that are in
multiple categories to be handled in a sensible way. This allows us to
remove CLDXCOption but should otherwise be NFC.

Diff Detail

Event Timeline

bogner created this revision.Jul 19 2023, 10:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 19 2023, 10:51 AM
bogner requested review of this revision.Jul 19 2023, 10:51 AM
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptJul 19 2023, 10:51 AM
python3kgae accepted this revision.Jul 19 2023, 11:04 AM

This is much cleaner.

This revision is now accepted and ready to land.Jul 19 2023, 11:04 AM
beanz accepted this revision.Jul 19 2023, 11:22 AM
bob80905 added inline comments.
clang/include/clang/Driver/Options.h
40

Given that the id for these flags have changed, does it make sense to write a test that makes sure these flags with these bits still behave as expected? (Ignored and target specific, specifically).

bogner added inline comments.Jul 19 2023, 2:27 PM
clang/include/clang/Driver/Options.h
40

The actual values of the flags aren't really visible anywhere (and in the case of ignored, it's actually just changing the value back to what it was before https://reviews.llvm.org/D128462). I'm not sure that there's much we can do to write such a test.

This revision was landed with ongoing or failed builds.Jul 19 2023, 3:29 PM
This revision was automatically updated to reflect the committed changes.

Thank you! The clean up is nice. I missed the original change that added the DXCOption complexity..