[cfe-commits] [PATCH][Review Request]Handle CXXTemproraryObjectExpr

Ted Kremenek kremenek at apple.com
Fri Oct 7 15:50:28 PDT 2011


Looks great.

Applied in r141433!

On Oct 5, 2011, at 4:25 AM, Jim Goodnow II wrote:

> Hmm, how's this? About all that CXXConstructExpr currently does is invalidate arguments. The only difference between CXXConstructExpr and CXXTemporaryObjectExpr is some source type information and that CXXTemporaryObjectExpr's have none or more than one argument. So, this test verifies that the constructor is handled by the engine now and verifies that arguments are invalidated.
> 
> - jim
> 
> Index: test/Analysis/misc-ps-cxx0x.cpp
> ===================================================================
> --- test/Analysis/misc-ps-cxx0x.cpp    (revision 141126)
> +++ test/Analysis/misc-ps-cxx0x.cpp    (working copy)
> @@ -9,3 +9,27 @@
>   *p = 0xDEADBEEF; // expected-warning {{null}}
> }
> 
> +// Tests for CXXTemporaryObjectExpr.
> +struct X {
> +    X( int *ip, int );
> +};
> +
> +// Test to see if CXXTemporaryObjectExpr is being handled.
> +int tempobj1()
> +{
> +  int j;
> +  int i;
> +  X a = X( &j, 1 );
> +
> +  return i; // expected-warning {{Undefined or garbage value returned to caller}}
> +}
> +
> +// Test to see if CXXTemporaryObjectExpr invalidates arguments.
> +int tempobj2()
> +{
> +  int j;
> +  X a = X( &j, 1 );
> +
> +  return j; // no-warning
> +}
> +
> 
> 
> On 10/4/2011 3:21 PM, Ted Kremenek wrote:
>> Test case please.  :)
>> 
> <CXXTemporaryObjectTest.patch>




More information about the cfe-commits mailing list