summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjCXX
Commit message (Collapse)AuthorAgeFilesLines
...
* Switch the initialization of Objective-C message parameters (as occursDouglas Gregor2010-04-212-1/+16
| | | | | | | | | during message sends) over to the new initialization code and away from the C-only CheckSingleAssignmentConstraints. The enables the use of C++ types in method parameters and message arguments, as well as unifying more initialiation code overall. llvm-svn: 102035
* Implement parsing for message sends in Objective-C++. Message sends inDouglas Gregor2010-04-211-4/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Objective-C++ have a more complex grammar than in Objective-C (surprise!), because (1) The receiver of an instance message can be a qualified name such as ::I or identity<I>::type. (2) Expressions in C++ can start with a type. The receiver grammar isn't actually ambiguous; it just takes a bit of work to parse past the type before deciding whether we have a type or expression. We do this in two places within the grammar: once for message sends and once when we're determining whether a []'d clause in an initializer list is a message send or a C99 designated initializer. This implementation of Objective-C++ message sends contains one known extension beyond GCC's implementation, which is to permit a typename-specifier as the receiver type for a class message, e.g., [typename compute_receiver_type<T>::type method]; Note that the same effect can be achieved in GCC by way of a typedef, e.g., typedef typename computed_receiver_type<T>::type Computed; [Computed method]; so this is merely a convenience. Note also that message sends still cannot involve dependent types or values. llvm-svn: 102031
* Rework the Parser-Sema interaction for Objective-C messageDouglas Gregor2010-04-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sends. Major changes include: - Expanded the interface from two actions (ActOnInstanceMessage, ActOnClassMessage), where ActOnClassMessage also handled sends to "super" by checking whether the identifier was "super", to three actions (ActOnInstanceMessage, ActOnClassMessage, ActOnSuperMessage). Code completion has the same changes. - The parser now resolves the type to which we are sending a class message, so ActOnClassMessage now accepts a TypeTy* (rather than an IdentifierInfo *). This opens the door to more interesting types (for Objective-C++ support). - Split ActOnInstanceMessage and ActOnClassMessage into parser action functions (with their original names) and semantic functions (BuildInstanceMessage and BuildClassMessage, respectively). At present, this split is onyl used by ActOnSuperMessage, which decides which kind of super message it has and forwards to the appropriate Build*Message. In the future, Build*Message will be used by template instantiation. - Use getObjCMessageKind() within the disambiguation of Objective-C message sends vs. array designators. Two notes about substandard bits in this patch: - There is some redundancy in the code in ParseObjCMessageExpr and ParseInitializerWithPotentialDesignator; this will be addressed shortly by centralizing the mapping from identifiers to type names for the message receiver. - There is some #if 0'd code that won't likely ever be used---it handles the use of 'super' in methods whose class does not have a superclass---but could be used to model GCC's behavior more closely. This code will die in my next check-in, but I want it in Subversion. llvm-svn: 102021
* More tests for Objective-C-related name lookup weirdness. Yes, it'sDouglas Gregor2010-04-191-0/+18
| | | | | | weird; yes, it's what GCC does. Almost. llvm-svn: 101803
* Add another test case for r101029, which verifies that we nowDouglas Gregor2010-04-121-0/+12
| | | | | | | correctly diagnose instantiation of a function parameter with Objective-C class type (since Objective-C classes can't be passed by value). llvm-svn: 101031
* When upgrading an Objective-C class from a forward declaration to aDouglas Gregor2010-04-091-0/+8
| | | | | | | full-fledged @interface, be sure that the declaration has the right lexical context. <rdar://problem/7827709> llvm-svn: 100903
* Improve diagnostics when we fail to convert from a source type to aDouglas Gregor2010-04-093-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | destination type for initialization, assignment, parameter-passing, etc. The main issue fixed here is that we used rather confusing wording for diagnostics such as t.c:2:9: warning: initializing 'char const [2]' discards qualifiers, expected 'char *' [-pedantic] char *name = __func__; ^ ~~~~~~~~ We're not initializing a 'char const [2]', we're initializing a 'char *' with an expression of type 'char const [2]'. Similar problems existed for other diagnostics in this area, so I've normalized them all with more precise descriptive text to say what we're initializing/converting/assigning/etc. from and to. The warning for the code above is now: t.c:2:9: warning: initializing 'char *' from an expression of type 'char const [2]' discards qualifiers [-pedantic] char *name = __func__; ^ ~~~~~~~~ Fixes <rdar://problem/7447179>. llvm-svn: 100832
* objective-c++ must take into account qualifiers when Fariborz Jahanian2010-03-151-0/+12
| | | | | | considering valid objc pointer converions. llvm-svn: 98557
* When pretty-printing tag types, only print the tag if we're in C (andJohn McCall2010-03-102-2/+2
| | | | | | | | | | therefore not creating ElaboratedTypes, which are still pretty-printed with the written tag). Most of these testcase changes were done by script, so don't feel too sorry for my fingers. llvm-svn: 98149
* Only parse C++0x attribute specifiers in declarators when in C++0xDouglas Gregor2010-02-191-0/+12
| | | | | | | mode. This allows us to detect invalid VLAs in Objective-C++ mode. This should be the last of <rdar://problem/7660386>. llvm-svn: 96679
* Implement C++ name lookup for instance variables of Objective-C classesDouglas Gregor2010-02-191-1/+18
| | | | | | | | | | | | from an instance method. Previously, we were following the Objective-C name lookup rules for ivars, which are of course completely different from and incompatible with the Objective-C++ rules. For the record, the Objective-C++ rules are the sane ones. This is another part of <rdar://problem/7660386>. llvm-svn: 96677
* Make Sema::ActOnClassMessage robust when name lookup for the receiverDouglas Gregor2010-02-191-0/+12
| | | | | | | name finds something other than a TypedefDecl or an ObjCInterfaceDecl. This is a small part of <rdar://problem/7660386>. llvm-svn: 96676
* Patch to allow reinterpret_cast on objective-c pointers.Fariborz Jahanian2010-02-031-0/+23
| | | | | | (partial fix for radar 7591784). llvm-svn: 95245
* Also allow cast of block pointer type toFariborz Jahanian2010-01-211-0/+19
| | | | | | | pointer to an any object. Another variation of radar 7562285. llvm-svn: 94052
* In objective-c++ land, a block pointer is another object pointer.Fariborz Jahanian2010-01-201-0/+23
| | | | | | | So, casting a generic object pointer ('id' or 'Class') to the block pointer is allowed. Fixes radar 7562285. llvm-svn: 94045
* Allow conversion of pointer to an objective-c pointer toFariborz Jahanian2010-01-181-0/+21
| | | | | | a similar pointer. Fixes radar 7552179. llvm-svn: 93803
* Switch initialization of parameters in a call over toDouglas Gregor2009-12-221-2/+2
| | | | | | | | | | | InitializationSequence (when a FunctionDecl is present). This required a few small fixes to initialization sequences: - Make sure to use the adjusted parameter type for initialization of function parameters. - Implement transparent union calling semantics in C llvm-svn: 91902
* Allow comparison of 'void *' with function pointer Fariborz Jahanian2009-12-211-0/+9
| | | | | | as a g++ extension (fixes radar 7481987). llvm-svn: 91827
* Initialization improvements: addition of string initialization and a fewEli Friedman2009-12-191-2/+2
| | | | | | | | small bug fixes in SemaInit, switch over SemaDecl to use it more often, and change a bunch of diagnostics which are different with the new initialization code. llvm-svn: 91767
* Allow pointer convesion of an objective-c pointer toFariborz Jahanian2009-12-161-0/+26
| | | | | | 'void *' to mimic gcc's behavior. (fixes radar 7477351). llvm-svn: 91570
* Diagnose property of reference type as unsupportedFariborz Jahanian2009-12-161-6/+3
| | | | | | instead of crashing for now. llvm-svn: 91546
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-1514-14/+14
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Make tests use the new clang -cc1 flag.Fariborz Jahanian2009-12-1414-14/+14
| | | | llvm-svn: 91298
* Patch to allow C-style cast from 'void *' to block pointer type.Fariborz Jahanian2009-12-111-0/+6
| | | | | | (fixes radar 7465023). llvm-svn: 91171
* Consider conversion of objective-c pointer to 'bool' a Fariborz Jahanian2009-12-111-0/+12
| | | | | | valid standard conversion to match g++'s behaviour. llvm-svn: 91157
* Give the "cannot pass object of non-POD type 'class C' through variadic ↵Chris Lattner2009-12-111-1/+1
| | | | | | constructor; call will abort at runtime" warning a -W flag (non-pod-varargs) and default it being an error by default. There is no good reason to allow users to get bitten by this sort of thing by default. llvm-svn: 91094
* Patch to fix a crash trying to access a category name inFariborz Jahanian2009-12-111-0/+10
| | | | | | | objective-c++ mode and also removed dead-code in this area. (fixes radar 7456710). llvm-svn: 91081
* No need to add -x objecitve-c++Fariborz Jahanian2009-12-101-1/+1
| | | | llvm-svn: 91060
* Add support for finding composite type of twp objective-c pointersFariborz Jahanian2009-12-101-0/+67
| | | | | | in objective-c++ mode. llvm-svn: 91059
* More detailed analysis of typecast to an objective-c pointerFariborz Jahanian2009-12-081-2/+22
| | | | | | in objective-c++ mode without being too lenient. llvm-svn: 90895
* Patch to allow matching 0 with an objective-c pointer typeFariborz Jahanian2009-12-081-0/+18
| | | | | | in objective-c++ mode. Fixes radar 7443165 llvm-svn: 90874
* Patch to allow cstyle cast of objective-c pointers in objective-c++Fariborz Jahanian2009-12-081-0/+20
| | | | | | mode as they are pervasive. llvm-svn: 90867
* Switch XFAIL format to match LLVM.Daniel Dunbar2009-11-032-2/+2
| | | | llvm-svn: 85880
* this test crashes, disable it harder.Chris Lattner2009-07-281-1/+3
| | | | llvm-svn: 77342
* Prep for new warning.Mike Stump2009-07-221-0/+1
| | | | llvm-svn: 76709
* Remove excessive use of Carbon.h / Cocoa.h in clang tests.Daniel Dunbar2009-07-111-4/+0
| | | | | | | | | | | - These kinds of "shotgun" tests are very slow, and do not belong in the regression suite. If these kinds of tests are regarded to have value, they should be added to the LLVM test-suite. - I would actually like to remove all of these tests, but I left Sema/carbon.c and SemaObjC/cocoa.m... llvm-svn: 75399
* This patch includes a conceptually simple, but very intrusive/pervasive change. Steve Naroff2009-07-101-0/+1
| | | | | | | | | | | | The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches. This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic. By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks. llvm-svn: 75314
* Add an XFAIL test to demonstrate references in Obj-C++, this currently crashes.Daniel Dunbar2009-06-051-0/+27
| | | | llvm-svn: 72923
* Use "()" instead of "(void)" when pretty-printing a parameter-less function ↵Argyrios Kyrtzidis2009-06-031-2/+2
| | | | | | type for C++. llvm-svn: 72747
* Improve handling of (X86) target features.Daniel Dunbar2009-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | - This is a WIP... - This adds -march= handling to the driver, and fixes the defaulting of -mcpu on Darwin (which was using the wrong test). Instead of handling -m{sse, ...} in the driver, pass them to clang-cc as -target-feature [+-]name In clang-cc, communicate with the (clang) target to discover the legal features of a target, and the features which are enabled based on -mcpu. This is currently hardcoded just enough to not be a feature regression, we need to get this information from the backend's TableGen information somehow. This is used to construct the full list of features which are being used, which is in turn used to initialize the predefines. llvm-svn: 71061
* Check for method type conflict between declaration inFariborz Jahanian2009-05-011-1/+1
| | | | | | | | class/protocol and implementation which could be an imm. implementation or down in the inheritance hierarchy. llvm-svn: 70568
* Pull clang-cc code for generating PTH files based on the input type.Daniel Dunbar2009-04-011-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | - <rdar://problem/6741594> [pth] don't abuse -x to drive pth generation - Simpler, and fixes PR3915. Cleanup test cases for PTH: - Update to use -emit-pth - Removed PTH test of carbon.c and cocoa.mm; these didn't actually verify anything, and since PTH is token based the extra coverage (over cocoa.m) isn't particularly helpful. - Split PTH tests in cocoa.m to cocoa-pth.m, solely to increase available parallelism when running tests. Ted, could you update the PTH test cases (include-pth.c and cocoa-pth.m) to have some sort of positive check that the PTH is getting used? "# of PTH cache hits" or "tokens read from PTH cache" statistics would work great. :) llvm-svn: 68189
* Rename clang to clang-cc.Daniel Dunbar2009-03-249-10/+11
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* When inside an Objective-C++ method, name lookup should look into theDouglas Gregor2009-02-161-0/+20
| | | | | | | | | interface for ivars before assuming that this is an unresolved function name. Fixes <rdar://problem/6590445>. llvm-svn: 64653
* id<Foo> is a POD type.Anders Carlsson2009-02-091-0/+11
| | | | llvm-svn: 64175
* Add a test case for some Objective-C behavior that will not be supported in ↵Douglas Gregor2009-02-071-0/+11
| | | | | | Objective-C++ llvm-svn: 64019
* Improvements and fixes for name lookup with using directives, from Piotr Rak!Douglas Gregor2009-02-051-0/+50
| | | | | | | | Also, put Objective-C protocols into their own identifier namespace. Otherwise, we find protocols when we don't want to in C++ (but not in C). llvm-svn: 63877
* Initial implementation of argument dependent lookup (a.k.a. ADL,Douglas Gregor2009-02-041-4/+4
| | | | | | | | | | | | a.k.a. Koenig lookup) in C++. Most of the pieces are in place, but for two: - In an unqualified call g(x), even if the name does not refer to anything in the current scope, we can still find functions named "g" based on ADL. We don't yet have this ability. - ADL will need updating for friend functions and templates. llvm-svn: 63692
* Use a single function for doing vararg argument promotion. Also, make sure ↵Anders Carlsson2009-01-161-0/+3
| | | | | | to do the promotion before checking the type - fixes PR3340. llvm-svn: 62323
* Warn when someone tries to pass a variable with a non-POD type to a varargs ↵Anders Carlsson2009-01-131-0/+18
| | | | | | function/method/block. llvm-svn: 62148
OpenPOWER on IntegriCloud