This is an archive of the discontinued LLVM Phabricator instance.

[Clang][Sema] Refactor category declaration under CheckForIncompatibleAttributes. NFC
ClosedPublic

Authored by eopXD on Nov 7 2022, 9:48 AM.

Details

Summary

This change would allow extension of new categories be aware of adding
more code here.

This patch also updates the comments, which was originally missing the
vector predicate.

Diff Detail

Event Timeline

eopXD created this revision.Nov 7 2022, 9:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2022, 9:48 AM
eopXD requested review of this revision.Nov 7 2022, 9:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 7 2022, 9:48 AM
eopXD added a comment.EditedNov 7 2022, 9:51 AM

Upon modification to this code base I am tempt to prefer having a NumberOfCategories under the enum and make the sanity check explicit. I understand this is totally a problem of personal taste so definitely feel free to argue with me :)

eopXD edited the summary of this revision. (Show Details)Nov 7 2022, 9:53 AM
aaron.ballman added a subscriber: aaron.ballman.

This seems reasonable to me, but I'll leave the final sign-off to Erich.

clang/lib/Sema/SemaStmtAttr.cpp
335–336

Might as well rely on value initalization instead of a runtime call to memset.

shafik added a subscriber: shafik.Nov 11 2022, 9:36 AM
shafik added inline comments.
clang/lib/Sema/SemaStmtAttr.cpp
319

Can you break up this comment, I think it should go above the enum and each one that is specific to an enumerator should go above that enumerator.

335–336

You can use {} to initialize the array. This will value-initialize each element, which for pointers will set it to zero.

I haven't dealt much with the loop hint attributes, but two of my coworkers have done extensive work in our downstream (@jyu2 and @mikerice), and likely have feedback about how this affects downstream feedback.

eopXD updated this revision to Diff 475043.Nov 13 2022, 7:24 PM
eopXD marked 3 inline comments as done.

Address comments from reviewers.

eopXD updated this revision to Diff 475044.Nov 13 2022, 7:25 PM

Minor update in comments.

I haven't dealt much with the loop hint attributes, but two of my coworkers have done extensive work in our downstream (@jyu2 and @mikerice), and likely have feedback about how this affects downstream feedback.

Looks good to me.

jyu2 added a comment.Nov 15 2022, 8:59 AM

It is okay with me.

eopXD added a comment.Nov 15 2022, 1:19 PM

@mikerice @jyu2
May you accept the revision please if this patch looks good to you? Thank you :)

mikerice accepted this revision.Nov 15 2022, 1:22 PM
This revision is now accepted and ready to land.Nov 15 2022, 1:22 PM
eopXD updated this revision to Diff 475563.Nov 15 2022, 1:26 PM

Rebase to latest main.

This revision was automatically updated to reflect the committed changes.