diff options
author | dim <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
commit | 554bcb69c2d785a011a30e7db87a36a87fe7db10 (patch) | |
tree | 9abb1a658a297776086f4e0dfa6ca533de02104e /test/Analysis/ctor-inlining.mm | |
parent | bb67ca86b31f67faee50bd10c3b036d65751745a (diff) | |
download | FreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.zip FreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.tar.gz |
Vendor import of clang trunk r161861:
http://llvm.org/svn/llvm-project/cfe/trunk@161861
Diffstat (limited to 'test/Analysis/ctor-inlining.mm')
-rw-r--r-- | test/Analysis/ctor-inlining.mm | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/Analysis/ctor-inlining.mm b/test/Analysis/ctor-inlining.mm new file mode 100644 index 0000000..54d51b4 --- /dev/null +++ b/test/Analysis/ctor-inlining.mm @@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -fobjc-arc -cfg-add-implicit-dtors -Wno-null-dereference -verify %s + +void clang_analyzer_eval(bool); + +struct Wrapper { + __strong id obj; +}; + +void test() { + Wrapper w; + // force a diagnostic + *(char *)0 = 1; // expected-warning{{Dereference of null pointer}} +} + + +struct IntWrapper { + int x; +}; + +void testCopyConstructor() { + IntWrapper a; + a.x = 42; + + IntWrapper b(a); + clang_analyzer_eval(b.x == 42); // expected-warning{{TRUE}} +} + +struct NonPODIntWrapper { + int x; + + virtual int get(); +}; + +void testNonPODCopyConstructor() { + NonPODIntWrapper a; + a.x = 42; + + NonPODIntWrapper b(a); + clang_analyzer_eval(b.x == 42); // expected-warning{{TRUE}} +} + |