summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjC/arc.m
Commit message (Collapse)AuthorAgeFilesLines
* Add a FIXME and corresponding test coverage for some suspicious behaviorRichard Smith2020-01-101-0/+1
| | | | forming composite ObjC pointer types in comparisons.
* Clean up and simplify RequireCompleteType.Richard Smith2018-08-071-1/+1
| | | | | | | No functional change intended, except that we will now produce more "declared here" notes. llvm-svn: 339187
* Remove the fixit for the diagnostics regarding capturing autoreleasing ↵George Karpenkov2018-05-141-13/+7
| | | | | | | | | | | | | | | variables in a block The fixit is actively harmful, as it encourages developers to ignore the warning and to write unsafe code. It is almost impossible to write safe code while capturing autoreleasing variables in the block, as in order to check that the block is never called in the autoreleasing pool the developer has to check the transitive closure of all potential callers of the block. Differential Revision: https://reviews.llvm.org/D46778 llvm-svn: 332288
* Use correct fix-it location for -Wblock-capture-autoreleasingAlex Lorenz2017-02-161-0/+7
| | | | | | | | | The '__autoreleasing' keyword should be inserted after the Objective-C pointer type. rdar://30123548 llvm-svn: 295381
* Turn on -Wblock-capture-autoreleasing by default.Akira Hatanaka2017-01-261-1/+1
| | | | | | | | | | Turning on the warning by default helps the users as it's a common mistake to capture out-parameters in a block without ensuring the object assigned doesn't get released. rdar://problem/30200058 llvm-svn: 293199
* [Sema][ObjC] Make sure -Wblock-capture-autoreleasing issues a warningAkira Hatanaka2017-01-261-1/+22
| | | | | | | | | | | | | | | even in the presence of nullability qualifiers. This commit fixes bugs in r285031 where -Wblock-capture-autoreleasing wouldn't issue warnings when the function parameters were annotated with nullability qualifiers. Specifically, look through the sugar and see if there is an AttributedType of kind attr_objc_ownership to determine whether __autoreleasing was explicitly specified or implicitly added by the compiler. rdar://problem/30193488 llvm-svn: 293194
* [Sema][ObjC] Warn about implicitly autoreleasing out-parameters capturedAkira Hatanaka2016-10-241-1/+8
| | | | | | | | | | | | | | by blocks. Add a new warning "-Wblock-capture-autoreleasing". The warning warns about implicitly autoreleasing out-parameters captured by blocks which can introduce use-after-free bugs that are hard to debug. rdar://problem/15377548 Differential Revision: https://reviews.llvm.org/D25844 llvm-svn: 285031
* Some minor ARC diagnostic improvements.John McCall2015-10-211-1/+11
| | | | llvm-svn: 250917
* [Sema] Be consistent about diagnostic wording: always use "cannot".Davide Italiano2015-08-151-1/+1
| | | | | | Discussed with Richard Smith. llvm-svn: 245162
* Improve the error message for assigning to read-only variables.Richard Trieu2015-04-111-2/+2
| | | | | | | | | | Previously, many error messages would simply be "read-only variable is not assignable" This change provides more information about why the variable is not assignable, as well as note to where the const is located. Differential Revision: http://reviews.llvm.org/D4479 llvm-svn: 234677
* Objective-C. revert patch for rdar://17554063.Fariborz Jahanian2014-10-281-12/+6
| | | | llvm-svn: 220812
* Reword switch/goto diagnostics "protected scope" diagnostics. Making up a termRichard Smith2014-09-061-1/+1
| | | | | | | | "protected scope" is very unhelpful here and actively confuses users. Instead, simply state the nature of the problem in the diagnostic: we cannot jump from here to there. The notes explain nicely why not. llvm-svn: 217293
* Objective-C ARC. Use of non-retain/autorelease APIFariborz Jahanian2014-08-081-3/+4
| | | | | | | for building Objective-C array literals in ARC mode. rdar://17554063 llvm-svn: 215232
* Objective-C arc. Switch the Objective-C dictionary literal in ARC modeFariborz Jahanian2014-08-071-2/+3
| | | | | | | to use non-retain/autorelease API variants of ObjC objects. wip. rdar://17554063 llvm-svn: 215146
* Objective-C ARC. More code for Objective-C'sFariborz Jahanian2014-08-061-1/+5
| | | | | | new APIs for literals. nfc. wip. rdar://17554063 llvm-svn: 215043
* Objective-C ARC. Allow conversion of (void*) pointers toFariborz Jahanian2014-06-181-1/+17
| | | | | | | | retainable ObjC pointers without requiring a bridge-cast in the context of pointer comparison as this is in effect a +0 context. // rdar://16627903 llvm-svn: 211243
* Objective-C. Revert my patch in r211234.Fariborz Jahanian2014-06-181-17/+1
| | | | llvm-svn: 211237
* Objective-C ARC. Allow conversion of (void*) pointers toFariborz Jahanian2014-06-181-1/+17
| | | | | | | retainable ObjC pointers without requiring a bridge-cast by recognizing this as a +0 context. // rdar://16627903 llvm-svn: 211234
* ObjectiveC. ObjectiveC's collection selector expression inFariborz Jahanian2013-10-101-0/+10
| | | | | | | | the fereach loop must be a non-const lvalue expression as it will be assigned to at the beginning of the loop. // rdar://15123684 llvm-svn: 192399
* Consolidating the notion of a GNU attribute parameter with the attribute ↵Aaron Ballman2013-08-311-0/+2
| | | | | | argument list. llvm-svn: 189711
* Fix another place where clang check objc selector name instead of checking ↵Jean-Daniel Dupas2013-07-191-1/+4
| | | | | | | | | | | | the selector family Summary: In ARC mode, clang emits a warning if the result of an 'init' method is unused but miss cases where the method does not follows the Cocoa naming convention but is properly declared as an init family method. CC: cfe-commits, eli.friedman Differential Revision: http://llvm-reviews.chandlerc.com/D1163 llvm-svn: 186718
* Objective-C [qoi]: privide typo correction for selectorsFariborz Jahanian2013-06-181-1/+1
| | | | | | | | in addition of receiver having static type, but also when receiver has dynamic type (of 'id' variety) as well as when receiver is of 'Class' type vareity. // rdar://7853549 llvm-svn: 184195
* Objective-C (mostly arc): Under ARC, we often have unneeded qualifiers Fariborz Jahanian2013-04-301-0/+11
| | | | | | | in the diagnostics. Remove them when reporting incompatible Objective-C pointer types. // rdar://13752880. llvm-svn: 180765
* When checking the parameter types of an Objective-C method, don'tDouglas Gregor2013-01-181-1/+5
| | | | | | | decay the parameter type immediately; let CheckParameter() do its job. Fixes <rdar://problem/12071218>. llvm-svn: 172780
* Change checkUnsafeAssignLiteral() to use the new Sema::CheckLiteralKind().Ted Kremenek2012-12-211-2/+6
| | | | | | | | | | Along the way, fix a bug in CheckLiteralKind(), previously in diagnoseObjCLiteralComparison, where we didn't ignore parentheses in boxed expressions for purpose of classification. In other words, both @42 and @(42) should be classified as numeric literals. llvm-svn: 170931
* Extend checkUnsafeAssigns() to also handle assigning an object literal to a ↵Ted Kremenek2012-12-211-0/+31
| | | | | | | | | | weak reference. Thanks to Jordan Rose and John McCall for their sage code review. Fixes <rdar://problem/12569201>. llvm-svn: 170864
* Revert "Warn if a __weak variable is initialized with an Objective-C object ↵Ted Kremenek2012-12-201-24/+0
| | | | | | | | literal." Per code feedback, I want to see if there is a more general way to do this. llvm-svn: 170777
* Warn if a __weak variable is initialized with an Objective-C object literal.Ted Kremenek2012-12-201-0/+24
| | | | | | | | | Such variables may immediately become nil or may have unpredictable behavior. Fixes <rdar://problem/12569201>. llvm-svn: 170763
* revert r160839 for now.Fariborz Jahanian2012-07-271-2/+4
| | | | llvm-svn: 160895
* objc-arc: When objects with known CF semantics are assigned toFariborz Jahanian2012-07-261-4/+2
| | | | | | | | retainable types in arc, only suggest CFBridgingRelease/ CFBridgingRetain and not the confusing __bridge casts. // rdar://11923822 llvm-svn: 160839
* Capitalize "Objective-C" and "C++" in user-facing contexts.Jordan Rose2012-07-191-1/+1
| | | | | | No functionality change. llvm-svn: 160516
* objc-arc: warn when assigning retained object toFariborz Jahanian2012-07-061-0/+21
| | | | | | | a 'weak' property just as we do the same for 'weak' variables. // rdar://11814185 llvm-svn: 159859
* Added a new attribute, objc_root_class, which informs the compiler when a ↵Patrick Beard2012-04-061-1/+1
| | | | | | | | | root class is intentionally declared. The warning this inhibits, -Wobjc-root-class, is opt-in for now. However, all clang unit tests that would trigger the warning have been updated to use -Wno-objc-root-class. <rdar://problem/7446698> llvm-svn: 154187
* After numerous requests, have Objective-C 'method declared here' notes ↵Ted Kremenek2012-02-271-4/+4
| | | | | | mention the actual method. This looks better within an IDE, where text isn't always regurgitated in the presentation of a warning. Fixes radar 10914035. llvm-svn: 151579
* Only complain about __strong __strong id, not __strong SomeStrongTypedefJohn McCall2012-02-081-2/+0
| | | | | | or __strong __typeof__(some.strong.thing). llvm-svn: 150029
* Look for declaration of CFBridgingRetain/CFBridgingRetain beforeFariborz Jahanian2012-02-011-4/+7
| | | | | | changing the diagnostic. Also use correct spelling for both. llvm-svn: 149554
* objc-arc: In various diagnostics mention Fariborz Jahanian2012-01-311-4/+4
| | | | | | | | CFBridgingRetain/CFBridgingRelease calls instead of __bridge_retained/__bridge_transfer casts as preferred way of moving cf objects to arc land. // rdar://10207950 llvm-svn: 149449
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic message are compared. If either is a substring of the other, then no error is given. This gives rise to an unexpected case: // expect-error{{candidate function has different number of parameters}} will match the following error messages from Clang: candidate function has different number of parameters (expected 1 but has 2) candidate function has different number of parameters It will also match these other error messages: candidate function function has different number of parameters number of parameters This patch will change so that the verification string must be a substring of the diagnostic message before accepting. Also, all the failing tests from this change have been corrected. Some stats from this cleanup: 87 - removed extra spaces around verification strings 70 - wording updates to diagnostics 40 - extra leading or trailing characters (typos, unmatched parens or quotes) 35 - diagnostic level was included (error:, warning:, or note:) 18 - flag name put in the warning (-Wprotocol) llvm-svn: 146619
* Use Sema::RequireCompleteType to check for the completeness ofDouglas Gregor2011-11-141-2/+2
| | | | | | | | | | Objective-C classes. This has two purposes: to consistently provide "forward declaration here" notes when we hit an incomplete type, and to give LLDB a chance to complete the type. RequireCompleteType bits from Sean Callanan! llvm-svn: 144573
* objc-arc: 'readonly' property of retainable objectFariborz Jahanian2011-11-081-3/+3
| | | | | | type is strong by default too. // rdar://10410903 llvm-svn: 144118
* Relax restriction of assigning to 'self' in ARC when a method is attributed ↵Ted Kremenek2011-10-251-0/+10
| | | | | | with ns_consumes_self. Fixes <rdar://problem/10274056>. llvm-svn: 142909
* Teach the ARC compiler to not require __bridge casts whenJohn McCall2011-10-171-2/+2
| | | | | | | passing/receiving CF objects at +0 to/from Objective-C methods or audited C functions. llvm-svn: 142219
* objc-arc: Improve arc diagnostic when method is notFariborz Jahanian2011-10-141-0/+17
| | | | | | found in receiver's class. // rdar://9970739 llvm-svn: 141961
* objc arc: Suppress certain arc diagnostics on unavailableFariborz Jahanian2011-10-031-0/+6
| | | | | | functions. // rdar://10186536 llvm-svn: 141037
* Make -fobjc-nonfragile-abi the -cc1 default, since it's theJohn McCall2011-10-021-1/+1
| | | | | | | | | | | | | | | | | | | increasingly prevailing case to the point that new features like ARC don't even support the fragile ABI anymore. This required a little bit of reshuffling with exceptions because a check was assuming that ObjCNonFragileABI was only being set in ObjC mode, and that's actually a bit obnoxious to do. Most, though, it involved a perl script to translate a ton of test cases. Mostly no functionality change for driver users, although there are corner cases with disabling language-specific exceptions that we should handle more correctly now. llvm-svn: 140957
* [ARC] Allow forming 'id*' in an unevaluated context. Fixes rdar://10148540.Argyrios Kyrtzidis2011-09-201-0/+2
| | | | llvm-svn: 140212
* objc-arc: @property definitions should default to (strong) when notFariborz Jahanian2011-08-191-4/+2
| | | | | | specified. // rdar://9971982 llvm-svn: 138062
* Do l-value conversion, etc., on a switch condition expression inJohn McCall2011-08-061-0/+13
| | | | | | | | | | ActOnStartOfSwitchStmt (i.e. before binding up a full-expression) instead of ActOnFinishSwitchStmt. Among other things, this means that property l-values are properly converted inside the full-expression. llvm-svn: 137014
* objective-c: reverse patch for // rdar://9818354Fariborz Jahanian2011-08-011-2/+2
| | | | llvm-svn: 136658
* objective-c: warn if implementation of a method in categoryFariborz Jahanian2011-07-281-8/+12
| | | | | | | | | | masks an existing method in its primary class, class extensions, and primary class's non-optional protocol methods; as primary class, or one of its subclass's will implement this method. This warning has potential of being noisy so it has its own group. // rdar://7020493 llvm-svn: 136426
OpenPOWER on IntegriCloud