Patch looks good with couple of minors.
Provide a note where receiver/argument has been declared.
Place CheckObjCCircularContainer(Result) right after checkRetainCycles(Result).

- Fariborz


On Mar 2, 2015, at 1:28 PM, Alexey Denisov <[email protected]> wrote:

> The patch adds new warning to prevent user from creating 'circular 
> containers'.
> Mutable collections from NSFoundation allows user to add collection to 
> itself, e.g.:
> 
> NSMutableArray *a = [NSMutableArray new];
> [a addObject:a];
> 
> The code above leads to really weird behaviour (crashes, 'endless' recursion) 
> and retain cycles (collection retains itself) and it's really hard to debug 
> and fix.
> This which is really hard to debug in a real application.
> 
> Patch checks the following collections: NSMutableArray, NSMutableDictionary, 
> NSMutableSet, NSMutableOrderedSet, NSCountedSet.
> 
> P.S. any suggestions for better wordings and methods/warning names - are 
> welcome.
> 
> http://reviews.llvm.org/D8014
> 
> Files:
>  include/clang/AST/NSAPI.h
>  include/clang/Basic/DiagnosticSemaKinds.td
>  include/clang/Sema/Sema.h
>  lib/AST/NSAPI.cpp
>  lib/Sema/SemaChecking.cpp
>  lib/Sema/SemaExprObjC.cpp
>  test/SemaObjC/circular-container.m
> 
> EMAIL PREFERENCES
>  http://reviews.llvm.org/settings/panel/emailpreferences/
> <D8014.21034.patch>_______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to