summaryrefslogtreecommitdiffstats
path: root/test/Analysis/initializer.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
committerdim <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
commit056abd2059c65a3e908193aeae16fad98017437c (patch)
tree2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /test/Analysis/initializer.cpp
parentcc73504950eb7b5dff2dded9bedd67bc36d64641 (diff)
downloadFreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.zip
FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.tar.gz
Vendor import of clang release_32 branch r168974 (effectively, 3.2 RC2):
http://llvm.org/svn/llvm-project/cfe/branches/release_32@168974
Diffstat (limited to 'test/Analysis/initializer.cpp')
-rw-r--r--test/Analysis/initializer.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/test/Analysis/initializer.cpp b/test/Analysis/initializer.cpp
index d43c8cf..92d581b 100644
--- a/test/Analysis/initializer.cpp
+++ b/test/Analysis/initializer.cpp
@@ -1,6 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-store region -cfg-add-implicit-dtors -std=c++11 -verify %s
-
-// We don't inline constructors unless we have destructors turned on.
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,debug.ExprInspection -analyzer-ipa=inlining -analyzer-config c++-inlining=constructors -std=c++11 -verify %s
void clang_analyzer_eval(bool);
@@ -57,10 +55,6 @@ void testDelegatingConstructor() {
}
-// ------------------------------------
-// False negatives
-// ------------------------------------
-
struct RefWrapper {
RefWrapper(int *p) : x(*p) {}
RefWrapper(int &r) : x(r) {}
@@ -69,10 +63,20 @@ struct RefWrapper {
void testReferenceMember() {
int *p = 0;
- RefWrapper X(p); // should warn in the constructor
+ RefWrapper X(p); // expected-warning@-7 {{Dereference of null pointer}}
}
void testReferenceMember2() {
int *p = 0;
- RefWrapper X(*p); // should warn here
+ // FIXME: We should warn here, since we're creating the reference here.
+ RefWrapper X(*p); // expected-warning@-12 {{Dereference of null pointer}}
}
+
+
+extern "C" char *strdup(const char *);
+
+class StringWrapper {
+ char *str;
+public:
+ StringWrapper(const char *input) : str(strdup(input)) {} // no-warning
+};
OpenPOWER on IntegriCloud