<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Mar 28, 2012, at 12:03 PM, John McCall wrote:</div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Mar 28, 2012, at 11:50 AM, Richard Smith wrote:</div><blockquote type="cite"><div class="gmail_quote">On Wed, Mar 28, 2012 at 11:33 AM, Stepan Dyatkovskiy <span dir="ltr"><<a href="mailto:stpworld@narod.ru">stpworld@narod.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello John.<br>
I attached reworked patch.<br>
I couldn't found in CXXRecordDecl methods like "isFinal", but I know only 2 ways to make class final in C++:<br>
<br>
1. Make dtor private (will work only with dynamic allocation):<br>
<br>
class Final {<br>
~Final() {}<br>
public:<br>
Final* create() { return new Final(); }<br>
};<br>
<br>
2. Make dtor and ctor private, and create friend-child using virtual inharitance:<br>
<br>
class Finalizer {<br>
Final() {}<br>
~Final() {}<br>
friend class Final;<br>
};<br>
<br>
class Final : virtual public Finalizer {<br>
};<br>
<br>
As I found, second way in clang doesn't use EmitAggregateCopy for assignment "Final = Final", so I wrote the check for first case only.<br></blockquote><div><br></div><div>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:</div>
<div><br></div><div>class Final final {</div><div>};</div><div><br></div><div>You can check for this with Record->hasAttr<FinalAttr>().</div></div></blockquote><br></div><div>Exactly. I'm just going to rewrite the patch, though.</div></div></blockquote><br></div><div>Rewritten and committed as r153613.</div><div><br></div><div>John.</div><br></body></html>