summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Allow objc_requires_super to be used to check class methods as well.Jordan Rose2012-10-191-13/+3
| | | | | | | | | | | | | Also, unify ObjCShouldCallSuperDealloc and ObjCShouldCallSuperFinalize. The two have identical behavior and will never be active at the same time. There's one last simplification now, which is that if we see a call to [super foo] and we are currently in a method named 'foo', we will /unconditionally/ clear the ObjCShouldCallSuper flag, rather than check first to see if we're in a method where calling super is required. There's no reason to pay the extra lookup price here. llvm-svn: 166285
* -Warc-repeated-use-of-weak: Check messages to property accessors as well.Jordan Rose2012-10-111-0/+18
| | | | | | | | | | | | | | | | | | | Previously, [foo weakProp] was not being treated the same as foo.weakProp. Now, for every explicit message send, we check if it's a property access, and if so, if the property is weak. Then for every assignment of a message, we have to do the same thing again. This is a potentially expensive increase because determining whether a method is a property accessor requires searching through the methods it overrides. However, without it -Warc-repeated-use-of-weak will miss cases from people who prefer not to use dot syntax. If this turns out to be too expensive, we can try caching the result somewhere, or even lose precision by not checking superclass methods. The warning is off-by-default, though. <rdar://problem/12407765> llvm-svn: 165718
* Move Sema::PropertyIfSetterOrGetter to ObjCMethodDecl::findPropertyDecl.Jordan Rose2012-10-101-10/+4
| | | | | | | | Then, switch users of PropertyIfSetterOrGetter and LookupPropertyDecl (the latter by name) over to findPropertyDecl. This actually makes -Wreceiver-is-weak a bit stronger than it was before. llvm-svn: 165628
* Rename ObjCMethodDecl::isSynthesized to isPropertyAccessor.Jordan Rose2012-10-101-5/+5
| | | | | | | | | | | | | This more accurately reflects its use: this flag is set when a method matches the getter or setter name for a property in the same class, and does not actually specify whether or not the definition of the method will be synthesized (either implicitly or explicitly with @synthesize). This renames the setter and backing field as well, and changes the (soon-to-be-obsolete?) XML dump format to use 'property_accessor' instead of 'synthesized'. llvm-svn: 165626
* -Wreceiver-is-weak: rephrase warning text and add a suggestion Note.Jordan Rose2012-09-281-13/+14
| | | | | | | | | | | | New output: warning: weak property may be unpredictably set to nil note: property declared here note: assign the value to a strong variable to keep the object alive during use <rdar://problem/12277204> llvm-svn: 164857
* objective-C: introduce __attribute((objc_requires_super)) on methodFariborz Jahanian2012-09-071-0/+8
| | | | | | | | in classes. Use it to flag those method implementations which don't contain call to 'super' if they have 'super' class and it has the method with this attribute set. This is wip. // rdar://6386358 llvm-svn: 163434
* objective-C: underline name of the missing methodFariborz Jahanian2012-08-311-4/+9
| | | | | | in the diagnbostic. // rdar://11303469 llvm-svn: 163003
* Push ArrayRef through the Expr hierarchy.Benjamin Kramer2012-08-241-2/+2
| | | | | | No functionality change. llvm-svn: 162552
* Now that ASTMultiPtr is nothing more than a array reference, make it a ↵Benjamin Kramer2012-08-231-10/+8
| | | | | | | | MutableArrayRef. This required changing all get() calls to data() and using the simpler constructors. llvm-svn: 162501
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-9/+9
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* Fix undefined behavior: member function calls where 'this' is a null pointer.Richard Smith2012-08-231-2/+2
| | | | llvm-svn: 162430
* Fix an assertion failure instantiating a constexpr function from within a ↵Eli Friedman2012-08-011-2/+2
| | | | | | -dealloc method. PR13401. llvm-svn: 161135
* Introduce new queries on ObjCRuntime for how to interpret subscriptsJohn McCall2012-07-311-7/+13
| | | | | | | | on object pointers and whether pointer arithmetic on object pointers is supported. Make ObjFW interpret subscripts as pseudo-objects. Based on a patch by Jonathan Schleifer. llvm-svn: 161028
* Explain why ACC_bottom should never occur in diagnosing ARC casts.Jordan Rose2012-07-311-3/+3
| | | | | | | This is just a clarification on Fariborz's original patch, per e-mail discussion. No functionality change. llvm-svn: 161016
* assert on ACC_bottom when checking for invalidFariborz Jahanian2012-07-281-2/+4
| | | | | | CF to ARC conversions. llvm-svn: 160923
* more objc-arc: With ACC_bottom, we just provideFariborz Jahanian2012-07-281-2/+2
| | | | | | | __bride fixit, as it doesn't matter which cast to use. // rdar://11923822 llvm-svn: 160906
* objc-arc: change per Jordy's comments.Fariborz Jahanian2012-07-271-13/+14
| | | | | | // rdar://11923822 llvm-svn: 160902
* objective-c arc: When function calls with known CFCreate naming conventionFariborz Jahanian2012-07-271-8/+18
| | | | | | | | are cast to retainable types, only suggest CFBridgingRelease/ CFBridgingRetain and not the __bridge casts. // rdar://11923822 llvm-svn: 160900
* revert r160839 for now.Fariborz Jahanian2012-07-271-12/+27
| | | | llvm-svn: 160895
* Consolidate ObjC lookupPrivateMethod methods from Sema and DeclObjC.Anna Zaks2012-07-271-67/+5
| | | | | | | | | | | | | Also, fix a subtle bug, which occurred due to lookupPrivateMethod defined in DeclObjC.h not looking up the method inside parent's categories. Note, the code assumes that Class's parent object has the same methods as what's in the Root class of a the hierarchy, which is a heuristic that might not hold for hierarchies which do not descend from NSObject. Would be great to fix this in the future. llvm-svn: 160885
* objc-arc: When objects with known CF semantics are assigned toFariborz Jahanian2012-07-261-27/+12
| | | | | | | | retainable types in arc, only suggest CFBridgingRelease/ CFBridgingRetain and not the confusing __bridge casts. // rdar://11923822 llvm-svn: 160839
* Warn on weak properties declared in protocols as well.Jordan Rose2012-06-281-2/+4
| | | | | | Previously this caused a crash, since protocols are not interfaces. llvm-svn: 159357
* objective-c: issue deprecation/unavailability warnings for methods called on Fariborz Jahanian2012-06-231-0/+3
| | | | | | id <Protocol>. // rdar://11618852 llvm-svn: 159084
* Documentation cleanup:James Dennett2012-06-221-4/+4
| | | | | | | | | | | | | | | * Primarily fixed \param commands with names not matching any actual parameters of the documented functions. In many cases this consists just of fixing up the parameter name in the \param to match the code, in some it means deleting obsolete documentation and occasionally it means documenting the parameter that has replaced the older one that was documented, which sometimes means some simple reverse-engineering of the docs from the implementation; * Fixed \param ParamName [out] to the correct format with [out] before the parameter name; * Fixed some \brief summaries. llvm-svn: 158980
* Restructure how the driver communicates information about theJohn McCall2012-06-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | target Objective-C runtime down to the frontend: break this down into a single target runtime kind and version, and compute all the relevant information from that. This makes it relatively painless to add support for new runtimes to the compiler. Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z, available at the driver level as a better and more general alternative to -fgnu-runtime and -fnext-runtime. This new concept of an Objective-C runtime also encompasses what we were previously separating out as the "Objective-C ABI", so fragile vs. non-fragile runtimes are now really modelled as different kinds of runtime, paving the way for better overall differentiation. As a sort of special case, continue to accept the -cc1 flag -fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak. I won't go so far as to say "no functionality change", even ignoring the new driver flag, but subtle changes in driver semantics are almost certainly not intended. llvm-svn: 158793
* Attach fixits for CFBridgingRetain/Release outside any casts.Jordan Rose2012-06-071-2/+4
| | | | | | | | | Before, the note showed the location where you could insert __bridge variants, but the actual fixit edit came after the cast. No functionality change. llvm-svn: 158131
* Insert a space if necessary when suggesting CFBridgingRetain/Release.Jordan Rose2012-06-071-4/+13
| | | | | | | | | | | | This was a problem for people who write 'return(result);' Also fix ARCMT's corresponding code, though there's no test case for this because implicit casts like this are rejected by the migrator for being ambiguous, and explicit casts have no problem. <rdar://problem/11577346> llvm-svn: 158130
* objective-c: Handle more warning cases for whenFariborz Jahanian2012-06-041-0/+17
| | | | | | | message receiver is 'weak' property. // rdar://10225276 llvm-svn: 157946
* [arcmt] Use CFBridgingRetain/CFBridgingRelease instead of ↵Argyrios Kyrtzidis2012-06-011-8/+9
| | | | | | | | | | __bridge_retained/__bridge_transfer when migrating. rdar://11569198 llvm-svn: 157785
* objective-c: revert r157407. It broke a projectFariborz Jahanian2012-05-301-4/+0
| | | | | | and reported as PR12959. // rdar://11499742 llvm-svn: 157697
* objective-c: warn on use of property settersFariborz Jahanian2012-05-241-6/+5
| | | | | | | | backing two propeties because proprty names match except for first letter being of different case. // rdar://11528439, [PR12936]. llvm-svn: 157435
* objective-c: Fixes a corner case and interesting bug.Fariborz Jahanian2012-05-241-1/+6
| | | | | | | | | Where diagnostic about unfound property is not issued in the context where a setter is looked up in situation in which name and property name differ in their first letter case. // rdar://11363363 llvm-svn: 157407
* Apparently empty names are allowed here.Benjamin Kramer2012-05-191-2/+3
| | | | llvm-svn: 157117
* Simplify some users of DeclarationName::getNameKind. Fold ↵Benjamin Kramer2012-05-191-3/+3
| | | | | | getFETokenInfoAsVoid into its only caller. llvm-svn: 157116
* [libclang/AST] Index references of protocols in "@protocol(...)" syntax.Argyrios Kyrtzidis2012-05-161-2/+3
| | | | | | | | | To do that, keep track of the location of the protocol id in the ObjCProtocolExpr AST node. rdar://11190837 llvm-svn: 156890
* Allow objc @() syntax for enum types.Argyrios Kyrtzidis2012-05-151-0/+11
| | | | | | | | | | Previously we would reject it as illegal using a value of enum type and on ObjC++ it was illegal to use an enumerator as well. rdar://11454917 llvm-svn: 156843
* Only check NSArray/NSDictionary boxing method params once.Jordy Rose2012-05-121-83/+89
| | | | | | | | Once we've found a "good" method, we don't need to check its argument types again. (Even if we might have later found a "bad" method, we were already caching the method we first looked up.) llvm-svn: 156719
* 80-col violations and minor reformatting. No functionality change.Jordy Rose2012-05-121-60/+64
| | | | llvm-svn: 156718
* Clean up ObjC boxing method checks by reducing duplicated code.Jordy Rose2012-05-121-83/+54
| | | | llvm-svn: 156717
* Don't crash on boxed strings when +stringWithUTF8String: is missing.Jordy Rose2012-05-121-5/+28
| | | | | | | | Also, unify some diagnostics for boxed expressions that have the same form. Fixes PR12804. llvm-svn: 156713
* Move Sema::RequireCompleteType() and Sema::RequireCompleteExprType()Douglas Gregor2012-05-041-18/+15
| | | | | | | | | | | off PartialDiagnostic. PartialDiagnostic is rather heavyweight for something that is in the critical path and is rarely used. So, switch over to an abstract-class-based callback mechanism that delays most of the work until a diagnostic is actually produced. Good for ~11k code size reduction in the compiler and 1% speedup in -fsyntax-only on the code in <rdar://problem/11004361>. llvm-svn: 156176
* Clean up changes suggested by Douglas Gregor:Patrick Beard2012-05-011-13/+19
| | | | | | | | | | | | BuildObjCNumericLiteral() and BuildObjCBoxedExpr() now both using PerformCopyInitialization() rather than PerformImplicitConversion(), which suppresses errors. In BuildObjCBoxedExpr(): no longer calling .getCanonicalType(), ValueType->getAs() will remove the minimal amount of sugar. Using ValueType->isBuiltinType() instead of isa<BuiltinType>(ValueType). llvm-svn: 155949
* objective-arc: Retune my previous patch so warningFariborz Jahanian2012-04-191-22/+37
| | | | | | | is issued on weak property as receiver and not on any other use of a weak property. // rdar://10225276 llvm-svn: 155169
* objective-c arc: Issue warning under -Wreceiver-is-weak Fariborz Jahanian2012-04-191-6/+31
| | | | | | | if receiver is a 'weak' property, by type or by attribute. // rdar://10225276 llvm-svn: 155159
* Implements boxed expressions for Objective-C. <rdar://problem/10194391>Patrick Beard2012-04-191-50/+197
| | | | llvm-svn: 155082
* objc-arc: provide a warning when 'receiver' of a message is 'weak'Fariborz Jahanian2012-04-041-0/+5
| | | | | | | in arc mode and opted-in with -Wreceiver-is-weak flag. // rdar://10225276 llvm-svn: 154042
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-25/+25
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,Ted Kremenek2012-03-061-6/+668
| | | | | | | | | | | | | NSNumber, and boolean literals. This includes both Sema and Codegen support. Included is also support for new Objective-C container subscripting. My apologies for the large patch. It was very difficult to break apart. The patch introduces changes to the driver as well to cause clang to link in additional runtime support when needed to support the new language features. Docs are forthcoming to document the implementation and behavior of these features. llvm-svn: 152137
* After numerous requests, have Objective-C 'method declared here' notes ↵Ted Kremenek2012-02-271-3/+6
| | | | | | 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
* objective-c++: Type of an objc string literal is NSString, not 'id'.Fariborz Jahanian2012-02-231-3/+15
| | | | | | // rdar://10907410 llvm-svn: 151296
OpenPOWER on IntegriCloud