[cfe-commits] r156664 - /cfe/trunk/test/Analysis/test-variably-modified-types.c

Anna Zaks ganna at apple.com
Fri May 11 16:34:14 PDT 2012


Author: zaks
Date: Fri May 11 18:34:14 2012
New Revision: 156664

URL: http://llvm.org/viewvc/llvm-project?rev=156664&view=rev
Log:
[analyzer] Test variable modified types.

Added:
    cfe/trunk/test/Analysis/test-variably-modified-types.c

Added: cfe/trunk/test/Analysis/test-variably-modified-types.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/test-variably-modified-types.c?rev=156664&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/test-variably-modified-types.c (added)
+++ cfe/trunk/test/Analysis/test-variably-modified-types.c Fri May 11 18:34:14 2012
@@ -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;
+}





More information about the cfe-commits mailing list