[cfe-commits] [PATCH][Review Request]Handle CXXTemproraryObjectExpr
Jim Goodnow II
Jim at TheGoodnows.net
Wed Oct 5 04:25:44 PDT 2011
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. :)
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CXXTemporaryObjectTest.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111005/beac1b38/attachment.ksh>
More information about the cfe-commits
mailing list