summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Clean up the helpers used to compute the usual arithmetic conversions' resultChandler Carruth2010-12-121-67/+56
| | | | | | | | | | | | type. Localize all of the logic within a single function rather than spreading it throughout the class. Also fixes a buglet where we failed to check for a RHS arithmetic type wider than the LHS and return its canonical type. I've yet to produce a test case that breaks because of this, but it was spotted by inspection by folks on the IRC channel and is obviously correct now. llvm-svn: 121633
* Add a comment to a helper function.Chandler Carruth2010-12-121-0/+2
| | | | llvm-svn: 121632
* Sink the logic to suppress builtin operator overloads in the presence ofChandler Carruth2010-12-121-52/+52
| | | | | | | | | | | user-defined operator overloads on the same enumeral types to the one place where it is used. In theory this removes wasted computation from several paths through this code, but I'm not aware of a case where it actually matters. This is mostly for cleanliness. llvm-svn: 121630
* Reorder the cases in the switch to be more logically grouped (to my mind). IfChandler Carruth2010-12-121-34/+34
| | | | | | | others have another ordering they would prefer, I'm all ears, but this one made it much easier for me to find the group of operators I'm interested in. llvm-svn: 121629
* Remove the final goto from this switch making it explict which overload set isChandler Carruth2010-12-121-2/+3
| | | | | | added for binary operator&. llvm-svn: 121628
* Fold away completely identical code with simple fallthrough.Chandler Carruth2010-12-121-7/+2
| | | | llvm-svn: 121627
* Move and copy function calls around to remove the indirection through gotosChandler Carruth2010-12-121-14/+10
| | | | | | from the switch statement. llvm-svn: 121626
* Simplify the flow through the switch by explicitly listing the added overloadsChandler Carruth2010-12-121-13/+7
| | | | | | for a few cases. llvm-svn: 121625
* Fix 80-column violations and reflowing some code to facilitate those fixes.Chandler Carruth2010-12-121-48/+59
| | | | llvm-svn: 121624
* Begin the refactoring of how builtin operators are added to the overloadChandler Carruth2010-12-121-736/+842
| | | | | | | | | | | | | | candidate set. This breaks apart a huge switch + goto system into distinct methods on a class. It also places the current mess of tables and other static state used in the process within that class. This is still a work in progress. I did a few simplifications that jumped out at me as I went, but I plan to iterate on this a bit before it's truly clean. However, this is easily the most invasive chunk. I benchmarked it on all-std-headers.cpp and an internal testcase that has a major hotspot in overload resolution and saw no real performance impact. llvm-svn: 121623
* It's kindof silly that ExtQuals has an ASTContext&, and we can use thatJohn McCall2010-12-101-3/+3
| | | | | | | | | | space better. Remove this reference. To make that work, change some APIs (most importantly, getDesugaredType()) to take an ASTContext& if they need to return a QualType. Simultaneously, diminish the need to return a QualType by introducing some useful APIs on SplitQualType, which is just a std::pair<const Type *, Qualifiers>. llvm-svn: 121478
* Objective-C pointer conversions to 'id' or qualified 'id' subsumeDouglas Gregor2010-12-061-0/+5
| | | | | | | | cv-qualification conversions. More specifically, there's an implicit cv-qualification conversion (even one that drops qualifiers) when converting to 'id' or qualified 'id'. Fixes <rdar://problem/8734046>. llvm-svn: 121047
* Remove some defensive calls to EmitLoadOfPropertyRefLValue that shouldn'tJohn McCall2010-12-041-4/+52
| | | | | | | be required, and then fix up some missing loads on overloaded-operator paths which that exposed. llvm-svn: 120896
* Improve our handling of cv-qualifiers in Objective-C pointerDouglas Gregor2010-12-011-29/+30
| | | | | | | | | | | | | | | conversions. Previously, we would end up collapsing qualification conversions into the Objective-C pointer conversion step, including (possibly) stripping qualifiers that shouldn't be removed. This generalizes BuildSimilarlyQualifiedPointerType() to also work on Objective-C object pointers, then eliminates the (redundant, not totally correct) BuildSimilarlyQualifiedObjCObjectPointerType() function. Fixes <rdar://problem/8714395>. llvm-svn: 120607
* Switch a lot of call-sites over to using the new value-kind calculations.John McCall2010-11-241-3/+3
| | | | llvm-svn: 120084
* A bundle of whitespace changes, separated out from the functional changes.Nick Lewycky2010-11-201-4/+4
| | | | llvm-svn: 119886
* Calculate the value kind of an expression when it's created andJohn McCall2010-11-181-40/+68
| | | | | | | | | | | | | store it on the expression node. Also store an "object kind", which distinguishes ordinary "addressed" l-values (like variable references and pointer dereferences) and bitfield, @property, and vector-component l-values. Currently we're not using these for much, but I aim to switch pretty much everything calculating l-valueness over to them. For now they shouldn't necessarily be trusted. llvm-svn: 119685
* Improve diagnostic for calling non-const method on const object. Fixes ↵Argyrios Kyrtzidis2010-11-161-1/+17
| | | | | | rdar://7743000 llvm-svn: 119336
* Assorted work leading towards the elimination of CK_Unknown.John McCall2010-11-151-15/+23
| | | | llvm-svn: 119138
* When complaining about ambiguous overload resolution for a unary orDouglas Gregor2010-11-131-6/+10
| | | | | | binary operator, provide the types. llvm-svn: 119008
* When we're type-checking the result of calling a conversion functionDouglas Gregor2010-11-131-2/+9
| | | | | | | | | | (while computing user conversion sequences), make sure that a result of class type is a complete class type. Had we gone through ActOnCallExpr, this would have happened when we built the CallExpr. Fixes PR8425. llvm-svn: 119005
* Pre-compute all possible usual-arithmetic-conversions results for theJohn McCall2010-11-131-26/+85
| | | | | | | | | | promoted arithmetic types for which builtin operator candidates are emitted. A few of these need further analysis. Removes all the uses of UsualArithmeticConversionsType except the core function in SemaExpr.cpp. llvm-svn: 118988
* Store the list of arithmetic types as a static array of member pointersJohn McCall2010-11-131-23/+39
| | | | | | | instead of copying them all out at the start. Not a significant optimization. llvm-svn: 118967
* Friend function declarations can overload with tag declarations.John McCall2010-11-101-1/+3
| | | | | | Fixes PR7915. llvm-svn: 118670
* Improve our handling of C++ [class.copy]p3, which specifies that aDouglas Gregor2010-11-081-1/+1
| | | | | | | | | constructor template will not be used to copy a class object to a value of its own type. We were eliminating all constructor templates whose specializations look like a copy constructor, which eliminated important candidates. Fixes PR8182. llvm-svn: 118418
* Properly diagnose invalid casts to function references. Patch byDouglas Gregor2010-11-081-4/+7
| | | | | | Faisal Vali, tweaked by me. Fixes PR8230. llvm-svn: 118400
* Implement [over.ics.rank]p4: A conversion that does not convert an ↵Anders Carlsson2010-11-051-0/+1
| | | | | | std::nullptr_t to bool is better than one than does. llvm-svn: 118269
* std::nullptr_t is a fundamental type for RTTI purposes.Anders Carlsson2010-11-041-1/+1
| | | | llvm-svn: 118238
* When producing overload candidates for binary built-in operators, keepDouglas Gregor2010-11-031-123/+258
| | | | | | | | | the sets of available conversions for the first and second arguments separate. This is apparently the indent of C++ [over.built], and reduces the number of overload candidates generated, eliminating some ambiguities. Fixes PR8477. llvm-svn: 118178
* No really, we don't have a retain/release system for statements/expressionsJohn McCall2010-10-261-7/+7
| | | | | | anymore. llvm-svn: 117357
* Actually, that doesn't really work, and anyway we should chooseJohn McCall2010-10-261-10/+1
| | | | | | conversion to id over conversion to void*. llvm-svn: 117355
* Consider conversions of Objective-C pointers to 'id' to be basically ofJohn McCall2010-10-261-1/+10
| | | | | | | | | | the same rank as conversions of normal pointers to 'void*'. Also, resurrect a test case. Fixes rdar://problem/8592139 llvm-svn: 117354
* Implement the integral promotion rules for the C++0x char16_t andDouglas Gregor2010-10-211-14/+31
| | | | | | | char32_t character types and enable built-in overloaded operator candidates for these types. Fixes PR8432. llvm-svn: 117038
* Add builtin conditional operator candidates for scoped enumerationDouglas Gregor2010-10-151-3/+12
| | | | | | types, from Alp Toker! Fixes PR8344. llvm-svn: 116549
* Teach the warning about unnamed/local types in template arguments toDouglas Gregor2010-10-131-1/+1
| | | | | | | actually walk the template argument type to find any unnamed/local types within it. Fixes PR6784. llvm-svn: 116382
* Introduce support for emitting diagnostics (warnings + their notes)Douglas Gregor2010-10-121-14/+11
| | | | | | | | | | | | | | | that are suppressed during template argument deduction. This change queues diagnostics computed during template argument deduction. Then, if the resulting function template specialization or partial specialization is chosen by overload resolution or partial ordering (respectively), we will emit the queued diagnostics at that point. This addresses most of PR6784. However, the check for unnamed/local template arguments (which existed before this change) is still only skin-deep, and needs to be extended to look deeper into types. It must be improved to finish PR6784. llvm-svn: 116373
* Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked aDouglas Gregor2010-10-081-4/+9
| | | | | | bit by me). llvm-svn: 116122
* When performing template argument deduction of a function templateDouglas Gregor2010-09-291-2/+2
| | | | | | | | against a function type, be sure to check the type of the resulting function template specialization against the desired function type after substituting the deduced/defaulted template arguments. Fixes PR8196. llvm-svn: 115086
* Don't warn with -Wbool-conversions if the user wrote an explicit cast like ↵Argyrios Kyrtzidis2010-09-281-1/+2
| | | | | | | | "(void *)false". Fixes rdar://8459342. llvm-svn: 114955
* Kill FunctionDecl's IsCopyAssignment bit; it duplicated what couldDouglas Gregor2010-09-271-1/+1
| | | | | | | | already be determined by isCopyAssignmentOperator(), and was set too late in the process for all clients to see the appropriate value. Cleanup only; no functionality change. llvm-svn: 114916
* Patch implements passing arrays to functions expectingFariborz Jahanian2010-09-241-0/+6
| | | | | | vla. Implements pr7827. llvm-svn: 114737
* Don't assert when attempting to take the address of an overloadedDouglas Gregor2010-09-121-1/+3
| | | | | | | function fails due to ambiguities in partial ordering of function templates. Fixes PR8033. llvm-svn: 113725
* When performing overload resolution, only compare the final conversionDouglas Gregor2010-09-121-7/+11
| | | | | | | sequences for two conversion functions when in fact we are in the text of initialization by a user-defined conversion sequences. Fixes PR8034. llvm-svn: 113724
* Implement the "note" in C++ [over.built]p1, which is actually meant toDouglas Gregor2010-09-121-1/+43
| | | | | | | | be a semantic requirement that a built-in overloaded operator is not added to the overload set of there is already a user-defined overloaded operator with the same parameter types. Fixes PR8087. llvm-svn: 113713
* Don't perform integral promotions from an incompletion enumerationDouglas Gregor2010-09-121-1/+2
| | | | | | type. Fixes PR8089 in a slightly different way than had been suggested. llvm-svn: 113711
* Eliminate the comma locations from all of the Sema routines that dealDouglas Gregor2010-09-091-9/+4
| | | | | | | | with comma-separated lists. We never actually used the comma locations, nor did we store them in the AST, but we did manage to waste time during template instantiation to produce fake locations. llvm-svn: 113495
* Fix the memory leak of FloatingLiteral/IntegerLiteral.Argyrios Kyrtzidis2010-08-281-2/+2
| | | | | | | | | | | For large floats/integers, APFloat/APInt will allocate memory from the heap to represent these numbers. Unfortunately, when we use a BumpPtrAllocator to allocate IntegerLiteral/FloatingLiteral nodes the memory associated with the APFloat/APInt values will never get freed. I introduce the class 'APNumericStorage' which uses ASTContext's allocator for memory allocation and is used internally by FloatingLiteral/IntegerLiteral. Fixes rdar://7637185 llvm-svn: 112361
* Propagate whether an id-expression is the immediate argument ofJohn McCall2010-08-271-14/+4
| | | | | | | | | | | | | | | | | | | an '&' expression from the second caller of ActOnIdExpression. Teach template argument deduction that an overloaded id-expression doesn't give a valid type for deduction purposes to a non-static member function unless the expression has the correct syntactic form. Teach ActOnIdExpression that it shouldn't try to create implicit member expressions for '&function', because this isn't a permitted form of use for member functions. Teach CheckAddressOfOperand to diagnose these more carefully. Some of these cases aren't reachable right now because earlier diagnostics interrupt them. llvm-svn: 112258
* One who seeks knowledge learns something new every day.John McCall2010-08-261-12/+11
| | | | | | | | | One who seeks the Tao unlearns something new every day. Less and less remains until you arrive at non-action. When you arrive at non-action, nothing will be left undone. llvm-svn: 112244
* Split out a header to hold APIs meant for the Sema implementation from Sema.h.John McCall2010-08-251-1/+1
| | | | | | | Clients of Sema don't need to know (for example) the list of diagnostics we support. llvm-svn: 112093
OpenPOWER on IntegriCloud