summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
diff options
context:
space:
mode:
authorKristof Umann <dkszelethus@gmail.com>2018-09-14 10:18:26 +0000
committerKristof Umann <dkszelethus@gmail.com>2018-09-14 10:18:26 +0000
commitf051379fbc3fef3b884088082721a15bc8ee1ead (patch)
tree889ec1cc7e5487755248f7ce4b885e731777d601 /clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
parentd6145d9849f48229980c9243c36cb08c2e45c869 (diff)
downloadbcm5719-llvm-f051379fbc3fef3b884088082721a15bc8ee1ead.tar.gz
bcm5719-llvm-f051379fbc3fef3b884088082721a15bc8ee1ead.zip
[analyzer][UninitializedObjectChecker] Support for nonloc::LocAsInteger
Differential Revision: https://reviews.llvm.org/D49437 llvm-svn: 342221
Diffstat (limited to 'clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp')
-rw-r--r--clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp b/clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
index 4ee113c9e8f..7669ac510f1 100644
--- a/clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
+++ b/clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
@@ -22,6 +22,24 @@ void fConcreteIntLocTest() {
}
//===----------------------------------------------------------------------===//
+// nonloc::LocAsInteger tests.
+//===----------------------------------------------------------------------===//
+
+using intptr_t = long;
+
+struct LocAsIntegerTest {
+ intptr_t ptr; // expected-note{{uninitialized pointee 'reinterpret_cast<char *>(this->ptr)'}}
+ int dontGetFilteredByNonPedanticMode = 0;
+
+ LocAsIntegerTest(void *ptr) : ptr(reinterpret_cast<intptr_t>(ptr)) {} // expected-warning{{1 uninitialized field}}
+};
+
+void fLocAsIntegerTest() {
+ char c;
+ LocAsIntegerTest t(&c);
+}
+
+//===----------------------------------------------------------------------===//
// Null pointer tests.
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud