summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement PR6845. We allow matching constraints to have differentChris Lattner2010-04-231-41/+60
| | | | | | | | input and output types when the smaller value isn't mentioned in the asm string. Extend this support from integers to also allowing fp values to be mismatched (if not mentioned in the asm string). llvm-svn: 102188
* Require a complete type for the lhs of member pointer dereference operations ↵Sebastian Redl2010-04-231-0/+5
| | | | | | if the type isn't exactly the same as the container class. Fixes PR6783. llvm-svn: 102186
* When instantiating a typedef of an anonymous tag type, note in the tagDouglas Gregor2010-04-231-0/+10
| | | | | | | declaration that this typedef gives the tag a name. Fixes a problem uncovered by Boost.GIL (Generic Image Library). llvm-svn: 102180
* Cleanup.Anders Carlsson2010-04-231-2/+1
| | | | llvm-svn: 102179
* Handle copy initialization in BuildImplicitMemberInitializer. Not used yet.Anders Carlsson2010-04-231-6/+35
| | | | llvm-svn: 102178
* Revert "C++ doesn't really use "namespaces" for different kinds of names the ↵Daniel Dunbar2010-04-233-108/+71
| | | | | | same", which seems to break most C++ nightly test apps. llvm-svn: 102174
* Add another 'catch all' access diagnostic.Anders Carlsson2010-04-231-2/+3
| | | | llvm-svn: 102169
* Add an ImplicitInitializerKind enum and pass it to ↵Anders Carlsson2010-04-231-11/+62
| | | | | | BuildImplicitBaseInitializer and BuildImplicitMemberInitializer. llvm-svn: 102166
* Fix a think-o that broke self-host.Anders Carlsson2010-04-231-20/+20
| | | | llvm-svn: 102165
* C++ doesn't really use "namespaces" for different kinds of names the sameJohn McCall2010-04-233-71/+108
| | | | | | | | | | | | | way that C does. Among other differences, elaborated type specifiers are defined to skip "non-types", which, as you might imagine, does not include typedefs. Rework our use of IDNS masks to capture the semantics of different kinds of declarations better, and remove most current lookup filters. Removing the last remaining filter is more complicated and will happen in a separate patch. Fixes PR 6885 as well some spectrum of unfiled bugs. llvm-svn: 102164
* Factor code to initialize an implicit member out into a separate function.Anders Carlsson2010-04-231-39/+62
| | | | llvm-svn: 102162
* Remove calls to isDependentContext, since we handle that case earlier in the ↵Anders Carlsson2010-04-231-23/+15
| | | | | | code. Make BuildImplicitBaseInitializer return a boolean instead. llvm-svn: 102159
* Template instantiation for @try and @finally (but not @catch, yet).Douglas Gregor2010-04-221-6/+65
| | | | llvm-svn: 102147
* Kill off IDNS_ObjCImplementation and IDNS_ObjCCategoryName; theyDouglas Gregor2010-04-222-9/+1
| | | | | | | aren't and never were used. There's a gap in the bit pattern for IDNS now, but I'm sure *someone* will fill it. llvm-svn: 102143
* Template instantiation for the Objective-C "fast enumeration"Douglas Gregor2010-04-222-7/+52
| | | | | | | | | | statement, i.e., for (element in collection) { // do something } llvm-svn: 102138
* Template instantiation for Objective-C++ @synchronized statements.Douglas Gregor2010-04-222-5/+34
| | | | llvm-svn: 102134
* Implement template instantiation for Objective-C++ @throw statements.Douglas Gregor2010-04-223-17/+47
| | | | llvm-svn: 102133
* Use the naming class from the overloaded lookup when access-checking anJohn McCall2010-04-221-9/+1
| | | | | | | | | | address of overloaded function, instead of assuming that a nested name specifier was used. A nested name specifier is not required for static functions. Fixes PR6886. llvm-svn: 102107
* Some Objective-C++ types and expressions will never change duringDouglas Gregor2010-04-221-40/+6
| | | | | | | template instantiation, since they cannot be dependent or have dependent parts. Handle them the simple way. llvm-svn: 102094
* When a dependent Objective-C++ message send was able to resolve theDouglas Gregor2010-04-223-138/+146
| | | | | | | | method being called at template definition time, retain that method and pass it through to type-checking. We will not perform any lookup for the method during template instantiation. llvm-svn: 102081
* Remove the SelectorLoc argument to Sema::BuildInstanceMesssage andDouglas Gregor2010-04-223-18/+5
| | | | | | | Sema::BuildClassMessage; we weren't using it, and template instantiation was faking it anyway. llvm-svn: 102074
* Expand the one use of TransformPointerLikeType and eliminate this macro. No ↵Douglas Gregor2010-04-221-24/+17
| | | | | | functionality change llvm-svn: 102073
* Implement template instantiation for Objective-C++ message sends. WeDouglas Gregor2010-04-224-20/+171
| | | | | | | | | | | | support dependent receivers for class and instance messages, along with dependent message arguments (of course), and check as much as we can at template definition time. This commit also deals with a subtle aspect of template instantiation in Objective-C++, where the type 'T *' can morph from a dependent PointerType into a non-dependent ObjCObjectPointer type. llvm-svn: 102071
* When checking whether to diagnose an initialized "extern" variable,Douglas Gregor2010-04-221-1/+5
| | | | | | | look for the const on the base type rather than on the top-level type. Fixes PR6495 properly. llvm-svn: 102066
* Record nested-name-specifiers of when we createDouglas Gregor2010-04-221-0/+1
| | | | | | elaborated-type-specifiers. Patch by Enea Zaffanella! llvm-svn: 102065
* Re-land the patch that merges two diagnostics into one now that it passes ↵Anders Carlsson2010-04-224-23/+19
| | | | | | self-host :) llvm-svn: 102050
* Revert "Unify two diagnostics into one.", it breaks with an assertion ↵Daniel Dunbar2010-04-223-9/+10
| | | | | | failure on bootstrap. llvm-svn: 102043
* Unify two diagnostics into one.Anders Carlsson2010-04-223-10/+9
| | | | llvm-svn: 102040
* Call PerformCopyInitialization to properly initialize the exception temporaryJohn McCall2010-04-221-15/+12
| | | | | | | | | in a throw expression. Use EmitAnyExprToMem to emit the throw expression, which magically elides the final copy-constructor call (which raises a new strict-compliance bug, but baby steps). Give __cxa_throw a destructor pointer if the exception type has a non-trivial destructor. llvm-svn: 102039
* Whenever we complain about a failed initialization of a function orDouglas Gregor2010-04-224-4/+37
| | | | | | | | | | | | | | | | | method parameter, provide a note pointing at the parameter itself so the user does not have to manually look for the function/method being called and match up parameters to arguments. For example, we now get: t.c:4:5: warning: incompatible pointer types passing 'long *' to parameter of type 'int *' [-pedantic] f(long_ptr); ^~~~~~~~ t.c:1:13: note: passing argument to parameter 'x' here void f(int *x); ^ llvm-svn: 102038
* Remove an unused declaration.Anders Carlsson2010-04-211-1/+0
| | | | llvm-svn: 102037
* Switch the initialization of Objective-C message parameters (as occursDouglas Gregor2010-04-213-23/+25
| | | | | | | | | 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
* Migrate the responsibility for turning the receiver name in anDouglas Gregor2010-04-212-11/+25
| | | | | | | | | Objective-C class message expression into a type from the parser (which was doing so in two places) to Action::getObjCMessageKind() which, in the case of Sema, reduces the number of name lookups we need to perform. llvm-svn: 102026
* Diagnose access to fields with private constructors.Anders Carlsson2010-04-211-0/+7
| | | | llvm-svn: 102025
* Eliminate unused code in Sema::ActOnSuperMessage and use early exitsDouglas Gregor2010-04-211-68/+28
| | | | | | to reduce nesting. No functionality change. llvm-svn: 102022
* Rework the Parser-Sema interaction for Objective-C messageDouglas Gregor2010-04-213-230/+424
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Keep tack of whether a base in an InitializedEntity is an inherited virtual ↵Anders Carlsson2010-04-214-16/+45
| | | | | | base or not. Use this in CheckConstructorAccess. llvm-svn: 102020
* Improve on source location of diagnostic when defaultFariborz Jahanian2010-04-211-1/+1
| | | | | | property synthesis is using a super class ivar. llvm-svn: 102011
* Pass the InitializedEntity to Sema::CheckConstructorAccess and use it to ↵Anders Carlsson2010-04-213-8/+20
| | | | | | report different diagnostics depending on which entity is being initialized. llvm-svn: 102010
* CXXNamedCastExpr is actually an abstract expression.Zhongxing Xu2010-04-211-0/+1
| | | | llvm-svn: 101994
* Overhaul the AST representation of Objective-C message sendDouglas Gregor2010-04-213-111/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expressions, to improve source-location information, clarify the actual receiver of the message, and pave the way for proper C++ support. The ObjCMessageExpr node represents four different kinds of message sends in a single AST node: 1) Send to a object instance described by an expression (e.g., [x method:5]) 2) Send to a class described by the class name (e.g., [NSString method:5]) 3) Send to a superclass class (e.g, [super method:5] in class method) 4) Send to a superclass instance (e.g., [super method:5] in instance method) Previously these four cases where tangled together. Now, they have more distinct representations. Specific changes: 1) Unchanged; the object instance is represented by an Expr*. 2) Previously stored the ObjCInterfaceDecl* referring to the class receiving the message. Now stores a TypeSourceInfo* so that we know how the class was spelled. This both maintains typedef information and opens the door for more complicated C++ types (e.g., dependent types). There was an alternative, unused representation of these sends by naming the class via an IdentifierInfo *. In practice, we either had an ObjCInterfaceDecl *, from which we would get the IdentifierInfo *, or we fell into the case below... 3) Previously represented by a class message whose IdentifierInfo * referred to "super". Sema and CodeGen would use isStr("super") to determine if they had a send to super. Now represented as a "class super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). 4) Previously represented by an instance message whose receiver is a an ObjCSuperExpr, which Sema and CodeGen would check for via isa<ObjCSuperExpr>(). Now represented as an "instance super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). Note that ObjCSuperExpr only has one remaining use in the AST, which is for "super.prop" references. The new representation of ObjCMessageExpr is 2 pointers smaller than the old one, since it combines more storage. It also eliminates a leak when we loaded message-send expressions from a precompiled header. The representation also feels much cleaner to me; comments welcome! This patch attempts to maintain the same semantics we previously had with Objective-C message sends. In several places, there are massive changes that boil down to simply replacing a nested-if structure such as: if (message has a receiver expression) { // instance message if (isa<ObjCSuperExpr>(...)) { // send to super } else { // send to an object } } else { // class message if (name->isStr("super")) { // class send to super } else { // send to class } } with a switch switch (E->getReceiverKind()) { case ObjCMessageExpr::SuperInstance: ... case ObjCMessageExpr::Instance: ... case ObjCMessageExpr::SuperClass: ... case ObjCMessageExpr::Class:... } There are quite a few places (particularly in the checkers) where send-to-super is effectively ignored. I've placed FIXMEs in most of them, and attempted to address send-to-super in a reasonable way. This could use some review. llvm-svn: 101972
* Remove an unused parameter from isImplicitlyDefined.Anders Carlsson2010-04-201-2/+1
| | | | llvm-svn: 101962
* Fix comment to reflect recent code change.John Thompson2010-04-201-1/+1
| | | | llvm-svn: 101960
* Factor some common code out into a separate function.Anders Carlsson2010-04-201-37/+40
| | | | llvm-svn: 101952
* push some source location information down through the compiler,Chris Lattner2010-04-201-2/+1
| | | | | | | | into ContentCache::getBuffer. This allows it to produce diagnostics on the broken #include line instead of without a location. llvm-svn: 101939
* Patch to support transparent_union types onFariborz Jahanian2010-04-201-0/+5
| | | | | | objective-c methods. Fixes radar 7875968. llvm-svn: 101935
* Remove dead code.Benjamin Kramer2010-04-202-30/+0
| | | | llvm-svn: 101920
* Keep proper source location information for the type in an Objective-CDouglas Gregor2010-04-203-13/+17
| | | | | | @encode expression. llvm-svn: 101907
* Introduce a limit on the depth of the template instantiation backtraceDouglas Gregor2010-04-201-1/+21
| | | | | | | | | | | | | | | | we will print with each error that occurs during template instantiation. When the backtrace is longer than that, we will print N/2 of the innermost backtrace entries and N/2 of the outermost backtrace entries, then skip the middle entries with a note such as: note: suppressed 2 template instantiation contexts; use -ftemplate-backtrace-limit=N to change the number of template instantiation entries shown This should eliminate some excessively long backtraces that aren't providing any value. llvm-svn: 101882
* reapply john's patch, he broke mainline again by changing the test.Chris Lattner2010-04-201-1/+1
| | | | llvm-svn: 101871
OpenPOWER on IntegriCloud