ParsedAttr is using a hand-rolled trailing-objects
implementation that gets cleaned up quite a bit by
just using llvm::TrailingObjects. This is a large
TrailingObjects list, but most things are length '0'.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
include/clang/Sema/ParsedAttr.h | ||
---|---|---|
80 ↗ | (On Diff #159980) | Because all of these became part of the TYPE of ParsedAttr now, they need to be defined outside of ParsedAttr. Additionally, they are now required to be in a non-anonymous namespace. |
525 ↗ | (On Diff #159980) | Unfortunately, these need to return a non-const param, since the only user of these takes a const ParsedAttr and requires the IdentifierInfo* to be a non-const ptr. |
578 ↗ | (On Diff #159980) | Sadly, there isn't a better way to do this with TrailingObjects. The parameter argument list is simply so that it can check to make sure you have them right? I'd much prefer to be able to omit the ones not important to this size, but that doesn't seem possible. Also, it seems that we used to do some things to make sure that these sizes were a multiple of sizeof(void*) as a premature optimization. However, all of these are constant-sized, so over-allocating seems like a useless task. |
lib/Sema/SemaDeclCXX.cpp | ||
15466 ↗ | (On Diff #159980) | The only usage of PropertyData, which didn't seem important to support anymore. |
Looks good, thanks. (I'm not sure why PropertyData needs special handling rather than being treated as two IdentifierLoc arguments, but that's not made any worse here, just perhaps a bit more obvious.)
Some inline comments. Since you already committed it I don't think it
is worth bothering with them.
cfe/trunk/include/clang/Sema/ParsedAttr.h | ||
---|---|---|
124 | I think you can do something like friend TrailingObjects; | |
366 | And maybe it would be nice to delete explicitly the move |
I think you can do something like friend TrailingObjects;
like most (every ?) other users of TrailingObjects do. It relies on the
injected class name if I am not mistaken.