summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseObjc.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Introduce BalancedDelimiterTracker, to better track open/closeDouglas Gregor2011-10-121-25/+40
| | | | | | | delimiter pairs and detect when we exceed the implementation limit for nesting depth, from Aaron Ballman! llvm-svn: 141782
* When using an unavailable/deprecated interface Foo inside Foo's ↵Argyrios Kyrtzidis2011-10-061-3/+1
| | | | | | | | interface/implementation don't emit unavailable errors. llvm-svn: 141334
* Pass from the parser the locations of selector identifiers when creatingArgyrios Kyrtzidis2011-10-031-3/+4
| | | | | | | | objc method decls. They are not stored in the AST yet. llvm-svn: 140984
* Pass all the locations of the selector identifiers for a message expression ↵Argyrios Kyrtzidis2011-10-031-6/+8
| | | | | | | | from the parser. They are not kept in the AST yet. llvm-svn: 140982
* Parse attributes written in an ObjC method parameter type asJohn McCall2011-10-011-11/+71
| | | | | | attributes on the parameter declaration. llvm-svn: 140944
* Clean up parsing the category names in interfaces slightly, usingDouglas Gregor2011-09-231-10/+9
| | | | | | | MatchRHSPunctuation appropriately and giving a useful source location for the complaint about attributes being added to a category. llvm-svn: 140404
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-1/+1
| | | | llvm-svn: 140367
* ArrayRef-ifying the fields passed to Sema::ActOnFieldsDavid Blaikie2011-09-221-1/+1
| | | | llvm-svn: 140293
* Implement the Objective-C 'instancetype' type, which is an alias ofDouglas Gregor2011-09-081-1/+9
| | | | | | | | | | 'id' that can be used (only!) via a contextual keyword as the result type of an Objective-C message send. 'instancetype' then gives the method a related result type, which we have already been inferring for a variety of methods (new, alloc, init, self, retain). Addresses <rdar://problem/9267640>. llvm-svn: 139275
* Support code-completion for C++ inline methods and ObjC buffering methods.Argyrios Kyrtzidis2011-09-041-39/+47
| | | | | | | | | | | | | | Previously we would cut off the source file buffer at the code-completion point; this impeded code-completion inside C++ inline methods and, recently, with buffering ObjC methods. Have the code-completion inserted into the source buffer so that it can be buffered along with a method body. When we actually hit the code-completion point the cut-off lexing or parsing. Fixes rdar://10056932&8319466 llvm-svn: 139086
* objective-c: this patch (re)introduces objective-c's default propertyFariborz Jahanian2011-08-311-5/+6
| | | | | | | | | | synthesis. This new feature is currently placed under -fobjc-default-synthesize-properties option and is off by default pending further testing. It will become the default feature soon. // rdar://8843851 llvm-svn: 138913
* objective-c - This patch buffers method implementations Fariborz Jahanian2011-08-311-33/+69
| | | | | | | | | | | | | and does the Sema on their body after the entire class/category @implementation is seen. This change allows messaging of forward private methods, as well as, access to synthesized ivars of properties with foward synthesize declarations; among others. In effect, this patch removes several restrictions placed on objective-c due to in-place semantics processing of methods. This is part of // rdar://8843851. llvm-svn: 138865
* Minor clean up of objc's decl context stuff.Fariborz Jahanian2011-08-291-5/+2
| | | | | | No change in functionality. llvm-svn: 138742
* objective-c: Treat top-level objective-c declarationsFariborz Jahanian2011-08-271-13/+25
| | | | | | | | | | , such as list of forward @class decls, in a DeclGroup node. Deal with its consequence throught clang. This is in preparation for more Sema work ahead. // rdar://8843851. Feel free to reverse if it breaks something important and I am unavailable. llvm-svn: 138709
* Reverse r138567 until a buildbot failure is investigated.Fariborz Jahanian2011-08-251-25/+13
| | | | llvm-svn: 138584
* objc -arse: Use DeclGroup for forward class declarations;Fariborz Jahanian2011-08-251-13/+25
| | | | | | as in @class foo, bar. More cleanup to follow. llvm-svn: 138567
* objc refactoring - minor clean up.Fariborz Jahanian2011-08-221-12/+8
| | | | llvm-svn: 138276
* objc - Simplify switing objc decl context by usingFariborz Jahanian2011-08-221-5/+2
| | | | | | a context switching object. llvm-svn: 138248
* Restore patch I reversed in r138040. Known buildbotFariborz Jahanian2011-08-221-56/+62
| | | | | | failures are resolved. llvm-svn: 138234
* Revers r138040. Need to look at a few buildbot failures.Fariborz Jahanian2011-08-191-55/+55
| | | | llvm-svn: 138049
* objective-c: Bring objective-c handling of decl contextFariborz Jahanian2011-08-191-55/+55
| | | | | | | | | | to modernity. Instead of passing down individual context objects from parser to sema, establish decl context in parser and have sema access current context as needed. I still need to take of Doug's comment for minor cleanups. llvm-svn: 138040
* The lock operand to an @synchronized statement is also John McCall2011-07-271-18/+33
| | | | | | | supposed to be a full-expression; make it so. In ARC, make sure we retain the lock for the entire protected block. llvm-svn: 136271
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-28/+28
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Introduce Declarator::ObjCCatchContext, this will result in correct error ↵Argyrios Kyrtzidis2011-07-011-4/+1
| | | | | | for 'auto' in obj-c catch. llvm-svn: 134271
* Remove dead variables.Benjamin Kramer2011-06-181-1/+0
| | | | llvm-svn: 133346
* Automatic Reference Counting.John McCall2011-06-151-2/+40
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Implement Objective-C Related Result Type semantics.Douglas Gregor2011-06-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related result types apply Cocoa conventions to the type of message sends and property accesses to Objective-C methods that are known to always return objects whose type is the same as the type of the receiving class (or a subclass thereof), such as +alloc and -init. This tightens up static type safety for Objective-C, so that we now diagnose mistakes like this: t.m:4:10: warning: incompatible pointer types initializing 'NSSet *' with an expression of type 'NSArray *' [-Wincompatible-pointer-types] NSSet *array = [[NSArray alloc] init]; ^ ~~~~~~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1: note: instance method 'init' is assumed to return an instance of its receiver type ('NSArray *') - (id)init; ^ It also means that we get decent type inference when writing code in Objective-C++0x: auto array = [[NSMutableArray alloc] initWithObjects:@"one", @"two",nil]; // ^ now infers NSMutableArray* rather than id llvm-svn: 132868
* Restore 'atomic' as an attribute of objcFariborz Jahanian2011-06-111-0/+2
| | | | | | properties. llvm-svn: 132866
* Remove 'atomic' as a property attribute keyword.Fariborz Jahanian2011-06-081-2/+0
| | | | | | | It is not a sanctioned keyword and is assumed as default. // rdar://8790791 llvm-svn: 132753
* Fixes an instance method meta-data generation bug inFariborz Jahanian2011-04-221-1/+1
| | | | | | | | | | | ObjC NeXt runtime where method pointer registered in metadata belongs to an unrelated method. Ast part of this fix, I turned at @end missing warning (for class implementations) into an error as we can never be sure that meta-data being generated is correct. // rdar://9072317 llvm-svn: 130019
* fix the second part of rdar://8366474 - clang fails to parse ObjC selectors ↵Chris Lattner2011-03-261-2/+2
| | | | | | with '::', when :: isn't the first part of the selector. llvm-svn: 128344
* Fix the recovery from missing semis on @property declarations to not consumeJohn McCall2011-03-261-2/+1
| | | | | | | | the following '@'. Conceivably, we could skip tokens until something that can validly start an @interface declaration here, but it's not clear that it matters. llvm-svn: 128325
* Insomniac refactoring: change how the parser allocates attributes so thatJohn McCall2011-03-241-18/+23
| | | | | | | | | AttributeLists do not accumulate over the lifetime of parsing, but are instead reused. Also make the arguments array not require a separate allocation, and make availability attributes store their stuff in augmented memory, too. llvm-svn: 128209
* Call out ObjC parameter types as a different kind of declarator contextJohn McCall2011-03-231-1/+1
| | | | | | from a normal type-spec, just for completeness. llvm-svn: 128185
* Make sure that we always pop a function's scope *before* we callDouglas Gregor2011-03-161-6/+8
| | | | | | | | | | | ActOnFinishFunctionBody/ActOnBlockStmtExpr. This way, we ensure that we diagnose undefined labels before the jump-scope checker gets run, since the jump-scope checker requires (as its invariant) that all of the GotoStmts be wired up correctly. Fixes PR9495. llvm-svn: 127738
* Place duplicate argument declaration in inFariborz Jahanian2011-03-121-7/+11
| | | | | | | method prototypes under the -Wduplicate-method-arg and turn it off by default. llvm-svn: 127552
* Clarify the context in which an Objective-C type name is being parsedDouglas Gregor2011-03-081-6/+9
| | | | | | | by using an enumeration rather than a boolean value. No functionality change. llvm-svn: 127259
* Implement a special code-completion pattern for "IBAction". FixesDouglas Gregor2011-02-151-1/+1
| | | | | | <rdar://problem/8767704>. llvm-svn: 125604
* Fix scoping of method declarations and issue Fariborz Jahanian2011-02-091-5/+14
| | | | | | | warning when same parameter name used multiple times. // rdar://8877730 llvm-svn: 125229
* Fix warnings found by gcc-4.6, from -Wunused-but-set-variable andJeffrey Yasskin2011-01-181-4/+6
| | | | | | -Wint-to-pointer-cast. llvm-svn: 123719
* Use Parser::ExpectAndConsume() uniformly to eat semicolons afterDouglas Gregor2011-01-051-16/+4
| | | | | | | | | Objective-C declarations and statements. Fixes <rdar://problem/8814576> (wrong source line for diagnostics about missing ';'), and now we actually consume the ';' at the end of a @compatibility_alias directive! llvm-svn: 122855
* Rename MaybeSkipFunctionBodyForCodeCompletion -> ↵Argyrios Kyrtzidis2011-01-041-2/+3
| | | | | | | | trySkippingFunctionBodyForCodeCompletion and check isCodeCompletionEnabled() before doing the call. Suggestions by Chris. llvm-svn: 122792
* When in code-completion, skip obj-c method bodies for speed up.Argyrios Kyrtzidis2011-01-031-0/+3
| | | | llvm-svn: 122781
* Refactor how we collect attributes during parsing, and add slots for attributesJohn McCall2010-12-241-24/+32
| | | | | | | on array and function declarators. This is pretty far from complete, and I'll revisit it later if someone doesn't beat me to it. llvm-svn: 122535
* Fix a major inconsistency in the representation of Objective-CDouglas Gregor2010-12-211-9/+4
| | | | | | | | | | | | | | | | | | | | classes, categories, protocols, and class extensions, where the methods and properties of these entities would be inserted into the DeclContext in an ordering that doesn't necessarily reflect source order. The culprits were Sema::ActOnMethodDeclaration(), which did not perform the insertion of the just-created method declaration into the DeclContext for these Objective-C entities, and Sema::ActOnAtEnd(), which inserted all method declarations at the *end* of the DeclContext. With this fix in hand, clean up the code-completion actions for property setters/getters that worked around this brokenness in the AST. Fixes <rdar://problem/8062781>, where this problem manifested as poor token-annotation information, but this would have struck again in many other places. llvm-svn: 122347
* Warn when synthesizing a property which isFariborz Jahanian2010-12-171-0/+2
| | | | | | | implicitly atomic under -Wimplicit-atomic-properties flag. // rdar://8774580 llvm-svn: 122095
* fix typoChris Lattner2010-12-171-1/+1
| | | | llvm-svn: 122041
* When parsing something that looks like an ill-formedDouglas Gregor2010-11-191-3/+4
| | | | | | | | protocol-qualifier list without a leading type (e.g., <#blah#>), don't complain about it being an archaic protocol-qualifier list unless it actually parses as one. llvm-svn: 119805
* For an Objective-C @synthesize statement, e.g.,Douglas Gregor2010-11-171-3/+4
| | | | | | | | | @synthesize foo = _foo; keep track of the location of the ivar ("_foo"). Teach libclang to visit the ivar as a member reference. llvm-svn: 119447
* Region-allocate all AttributeList objects from a factory object instead of ↵Ted Kremenek2010-11-101-15/+6
| | | | | | | | | | | | | | | | | | | | | | | | manually managing them using new/delete and OwningPtrs. After memory profiling Clang, I witnessed periodic leaks of these objects; digging deeper into the code, it was clear that our management of these objects was a mess. The ownership rules were murky at best, and not always followed. Worse, there are plenty of error paths where we could screw up. This patch introduces AttributeList::Factory, which is a factory class that creates AttributeList objects and then blows them away all at once. While conceptually simple, most of the changes in this patch just have to do with migrating over to the new interface. Most of the changes have resulted in some nice simplifications. This new strategy currently holds on to all AttributeList objects during the lifetime of the Parser object. This is easily tunable. If we desire to have more bound the lifetime of AttributeList objects more precisely, we can have the AttributeList::Factory object (in Parser) push/pop its underlying allocator as we enter/leave key methods in the Parser. This means that we get simple memory management while still having the ability to finely control memory use if necessary. Note that because AttributeList objects are now BumpPtrAllocated, we may reduce malloc() traffic in many large files with attributes. This fixes the leak reported in: <rdar://problem/8650003> llvm-svn: 118675
OpenPOWER on IntegriCloud