diff options
author | Anna Zaks <ganna@apple.com> | 2012-05-11 23:34:14 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-05-11 23:34:14 +0000 |
commit | 3236bad851150e1ce35b84d17c25d1ec04c51050 (patch) | |
tree | 3268bf5727e2cd41404a6bdf654954761a4f96f9 /clang | |
parent | 0661b81bca9e6cb68b6a37470ed3d92c61d3593b (diff) | |
download | bcm5719-llvm-3236bad851150e1ce35b84d17c25d1ec04c51050.tar.gz bcm5719-llvm-3236bad851150e1ce35b84d17c25d1ec04c51050.zip |
[analyzer] Test variable modified types.
llvm-svn: 156664
Diffstat (limited to 'clang')
-rw-r--r-- | clang/test/Analysis/test-variably-modified-types.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/Analysis/test-variably-modified-types.c b/clang/test/Analysis/test-variably-modified-types.c new file mode 100644 index 00000000000..a833434228d --- /dev/null +++ b/clang/test/Analysis/test-variably-modified-types.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyze-function=testVariablyModifiedTypes -verify %s + +// Test that we process variably modified type correctly - the call graph construction should pick up function_with_bug while recursively visiting test_variably_modifiable_types. +unsigned getArraySize(int *x) { + if (!x) + return *x; // expected-warning {{Dereference of null pointer}} + return 1; +} + +int testVariablyModifiedTypes(int *x) { + int mytype[getArraySize(x)]; + return 0; +} |