On Mar 28, 2012, at 11:50 AM, Richard Smith wrote: > On Wed, Mar 28, 2012 at 11:33 AM, Stepan Dyatkovskiy <[email protected]> > wrote: > Hello John. > I attached reworked patch. > I couldn't found in CXXRecordDecl methods like "isFinal", but I know only 2 > ways to make class final in C++: > > 1. Make dtor private (will work only with dynamic allocation): > > class Final { > ~Final() {} > public: > Final* create() { return new Final(); } > }; > > 2. Make dtor and ctor private, and create friend-child using virtual > inharitance: > > class Finalizer { > Final() {} > ~Final() {} > friend class Final; > }; > > class Final : virtual public Finalizer { > }; > > As I found, second way in clang doesn't use EmitAggregateCopy for assignment > "Final = Final", so I wrote the check for first case only. > > In case 1, Final can still be derived from in friends and members of the > class. In case 2, it can still be derived from in friends and members of > Finalizer, and in members of Final. John is referring to the C++11 'final' > feature: > > class Final final { > }; > > You can check for this with Record->hasAttr<FinalAttr>().
Exactly. I'm just going to rewrite the patch, though. John.
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
