summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseObjc.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* User-defined literals: reject string and character UDLs in all places where theRichard Smith2012-03-061-0/+2
| | | | | | | | | | grammar requires a string-literal and not a user-defined-string-literal. The two constructs are still represented by the same TokenKind, in order to prevent a combinatorial explosion of different kinds of token. A flag on Token tracks whether a ud-suffix is present, in order to prevent clients from needing to look at the token's spelling. llvm-svn: 152098
* Change @import to @__experimental_modules_import. We are not ready to ↵Ted Kremenek2012-03-011-1/+1
| | | | | | | | commit to a particular syntax for modules, and don't have time to push it forward in the near future. llvm-svn: 151841
* objective-c: provide fixit hint when atomic property does notFariborz Jahanian2012-02-291-4/+10
| | | | | | | have matching user defined setter/getter and a warning is issued. In this case, a fixit note is displayed. // rdar://10267155 llvm-svn: 151766
* [libclang] Make sure that all top-level decls in a @implementation areArgyrios Kyrtzidis2012-02-231-3/+1
| | | | | | | | marked as such. Previously we missed tag declarations; fixes rdar://10902015 llvm-svn: 151283
* Generalize -Wempty-body: warn when statement body is empty (closes: PR11329)Dmitri Gribenko2012-02-141-1/+3
| | | | | | | | | | | | | | * if, switch, range-based for: warn if semicolon is on the same line. * for, while: warn if semicolon is on the same line and either next statement is compound statement or next statement has more indentation. Replacing the semicolon with {} or moving the semicolon to the next line will always silence the warning. Tests from SemaCXX/if-empty-body.cpp merged into SemaCXX/warn-empty-body.cpp. llvm-svn: 150515
* Make parsing of objc @implementations more robust.Argyrios Kyrtzidis2012-02-071-82/+105
| | | | | | | | | | | | | | | | | | | Parsing of @implementations was based on modifying global state from the parser; the logic for late parsing of methods was spread in multiple places making it difficult to have a robust error recovery. -it was difficult to ensure that we don't neglect parsing the lexed methods. -it was difficult to setup the original objc container context for parsing the lexed methods after completing ParseObjCAtImplementationDeclaration and returning to top level context. Enhance parsing of @implementations by centralizing it in Parser::ParseObjCAtImplementationDeclaration(). ParseObjCAtImplementationDeclaration now returns only after an @implementation is fully parsed; all the data and logic for late parsing of methods is now in one place. This allows us to provide code-completion for late parsed methods with mis-matched braces. rdar://10775381 llvm-svn: 149987
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-2/+0
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Under -fmodules, accept #public <macroname> and #private <macroname>Douglas Gregor2012-01-031-1/+5
| | | | | | | to make a macro public (the default for headers) or private, respectively. llvm-svn: 147455
* Introduce a non-uglified syntax for module imports in Objective-C:Douglas Gregor2012-01-031-0/+2
| | | | | | @import identifier [. identifier]* ; llvm-svn: 147452
* Eliminate ObjCForwardProtocolDecl, which is redundant now thatDouglas Gregor2012-01-011-11/+10
| | | | | | ObjCProtocolDecl modules forward declarations properly. llvm-svn: 147415
* Unweaken vtables as per ↵David Blaikie2011-12-201-0/+6
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
* In Parser::SkipUntil do not stop at '@' unconditionally.Argyrios Kyrtzidis2011-12-171-2/+6
| | | | | | | | | | | | | | | Stopping at '@' was originally intended to avoid skipping an '@' at the @interface context when doing parser recovery, but we should not stop at all '@' tokens because they may be part of expressions (e.g. in @"string", @selector(), etc.), so in most cases we will want to skip them. This commit caused 'test/Parser/method-def-in-class.m' to fail for the cases where we tried to recover from unmatched angle bracket but IMO it is not a big deal to not have good recovery from such broken code and the way we did recovery would not always work anyway (e.g. if there was '@' in an expression). The case that rdar://7029784 is about still passes. llvm-svn: 146815
* After late parsing an objc method, make sure there are no leftover cached ↵Argyrios Kyrtzidis2011-12-171-2/+19
| | | | | | | | | | | | | | | tokens, because the memory associated with them is going to get released. We also don't want them to affect later parsing. (We do the same for C++ inline methods.) The underlying cause for the leftover tokens is going to be addressed in the next commit. Couldn't get a test case for the crash though. rdar://10583033. llvm-svn: 146814
* Fix: allow @protocol forward declarations inside @implementation-s.Erik Verbruggen2011-12-081-1/+2
| | | | llvm-svn: 146147
* Extend warnings for missing '@end'.Erik Verbruggen2011-12-061-16/+51
| | | | | | Fixes PR2709. llvm-svn: 145928
* Fix leaking of LexedMethod objects created for caching objc method ↵Argyrios Kyrtzidis2011-11-291-1/+9
| | | | | | | | definitions tokens for late parsing. llvm-svn: 145394
* [libclang] Fix crash on invalid code. Fixes rdar://10451854Argyrios Kyrtzidis2011-11-161-1/+2
| | | | llvm-svn: 144766
* 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
OpenPOWER on IntegriCloud