summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Rewrite variable capture within lambda expressions and blocks,Douglas Gregor2012-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eliminating a bunch of redundant code and properly modeling how the captures of outside blocks/lambdas affect the types seen by inner captures. This new scheme makes two passes over the capturing scope stack. The first pass goes up the stack (from innermost to outermost), assessing whether the capture looks feasible and stopping when it either hits the scope where the variable is declared or when it finds an existing capture. The second pass then walks down the stack (from outermost to innermost), capturing the variable at each step and updating the captured type and the type that an expression referring to that captured variable would see. It also checks type-specific restrictions, such as the inability to capture an array within a block. Note that only the first odr-use of each variable needs to do the full walk; subsequent uses will find the capture immediately, so multiple walks need not occur. The same routine that builds the captures can also compute the type of the captures without signaling errors and without actually performing the capture. This functionality is used to determine the type of declaration references as well as implementing the weird decltype((x)) rule within lambda expressions. The capture code now explicitly takes sides in the debate over C++ core issue 1249, which concerns the type of captures within nested lambdas. We opt to use the more permissive, more useful definition implemented by GCC rather than the one implemented by EDG. llvm-svn: 150875
* Add fixits for ARC casting errors for implicit conversions as well. ↵Argyrios Kyrtzidis2012-02-161-16/+86
| | | | | | | | | | rdar://10289283 Also fix the fixit (oh the irony) when it uses CFBridgingRetain/CFBridgingRelease; they are supposed to be calls with the casted expression as parameter, they should not be inserted into the cast like the __bridge keywords. llvm-svn: 150705
* Revert r145999. This turned out to be a bad idea. Unfortunately, 'id' is ↵Ted Kremenek2012-02-101-3/+0
| | | | | | | | | used so profusely in many APIs and large codebases that this made the deprecated warning trigger happy to the point of not being useful. llvm-svn: 150223
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Implement implicit capture for lambda expressions.Eli Friedman2012-02-031-26/+5
| | | | | | Still left: explicit captures in lambdas need to cause implicit capture, and I need to take a look at the diagnostics for some cases. llvm-svn: 149718
* objc: Issue diagnostic when receiver type is a forward class declaration andFariborz Jahanian2012-02-031-1/+5
| | | | | | | it is treated as of 'id' type resulting in multiple method lookup. // rdar://10686120 llvm-svn: 149653
* Look for declaration of CFBridgingRetain/CFBridgingRetain beforeFariborz Jahanian2012-02-011-11/+28
| | | | | | changing the diagnostic. Also use correct spelling for both. llvm-svn: 149554
* Improve checking of explicit captures in a C++11 lambda expression:Douglas Gregor2012-02-011-1/+2
| | | | | | | | | | | | | | - Actually building the var -> capture mapping properly (there was an off-by-one error) - Keeping track of the source location of each capture - Minor QoI improvements, e.g, highlighing the prior capture if there are multiple captures, pointing at the variable declaration we found if we reject it. As part of this, add standard citations for the various semantic checks we perform, and note where we're not performing those checks as we should. llvm-svn: 149462
* Make the callback object to Sema::CorrectTypo mandatory.Kaelyn Uhrain2012-01-311-2/+2
| | | | llvm-svn: 149451
* 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
* Fix a couples of issues in format strings checking.Jean-Daniel Dupas2012-01-171-6/+4
| | | | | | | PR 10274: format function attribute with the NSString archetype yields no compiler warnings PR 10275: format function attribute isn't checked in Objective-C methods llvm-svn: 148324
* Fix up the calls to CorrectTypo in Sema*ObjC.cpp to use callbackKaelyn Uhrain2012-01-131-31/+43
| | | | | | | objects, and add a basic CorrectionCandidateCallback template class to simplify the fixups. llvm-svn: 148085
* Add IsImplicit field in ObjCMessageExpr that is true when the messageArgyrios Kyrtzidis2012-01-121-8/+43
| | | | | | | | | | was constructed, e.g. for a property access. This allows the selector identifier locations machinery for ObjCMessageExpr to function correctly, in that there are not real locations to handle/report for such a message. llvm-svn: 148013
* Start refactoring code for capturing variables and 'this' so that it is ↵Eli Friedman2012-01-111-2/+1
| | | | | | shared between lambda expressions and block literals. llvm-svn: 147917
* Move the definition-specific data of ObjCInterfaceDecl into aDouglas Gregor2011-12-151-5/+6
| | | | | | | | | | | | | | | | separately-allocated DefinitionData structure, which we manage the same way as CXXRecordDecl::DefinitionData. This prepares the way for making ObjCInterfaceDecls redeclarable, to more accurately model forward declarations of Objective-C classes and eliminate the mutation of ObjCInterfaceDecl that causes us serious trouble in the AST reader. Note that ObjCInterfaceDecl's accessors are fairly robust against being applied to forward declarations, because Clang (and Sema in particular) doesn't perform RequireCompleteType/hasDefinition() checks everywhere it has to. Each of these overly-robust cases is marked with a FIXME, which we can tackle over time. llvm-svn: 146644
* objc: issue deprecated/unavailable diagnostic whenFariborz Jahanian2011-12-071-0/+3
| | | | | | | methods with these attributes are sent to receivers of 'id' type too. // rdar://10459930 llvm-svn: 145999
* When sending a message to a receiver that has "unknown any" type,Douglas Gregor2011-12-011-3/+7
| | | | | | | force the unknown any type to "id" so that the message send can be completed without requiring a case. Fixes <rdar://problem/10506646>. llvm-svn: 145552
* Use Sema::RequireCompleteType to check for the completeness ofDouglas Gregor2011-11-141-30/+32
| | | | | | | | | | 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
* Don't crash on invalid objc code.Argyrios Kyrtzidis2011-11-091-0/+5
| | | | llvm-svn: 144150
* Rip out CK_GetObjCProperty.John McCall2011-11-071-1/+0
| | | | llvm-svn: 143910
* Change the AST representation of operations on Objective-CJohn McCall2011-11-061-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | property references to use a new PseudoObjectExpr expression which pairs a syntactic form of the expression with a set of semantic expressions implementing it. This should significantly reduce the complexity required elsewhere in the compiler to deal with these kinds of expressions (e.g. IR generation's special l-value kind, the static analyzer's Message abstraction), at the lower cost of specifically dealing with the odd AST structure of these expressions. It should also greatly simplify efforts to implement similar language features in the future, most notably Managed C++'s properties and indexed properties. Most of the effort here is in dealing with the various clients of the AST. I've gone ahead and simplified the ObjC rewriter's use of properties; other clients, like IR-gen and the static analyzer, have all the old complexity *and* all the new complexity, at least temporarily. Many thanks to Ted for writing and advising on the necessary changes to the static analyzer. I've xfailed a small diagnostics regression in the static analyzer at Ted's request. llvm-svn: 143867
* objc-arc: desugar certain type and improve on diagnostic forFariborz Jahanian2011-10-291-10/+20
| | | | | | | ownership qualifier cast which won't work. // rdar://10244607 llvm-svn: 143258
* objective-c arc: type-casting of an objc pointer toFariborz Jahanian2011-10-281-1/+18
| | | | | | | an rvalue retainable object type with life-time qualifier has no effect and wil be diagnosed as error. // rdar://10244607 llvm-svn: 143219
* Restore r142914 and r142915, now with missing file and apparentJohn McCall2011-10-251-53/+43
| | | | | | GCC compiler workaround. llvm-svn: 142931
* Revert r142914 and r142915, due to possibly missing file.NAKAMURA Takumi2011-10-251-43/+53
| | | | | | r142914: "Introduce a placeholder type for "pseudo object"" r142915: "Pull the pseudo-object stuff into its own file." llvm-svn: 142921
* Introduce a placeholder type for "pseudo object"John McCall2011-10-251-53/+43
| | | | | | | | | | | | | | | expressions: expressions which refer to a logical rather than a physical l-value, where the logical object is actually accessed via custom getter/setter code. A subsequent patch will generalize the AST for these so that arbitrary "implementing" sub-expressions can be provided. Right now the only client is ObjC properties, but this should be generalizable to similar language features, e.g. Managed C++'s __property methods. llvm-svn: 142914
OpenPOWER on IntegriCloud