[cfe-commits] r167762 - in /cfe/trunk: lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp test/Analysis/retain-release-inline.m

Ted Kremenek kremenek at apple.com
Mon Nov 12 15:04:02 PST 2012


I merged this into the LLVM 3.2 release branch.

On Nov 12, 2012, at 2:06 PM, Anna Zaks <ganna at apple.com> wrote:

> Author: zaks
> Date: Mon Nov 12 16:06:24 2012
> New Revision: 167762
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=167762&view=rev
> Log:
> [analyzer] Fix a regression (from r 165079): compare canonical types.
> 
> Suppresses a leak false positive (radar://12663777).
> 
> In addition, we'll need to rewrite the adjustReturnValue() method not to
> return UnknownVal by default, but rather assert in cases we cannot
> handle. To make it possible, we need to correctly handle some of the
> edge cases we already know about.
> 
> Modified:
>    cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
>    cfe/trunk/test/Analysis/retain-release-inline.m
> 
> Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp?rev=167762&r1=167761&r2=167762&view=diff
> ==============================================================================
> --- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp (original)
> +++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp Mon Nov 12 16:06:24 2012
> @@ -137,6 +137,8 @@
>     return V;
> 
>   // If the types already match, don't do any unnecessary work.
> +  ExpectedTy = ExpectedTy.getCanonicalType();
> +  ActualTy = ActualTy.getCanonicalType();
>   if (ExpectedTy == ActualTy)
>     return V;
> 
> 
> Modified: cfe/trunk/test/Analysis/retain-release-inline.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release-inline.m?rev=167762&r1=167761&r2=167762&view=diff
> ==============================================================================
> --- cfe/trunk/test/Analysis/retain-release-inline.m (original)
> +++ cfe/trunk/test/Analysis/retain-release-inline.m Mon Nov 12 16:06:24 2012
> @@ -343,5 +343,21 @@
>   CFRelease(str);
> }
> 
> +extern CFStringRef getString(void);
> +CFStringRef testCovariantReturnType(void) __attribute__((cf_returns_retained));
> 
> +void usetestCovariantReturnType() {
> +  CFStringRef S = ((void*)0);
> +  S = testCovariantReturnType();
> +  if (S)
> +    CFRelease(S);
> +} 
> 
> +CFStringRef testCovariantReturnType() {
> +  CFStringRef Str = ((void*)0);
> +  Str = getString();
> +  if (Str) {
> +    CFRetain(Str);
> +  }
> +  return Str;
> +}
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list