[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. llvm-svn: 167762
This commit is contained in:
parent
b1da2cb3fd
commit
4e255b62f1
|
@ -137,6 +137,8 @@ static SVal adjustReturnValue(SVal V, QualType ExpectedTy, QualType ActualTy,
|
|||
return V;
|
||||
|
||||
// If the types already match, don't do any unnecessary work.
|
||||
ExpectedTy = ExpectedTy.getCanonicalType();
|
||||
ActualTy = ActualTy.getCanonicalType();
|
||||
if (ExpectedTy == ActualTy)
|
||||
return V;
|
||||
|
||||
|
|
|
@ -343,5 +343,21 @@ void test_test_return_inline_2(char *bytes) {
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue