]> granicus.if.org Git - clang/commitdiff
Replace 'clang --analyze' example for attribute cf_returns_retained with screenshots.
authorTed Kremenek <kremenek@apple.com>
Wed, 24 Jun 2009 19:04:37 +0000 (19:04 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 24 Jun 2009 19:04:37 +0000 (19:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74098 91177308-0d34-0410-b5e6-96231b3b80d8

www/analyzer/annotations.html
www/analyzer/images/example_cf_returns_retained.png [new file with mode: 0644]
www/analyzer/images/example_cf_returns_retained_gc.png [new file with mode: 0644]

index f76dbee12ae21090acc5c856f1baec2e2f2f2f4d..7d509ed5dbb1f23a4a4362603161cd8dc51460fa 100644 (file)
@@ -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
new file mode 100644 (file)
index 0000000..3a3cb97
Binary files /dev/null and b/www/analyzer/images/example_cf_returns_retained.png differ
diff --git a/www/analyzer/images/example_cf_returns_retained_gc.png b/www/analyzer/images/example_cf_returns_retained_gc.png
new file mode 100644 (file)
index 0000000..023f1a2
Binary files /dev/null and b/www/analyzer/images/example_cf_returns_retained_gc.png differ