HomePhabricator

Use tablegen to diagnose mutually exclusive attributes

Authored by aaron.ballman on Apr 2 2021, 1:33 PM.

Description

Use tablegen to diagnose mutually exclusive attributes

Currently, when one or more attributes are mutually exclusive, the
developer adding the attribute has to manually emit diagnostics. In
practice, this is highly error prone, especially for declaration
attributes, because such checking is not trivial. Redeclarations
require you to write a "merge" function to diagnose mutually exclusive
attributes and most attributes get this wrong.

This patch introduces a table-generated way to specify that a group of
two or more attributes are mutually exclusive:

def : MutualExclusions<[Attr1, Attr2, Attr3]>;

This works for both statement and declaration attributes (but not type
attributes) and the checking is done either from the common attribute
diagnostic checking code or from within mergeDeclAttribute() when
merging redeclarations.

Details

Committed
aaron.ballmanApr 2 2021, 1:34 PM
Parents
rGf02c6984d76c: [NFC][scudo] Split ScudoCombinedTest.BasicCombined
Branches
Unknown
Tags
Unknown