diff options
| author | Ted Kremenek <kremenek@apple.com> | 2011-03-31 04:04:48 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2011-03-31 04:04:48 +0000 |
| commit | 61a4f6682ae0837f2590e0cd8e60ce342ea9ff42 (patch) | |
| tree | 4c1478f414d2aba36336813a674748650bc352f8 /clang/test | |
| parent | ae044c06bf530c0aaf5038c7e69b202e350a8fbd (diff) | |
| download | bcm5719-llvm-61a4f6682ae0837f2590e0cd8e60ce342ea9ff42.tar.gz bcm5719-llvm-61a4f6682ae0837f2590e0cd8e60ce342ea9ff42.zip | |
Teach static analyzer about the basics of handling new[]. We still don't simulate constructors, but at least the analyzer doesn't think the return value is uninitialized.
llvm-svn: 128611
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Analysis/misc-ps-region-store.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Analysis/misc-ps-region-store.cpp b/clang/test/Analysis/misc-ps-region-store.cpp index 3b8d4e37820..26a31526b74 100644 --- a/clang/test/Analysis/misc-ps-region-store.cpp +++ b/clang/test/Analysis/misc-ps-region-store.cpp @@ -255,4 +255,12 @@ bool RDar9203355::foo(unsigned valA, int &result) const { return false; } +// Test handling of new[]. +void rdar9212512() { + int *x = new int[10]; + for (unsigned i = 0 ; i < 2 ; ++i) { + // This previously triggered an uninitialized values warning. + x[i] = 1; // no-warning + } +} |

