Thanks for noticing. I will fix this.<div><br></div><div>I will commit changes in this patch in few chunks later today. For each chunk I will add test cases (the ones I've send with the patch) to one file in test/Analysis folder, so each commit will introduce regression tests for itself.<br>
<br></div><div>Is this okay?</div><div><br><div class="gmail_quote">W dniu 30 września 2010 04:43 użytkownik Zhongxing Xu <span dir="ltr"><<a href="mailto:xuzhongxing@gmail.com">xuzhongxing@gmail.com</a>></span> napisał:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Marcin,<br><br>+ // Check if type is a C++ class with non-trivial destructor.<div class="im"><br>+ const RecordType* RT = QT.getTypePtr()->getAs<RecordType>();<br>
+ if (!RT || cast<CXXRecordDecl>(RT->getDecl())->hasTrivialDestructor())<br>
+ return Scope;<br><br></div>RecordType is not necessarily CXXRecordType. cast<CXXRecordDecl> would cause crashes. We could do something like this:<br><br> if (const RecordType *RT = QT->getAs<RecordType>())<br>
if (CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl()))<br> if (!ClassDecl->hasTrivialDestructor()) {<div class="im"><br> // Add the variable to scope<br> Scope = createOrReuseLocalScope(Scope);<br>
Scope->addVar(VD);<br> ScopePos = Scope->begin();<br> }<br> return Scope;<br><br></div><div class="gmail_quote"><div class="im">2010/9/28 Marcin Świderski <span dir="ltr"><<a href="mailto:marcin.sfider@gmail.com" target="_blank">marcin.sfider@gmail.com</a>></span><br>
</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div>Patch adds implicit destructors generation for objects with automatic storage duration. Patch is rather big, but it contains all cases (that I thought of), as it will be easier to review as a whole IMO. While commiting I can divide it to smaller chuncks.</div>
<div><div></div><div class="h5">
<div><br></div><div>I've added some test cases. They can be later used to create regresion tests.</div><div><br></div>Please approve for commit. <div><br></div><font color="#888888"><div>Marcin</div>
</font></div></div></blockquote></div><br>
</blockquote></div><br></div>