[cfe-commits] r140218 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h lib/StaticAnalyzer/Core/PathDiagnostic.cpp test/Analysis/retain-release.m

Anna Zaks ganna at apple.com
Thu Sep 22 12:42:15 PDT 2011


On Sep 22, 2011, at 12:34 PM, Ted Kremenek wrote:

> On Sep 20, 2011, at 5:35 PM, Anna Zaks wrote:
> 
>> Author: zaks
>> Date: Tue Sep 20 19:35:58 2011
>> New Revision: 140218
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=140218&view=rev
>> Log:
>> [analyzer] Fix a bug where PathDiagnosticLocation did not generate a valid range and add asserts to check validity of locations early on. Ignore invalid ranges in PathDiagnosticPiece (they could be added by checker writers).
>> 
>> Address
> 
> <snip>
> 
>> Modified: cfe/trunk/test/Analysis/retain-release.m
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=140218&r1=140217&r2=140218&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/Analysis/retain-release.m (original)
>> +++ cfe/trunk/test/Analysis/retain-release.m Tue Sep 20 19:35:58 2011
>> @@ -652,6 +652,12 @@
>>    [window release];
>>    [super dealloc];
>> }
>> +
>> +- (void)radar10102244 {
>> + NSMutableDictionary *dict = [[NSMutableDictionary dictionaryWithCapacity:4] retain]; // expected-warning{{leak}} 
>> + if (window) 
>> +   NSLog(@"%@", window);    
>> +}
>> @end
>> 
>> //===----------------------------------------------------------------------===//
>> @@ -1444,7 +1450,7 @@
>>    while (error_to_dump != ((void*)0)) {
>>        CFDictionaryRef info;
>> 
>> -        info = CFErrorCopyUserInfo(error_to_dump); // expected-warning{{Potential leak of an object allocated on line 1447 and stored into 'info'}}
>> +        info = CFErrorCopyUserInfo(error_to_dump); // expected-warning{{Potential leak of an object allocated on line}}
>> 
>>        if (info != ((void*)0)) {
>>        }
> 
> Hi Anna,
> 
> Isn't this a regression in the emitted diagnostic?

I just relaxed the test so that we would not need to change the line number every time we add code to the test file (before this check).
test/Analysis/plist-output-alternate.m has a check for this particular diagnostic with "on lineā€¦", so the particular warning is being tested.

Anna.
> 
> Ted





More information about the cfe-commits mailing list