summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-08-30 19:17:26 +0000
committerJordan Rose <jordan_rose@apple.com>2013-08-30 19:17:26 +0000
commite600025528eaa1c43e5084bab219f8f467b4731e (patch)
treedba522f70a20da7cc775891bad2177eedd4b245b /clang/test
parent525dc284b4ee066b33ae76de5e6467d2191da442 (diff)
downloadbcm5719-llvm-e600025528eaa1c43e5084bab219f8f467b4731e.tar.gz
bcm5719-llvm-e600025528eaa1c43e5084bab219f8f467b4731e.zip
[analyzer] Treat the rvalue of a forward-declared struct as Unknown.
This will never happen in the analyzed code code, but can happen for checkers that over-eagerly dereference pointers without checking that it's safe. UnknownVal is a harmless enough value to get back. Fixes an issue added in r189590, caught by our internal buildbot. llvm-svn: 189688
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Analysis/taint-tester.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/test/Analysis/taint-tester.cpp b/clang/test/Analysis/taint-tester.cpp
index f97eefb950e..ca7b729f269 100644
--- a/clang/test/Analysis/taint-tester.cpp
+++ b/clang/test/Analysis/taint-tester.cpp
@@ -6,7 +6,8 @@ typedef __typeof(sizeof(int)) size_t;
extern FILE *stdin;
typedef long ssize_t;
ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
-int printf(const char * __restrict, ...);
+int printf(const char * __restrict, ...);
+int snprintf(char *, size_t, const char *, ...);
void free(void *ptr);
struct GetLineTestStruct {
@@ -25,3 +26,10 @@ void getlineTest(void) {
}
free(line);
}
+
+class opaque;
+void testOpaqueClass(opaque *obj) {
+ char buf[20];
+ snprintf(buf, 20, "%p", obj); // don't crash trying to load *obj
+}
+
OpenPOWER on IntegriCloud