erichkeane wrote: > @cor3ntin @erichkeane How would you feel about a conceptually more general > attribute, but remove any stability commitments? > > Specifically, I had in mind that we could rename this something like > `[[__clang_experimental__::__container_of_type__(T)]]` (I'd probably just > hard-code the underscores, since this wouldn't be intended for general use) > and the only guarantee that is being made is that > `__has_cpp_attribute(__clang_experimental__::__container_of_type__)` changes > the value if the implementation changes in any (possibly incompatible with > previous versions) way. That would allow for modifications or removal at any > point, which should remove any maintainability concerns. > > On the libc++ side we'd of course then check for > `__has_cpp_attribute(__clang_experimental__::__container_of_type__) == 1`.
I think that is a uniquely useful attribute here, though I wouldn't do any goofy spellings (we don't tend to do that for attributes). But a 'container-of' attribute is perhaps something useful. I WOULD be interested in exploring how specific we want that to be. In the past, we've considered for optimization opportunities (particularly now that CIR is being worked on) a way to specify WHAT type of container on top of that (contiguous memory, R/B tree, etc). So I'd be interested in seeing something like this fleshed out. https://github.com/llvm/llvm-project/pull/211231 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
