r190353 - Fix a crash introduced in r189828.

Eli Friedman eli.friedman at gmail.com
Mon Sep 9 15:08:47 PDT 2013


On Mon, Sep 9, 2013 at 2:07 PM, Matt Beaumont-Gay <matthewbg at google.com>wrote:

> Author: matthewbg
> Date: Mon Sep  9 16:07:58 2013
> New Revision: 190353
>
> URL: http://llvm.org/viewvc/llvm-project?rev=190353&view=rev
> Log:
> Fix a crash introduced in r189828.
>
> The predicates in CXXRecordDecl which test various properties of special
> members can't be called on incomplete decls.
>
> Modified:
>     cfe/trunk/lib/Analysis/CFG.cpp
>     cfe/trunk/test/Analysis/dtor.cpp
>
> Modified: cfe/trunk/lib/Analysis/CFG.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=190353&r1=190352&r2=190353&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Analysis/CFG.cpp (original)
> +++ cfe/trunk/lib/Analysis/CFG.cpp Mon Sep  9 16:07:58 2013
> @@ -3133,7 +3133,7 @@ CFGBlock *CFGBuilder::VisitCXXDeleteExpr
>    DTy = DTy.getNonReferenceType();
>    CXXRecordDecl *RD =
> Context->getBaseElementType(DTy)->getAsCXXRecordDecl();
>    if (RD) {
> -    if (!RD->hasTrivialDestructor())
> +    if (RD->isCompleteDefinition() && !RD->hasTrivialDestructor())
>        appendDeleteDtor(Block, RD, DE);
>    }
>
>
> Modified: cfe/trunk/test/Analysis/dtor.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dtor.cpp?rev=190353&r1=190352&r2=190353&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/Analysis/dtor.cpp (original)
> +++ cfe/trunk/test/Analysis/dtor.cpp Mon Sep  9 16:07:58 2013
> @@ -431,3 +431,8 @@ namespace PseudoDtor {
>      clang_analyzer_eval(true); // expected-warning{{TRUE}}
>    }
>  }
> +
> +namespace Incomplete {
> +  class Foo; // expected-note{{forward declaration}}
> +  void f(Foo *foo) { delete foo; } // expected-warning{{deleting pointer
> to incomplete type}}
> +}
>
>
Is this the same as PR17162?

-Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130909/014aff18/attachment.html>


More information about the cfe-commits mailing list