[cfe-commits] r70235 - in /cfe/trunk: include/clang/AST/Attr.h include/clang/Parse/AttributeList.h lib/Analysis/CFRefCount.cpp lib/Frontend/PCHReaderDecl.cpp lib/Frontend/PCHWriter.cpp lib/Parse/AttributeList.cpp lib/Sema/SemaDeclAttr.cpp test/Analysis/retain-release-gc-only.m test/Analysis/retain-release.m

Matthew Jimenez tastic at bycrom.org
Mon Apr 27 21:10:12 PDT 2009


On Apr 27, 2009, at 2:37 PM, Ted Kremenek wrote:
>
<snip />
>
> Modified: cfe/trunk/test/Analysis/retain-release.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=70235&r1=70234&r2=70235&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/test/Analysis/retain-release.m (original)
> +++ cfe/trunk/test/Analysis/retain-release.m Mon Apr 27 14:36:56 2009
> @@ -413,6 +413,8 @@
> - (NSString*) returnsAnOwnedString  
> __attribute__((objc_ownership_returns));
> - (void) myRetain:(id)__attribute__((objc_ownership_retain))obj;
> - (void) myCFRetain:(id)__attribute__((objc_ownership_cfretain))obj;
> +- (void) myRelease:(id)__attribute__((objc_ownership_release))obj;
> +- (void) myCFRelease: 
> (id)__attribute__((objc_ownership_cfrelease))obj;
> @end
>
> void test_attr_1(TestOwnershipAttr *X) {
> @@ -431,3 +433,15 @@
>   [str release];
> }
>
> +void test_attr_4(TestOwnershipAttr *X) {
> +  NSString *str = [X returnsAnOwnedString]; // expected- 
> warning{{leak}}
> +  [X myRetain:str];
> +  [X myRelease:str];
> +}
> +
> +void test_attr_5(TestOwnershipAttr *X) {
> +  NSString *str = [X returnsAnOwnedString]; // expected- 
> warning{{leak}}
> +  [X myCFRetain:str];
> +  [X myCFRelease:str];
> +}
> +
>


Hi!

Wouldn't the expected leak occur regardless of whether the  
objc_ownership_release and objc_ownership_cfrelease attributes had  
their intended effect or not?
Did I misunderstand the purpose of the test?

-Matthew



More information about the cfe-commits mailing list