[PATCH] D27535: [analyzer] Add ObjCPropertyChecker - check for autosynthesized copy-properties of mutable types.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 7 13:04:27 PST 2016


NoQ created this revision.
NoQ added reviewers: zaks.anna, dcoughlin.
NoQ added a subscriber: cfe-commits.
Herald added a subscriber: mgorny.

When an ObjC property is declared as `(copy)`, and the type of the property is mutable (eg. `NSMutableSomething`), the autosynthesized code for the setter, which as usual copies the object by calling `-copy`, produces an immutable object (eg. `NSSomething`; cf. `-mutableCopy` which would actually produce `NSMutableSomething`), which would lead to unexpected results.

The checker is named to be a bit more generic, even though i have no particular plans for other checks at the moment.

Testing in progress.


https://reviews.llvm.org/D27535

Files:
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/ObjCPropertyChecker.cpp
  test/Analysis/ObjCPropertiesSyntaxChecks.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27535.80644.patch
Type: text/x-patch
Size: 6054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161207/043e40c6/attachment-0001.bin>


More information about the cfe-commits mailing list