This is an archive of the discontinued LLVM Phabricator instance.

Fix broken getAttributeSpellingListIndex for pragma attributes
ClosedPublic

Authored by mikerice on Aug 8 2017, 9:36 AM.

Details

Summary

We noticed when implementing a new pragma that the TableGen-generated function getAttributeSpellingListIndex() did not work for pragma attributes. It relies on the values in the enum AttributeList::Syntax and a new value AS_ContextSensitiveKeyword was added changing the value for AS_Pragma. Apparently no tests failed since no pragmas currently make use of the generated function.

To fix this we can move AS_Pragma back to the value that TableGen code expects. Also to prevent changes in the enum from breaking that routine again I added calls to getAttributeSpellingListIndex() in the unroll pragma code. That will cause some lit test failures if the order is changed. I added a comment to remind of this issue in the future.

This assumes we don’t need/want full TableGen support for AS_ContextSensitiveKeyword. It currently only appears in getAttrKind and no other TableGen-generated routines.

Diff Detail

Event Timeline

mikerice created this revision.Aug 8 2017, 9:36 AM
aaron.ballman accepted this revision.Aug 9 2017, 6:32 AM

LGTM, good catch!

This revision is now accepted and ready to land.Aug 9 2017, 6:32 AM
This revision was automatically updated to reflect the committed changes.