This is an archive of the discontinued LLVM Phabricator instance.

Flag Enumerator Attribute
Needs ReviewPublic

Authored by scshunt on Oct 17 2014, 5:30 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This patch introduces a new attribute, flag_enum, which indicates to the compiler that an enumerator is a flag type. Compiler warnings about the range of values are adjusted accordingly.

Diff Detail

Event Timeline

scshunt updated this revision to Diff 15109.Oct 17 2014, 5:30 PM
scshunt retitled this revision from to Flag Enumerator Attribute.
scshunt updated this object.
scshunt edited the test plan for this revision. (Show Details)
scshunt added a subscriber: Unknown Object (MLST).Oct 17 2014, 5:33 PM

Did you forget to include tests?

scshunt updated this revision to Diff 15112.Oct 17 2014, 11:54 PM

Correctly generate patch to include tests.

scshunt updated this revision to Diff 16410.Nov 19 2014, 7:49 PM
scshunt added a reviewer: aaron.ballman.

This fixes most of the comments from Aaron Ballman.

I've left the C++ attribute syntax off, as I haven't yet considered the semantics in C++ carefully.

aaron.ballman edited edge metadata.Nov 20 2014, 7:54 AM

Sean and I spoke on IRC about this review, and the items we came up with were:

  • Move the FlagBits value off EnumDecl and into the FlagEnumAttr itself
  • Rangeify a for loop
  • Remove another spurious call to getName()

~Aaron

scshunt updated this revision to Diff 16470.Nov 20 2014, 9:12 PM
scshunt edited edge metadata.

A few more comments from Aaron.

On the C++ side, I realized that forward declarations and redeclarations possibly break everything. I don't want to think about that now. It could be made an error in C++ for the time being if that's a large concern, or I could simply work on FIXMEs or a later patch to make it work in C++.

aaron.ballman resigned from this revision.Oct 13 2015, 5:54 AM
aaron.ballman removed a reviewer: aaron.ballman.