[cfe-commits] [PATCH] CFG automatic object destructors
Marcin Świderski
marcin.sfider at gmail.com
Thu Sep 30 00:42:51 PDT 2010
Thanks for noticing. I will fix this.
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.
Is this okay?
W dniu 30 września 2010 04:43 użytkownik Zhongxing Xu <xuzhongxing at gmail.com
> napisał:
> Hi Marcin,
>
> + // Check if type is a C++ class with non-trivial destructor.
>
> + const RecordType* RT = QT.getTypePtr()->getAs<RecordType>();
> + if (!RT || cast<CXXRecordDecl>(RT->getDecl())->hasTrivialDestructor())
> + return Scope;
>
> RecordType is not necessarily CXXRecordType. cast<CXXRecordDecl> would
> cause crashes. We could do something like this:
>
> if (const RecordType *RT = QT->getAs<RecordType>())
> if (CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl()))
> if (!ClassDecl->hasTrivialDestructor()) {
>
> // Add the variable to scope
> Scope = createOrReuseLocalScope(Scope);
> Scope->addVar(VD);
> ScopePos = Scope->begin();
> }
> return Scope;
>
> 2010/9/28 Marcin Świderski <marcin.sfider at gmail.com>
>
>> 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.
>>
>> I've added some test cases. They can be later used to create regresion
>> tests.
>>
>> Please approve for commit.
>>
>> Marcin
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100930/aade238f/attachment.html>
More information about the cfe-commits
mailing list