diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-11-15 19:11:27 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-11-15 19:11:27 +0000 |
commit | b5b0fc196e8768076c3c9155cd79b248623861de (patch) | |
tree | f712d0d90710a553f0463760c530052266204c51 /clang/test/Analysis/malloc.c | |
parent | 38990beed80119f7ee5f7da6a69efa6207f886ab (diff) | |
download | bcm5719-llvm-b5b0fc196e8768076c3c9155cd79b248623861de.tar.gz bcm5719-llvm-b5b0fc196e8768076c3c9155cd79b248623861de.zip |
[analyzer] Mark symbol values as dead in the environment.
This allows us to properly remove dead bindings at the end of the top-level
stack frame, using the ReturnStmt, if there is one, to keep the return value
live. This in turn removes the need for a check::EndPath callback in leak
checkers.
This does cause some changes in the path notes for leak checkers. Previously,
a leak would be reported at the location of the closing brace in a function.
Now, it gets reported at the last statement. This matches the way leaks are
currently reported for inlined functions, but is less than ideal for both.
llvm-svn: 168066
Diffstat (limited to 'clang/test/Analysis/malloc.c')
-rw-r--r-- | clang/test/Analysis/malloc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/test/Analysis/malloc.c b/clang/test/Analysis/malloc.c index b939ac36d1a..76dd3a8fda3 100644 --- a/clang/test/Analysis/malloc.c +++ b/clang/test/Analysis/malloc.c @@ -1030,6 +1030,11 @@ void *test(void *ptr) { return newPtr; } + +char *testLeakWithinReturn(char *str) { + return strdup(strdup(str)); // expected-warning{{leak}} +} + // ---------------------------------------------------------------------------- // False negatives. |