This is an archive of the discontinued LLVM Phabricator instance.

[AST Printer] Print attributes on enum constants
ClosedPublic

Authored by jordan_rose on Jan 19 2017, 4:01 PM.

Details

Summary

The AST printer was dropping attributes on enumerators (enum constants). Now it's not.

Diff Detail

Repository
rL LLVM

Event Timeline

jordan_rose created this revision.Jan 19 2017, 4:01 PM
aaron.ballman accepted this revision.Jan 19 2017, 4:15 PM
aaron.ballman added a subscriber: aaron.ballman.

LGTM, though if you wanted to add one more test with a C++ attribute (deprecated would work in C++14 mode), that would not make me sad. Something like:

enum [[deprecated]] E {
  One [[deprecated]] 
};
This revision is now accepted and ready to land.Jan 19 2017, 4:15 PM

Good idea, will do.

Interestingly, this case doesn't actually work yet; we unconditionally print enum attributes after the close-brace even though that's not valid for C++ attributes. Do you think I should change that as well, or just land this patch as is?

Interestingly, this case doesn't actually work yet; we unconditionally print enum attributes after the close-brace even though that's not valid for C++ attributes. Do you think I should change that as well, or just land this patch as is?

This is a pervasive issue with attributes, now that I put my thinking cap on. I think you're fine to land it as-is; we need a much larger fix to handle pretty printing attributes properly for all flavors.

jordan_rose closed this revision.Jan 19 2017, 7:45 PM

Landed as-is in rL292571.