summaryrefslogtreecommitdiffstats
path: root/test/Analysis/initializer.cpp
diff options
context:
space:
mode:
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