diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-06-24 19:04:37 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-06-24 19:04:37 +0000 |
commit | 6fe1ef2bbbf2ccf42c935e2a8b857fcfffdb1374 (patch) | |
tree | 9ef5d680c2e2e03d62114ebbdc8328eadd97cd1f | |
parent | 7d277e25e085c4905bc11e7fbc377253d9fb0177 (diff) |
Replace 'clang --analyze' example for attribute cf_returns_retained with screenshots.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74098 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | www/analyzer/annotations.html | 26 | ||||
-rw-r--r-- | www/analyzer/images/example_cf_returns_retained.png | bin | 0 -> 47314 bytes | |||
-rw-r--r-- | www/analyzer/images/example_cf_returns_retained_gc.png | bin | 0 -> 46925 bytes |
3 files changed, 12 insertions, 14 deletions
diff --git a/www/analyzer/annotations.html b/www/analyzer/annotations.html index f76dbee12a..7d509ed5db 100644 --- a/www/analyzer/annotations.html +++ b/www/analyzer/annotations.html @@ -259,22 +259,20 @@ CFDateRef returnsRetainedCFDate() { return (NSDate*) returnsRetainedCFDate(); // Report a leak when using GC. } @end +</pre> -<span class="command">$ clang --analyze test.m</span> -test.m:28:20: warning: Potential leak of an object allocated on line 28 - return (NSDate*) returnsRetainedCFDate(); // Always report a leak. - ^ -1 diagnostic generated. +<p>Running <tt>scan-build</tt> on this example produces the following output:</p> -<span class="command">$ clang --analyze test.m <span class="code_highlight">-fobjc-gc-only</span></span> -test.m:28:20: warning: Potential leak (when using garbage collection) of an object allocated on line 28 - return (NSDate*) returnsRetainedCFDate(); // Always report a leak. - ^ -test.m:32:20: warning: Potential leak (when using garbage collection) of an object allocated on line 32 - return (NSDate*) returnsRetainedCFDate(); // Report a leak when using GC. - ^ -2 diagnostics generated. -</pre> +<img src="images/example_cf_returns_retained.png"> + +</p>When the above code is compiled using Objective-C garbage collection (i.e., +code is compiled with the flag <tt>-fobjc-gc</tt> or <tt>-fobjc-gc-only</tt>), +<tt>scan-build</tt> produces both the above error (with slightly different text +to indicate the code uses garbage collection) as well as the following warning, +which indicates a leak that occurs <em>only</em> when using garbage +collection:</p> + +<img src="images/example_cf_returns_retained_gc.png"> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <h2 id="custom_assertions">Custom Assertion Handlers</h2> diff --git a/www/analyzer/images/example_cf_returns_retained.png b/www/analyzer/images/example_cf_returns_retained.png Binary files differnew file mode 100644 index 0000000000..3a3cb973a9 --- /dev/null +++ b/www/analyzer/images/example_cf_returns_retained.png diff --git a/www/analyzer/images/example_cf_returns_retained_gc.png b/www/analyzer/images/example_cf_returns_retained_gc.png Binary files differnew file mode 100644 index 0000000000..023f1a2f20 --- /dev/null +++ b/www/analyzer/images/example_cf_returns_retained_gc.png |