summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAge
...
* A bundle of whitespace changes, separated out from the functional changes.Nick Lewycky2010-11-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119886 91177308-0d34-0410-b5e6-96231b3b80d8
* Calculate the value kind of an expression when it's created andJohn McCall2010-11-18
| | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119685 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve diagnostic for calling non-const method on const object. Fixes ↵Argyrios Kyrtzidis2010-11-16
| | | | | | rdar://7743000 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119336 91177308-0d34-0410-b5e6-96231b3b80d8
* Assorted work leading towards the elimination of CK_Unknown.John McCall2010-11-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119138 91177308-0d34-0410-b5e6-96231b3b80d8
* When complaining about ambiguous overload resolution for a unary orDouglas Gregor2010-11-13
| | | | | | | binary operator, provide the types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119008 91177308-0d34-0410-b5e6-96231b3b80d8
* When we're type-checking the result of calling a conversion functionDouglas Gregor2010-11-13
| | | | | | | | | | | (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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119005 91177308-0d34-0410-b5e6-96231b3b80d8
* Pre-compute all possible usual-arithmetic-conversions results for theJohn McCall2010-11-13
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118988 91177308-0d34-0410-b5e6-96231b3b80d8
* Store the list of arithmetic types as a static array of member pointersJohn McCall2010-11-13
| | | | | | | | | instead of copying them all out at the start. Not a significant optimization. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118967 91177308-0d34-0410-b5e6-96231b3b80d8
* Friend function declarations can overload with tag declarations.John McCall2010-11-10
| | | | | | | | Fixes PR7915. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118670 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve our handling of C++ [class.copy]p3, which specifies that aDouglas Gregor2010-11-08
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118418 91177308-0d34-0410-b5e6-96231b3b80d8
* Properly diagnose invalid casts to function references. Patch byDouglas Gregor2010-11-08
| | | | | | | Faisal Vali, tweaked by me. Fixes PR8230. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118400 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement [over.ics.rank]p4: A conversion that does not convert an ↵Anders Carlsson2010-11-05
| | | | | | std::nullptr_t to bool is better than one than does. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118269 91177308-0d34-0410-b5e6-96231b3b80d8
* std::nullptr_t is a fundamental type for RTTI purposes.Anders Carlsson2010-11-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118238 91177308-0d34-0410-b5e6-96231b3b80d8
* When producing overload candidates for binary built-in operators, keepDouglas Gregor2010-11-03
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118178 91177308-0d34-0410-b5e6-96231b3b80d8
* No really, we don't have a retain/release system for statements/expressionsJohn McCall2010-10-26
| | | | | | | | anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117357 91177308-0d34-0410-b5e6-96231b3b80d8
* Actually, that doesn't really work, and anyway we should chooseJohn McCall2010-10-26
| | | | | | | | conversion to id over conversion to void*. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117355 91177308-0d34-0410-b5e6-96231b3b80d8
* Consider conversions of Objective-C pointers to 'id' to be basically ofJohn McCall2010-10-26
| | | | | | | | | | | | the same rank as conversions of normal pointers to 'void*'. Also, resurrect a test case. Fixes rdar://problem/8592139 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117354 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement the integral promotion rules for the C++0x char16_t andDouglas Gregor2010-10-21
| | | | | | | | char32_t character types and enable built-in overloaded operator candidates for these types. Fixes PR8432. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117038 91177308-0d34-0410-b5e6-96231b3b80d8
* Add builtin conditional operator candidates for scoped enumerationDouglas Gregor2010-10-15
| | | | | | | types, from Alp Toker! Fixes PR8344. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116549 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach the warning about unnamed/local types in template arguments toDouglas Gregor2010-10-13
| | | | | | | | actually walk the template argument type to find any unnamed/local types within it. Fixes PR6784. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116382 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce support for emitting diagnostics (warnings + their notes)Douglas Gregor2010-10-12
| | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116373 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked aDouglas Gregor2010-10-08
| | | | | | | bit by me). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116122 91177308-0d34-0410-b5e6-96231b3b80d8
* When performing template argument deduction of a function templateDouglas Gregor2010-09-29
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115086 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't warn with -Wbool-conversions if the user wrote an explicit cast like ↵Argyrios Kyrtzidis2010-09-28
| | | | | | | | "(void *)false". Fixes rdar://8459342. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114955 91177308-0d34-0410-b5e6-96231b3b80d8
* Kill FunctionDecl's IsCopyAssignment bit; it duplicated what couldDouglas Gregor2010-09-27
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114916 91177308-0d34-0410-b5e6-96231b3b80d8
* Patch implements passing arrays to functions expectingFariborz Jahanian2010-09-24
| | | | | | | vla. Implements pr7827. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114737 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't assert when attempting to take the address of an overloadedDouglas Gregor2010-09-12
| | | | | | | | function fails due to ambiguities in partial ordering of function templates. Fixes PR8033. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113725 91177308-0d34-0410-b5e6-96231b3b80d8
* When performing overload resolution, only compare the final conversionDouglas Gregor2010-09-12
| | | | | | | | sequences for two conversion functions when in fact we are in the text of initialization by a user-defined conversion sequences. Fixes PR8034. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113724 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement the "note" in C++ [over.built]p1, which is actually meant toDouglas Gregor2010-09-12
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113713 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't perform integral promotions from an incompletion enumerationDouglas Gregor2010-09-12
| | | | | | | type. Fixes PR8089 in a slightly different way than had been suggested. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113711 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate the comma locations from all of the Sema routines that dealDouglas Gregor2010-09-09
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113495 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the memory leak of FloatingLiteral/IntegerLiteral.Argyrios Kyrtzidis2010-08-28
| | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112361 91177308-0d34-0410-b5e6-96231b3b80d8
* Propagate whether an id-expression is the immediate argument ofJohn McCall2010-08-27
| | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112258 91177308-0d34-0410-b5e6-96231b3b80d8
* One who seeks knowledge learns something new every day.John McCall2010-08-26
| | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112244 91177308-0d34-0410-b5e6-96231b3b80d8
* Split out a header to hold APIs meant for the Sema implementation from Sema.h.John McCall2010-08-25
| | | | | | | | | Clients of Sema don't need to know (for example) the list of diagnostics we support. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112093 91177308-0d34-0410-b5e6-96231b3b80d8
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-25
| | | | | | | | to the new constants. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112047 91177308-0d34-0410-b5e6-96231b3b80d8
* More incremental progress towards not including Expr.h in Sema.h.John McCall2010-08-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112044 91177308-0d34-0410-b5e6-96231b3b80d8
* Move more stuff out of Sema.h.John McCall2010-08-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112026 91177308-0d34-0410-b5e6-96231b3b80d8
* Catch the case of trying to turn '&(X::a)' into a member pointer as well.John McCall2010-08-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111997 91177308-0d34-0410-b5e6-96231b3b80d8
* When trying to resolve the address of an overloaded expression,John McCall2010-08-24
| | | | | | | | | | only form pointers-to-member if the expression has the appropriate form. This avoids assertions later on on invalid code, but also allows us to properly resolve mixed-staticity overloads. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111987 91177308-0d34-0410-b5e6-96231b3b80d8
* Move some of SemaOverload's API to various places in Overload.h, and killJohn McCall2010-08-24
| | | | | | | | some of it off completely. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111957 91177308-0d34-0410-b5e6-96231b3b80d8
* Struggle mightily against header inclusion in Sema.h.John McCall2010-08-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111904 91177308-0d34-0410-b5e6-96231b3b80d8
* OwningExprResult -> ExprResult. This patch brought to you byJohn McCall2010-08-24
| | | | | | | | | M-x query-replace-regexp \(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111903 91177308-0d34-0410-b5e6-96231b3b80d8
* Fold ASTOwningResult back into ActionResult.John McCall2010-08-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111902 91177308-0d34-0410-b5e6-96231b3b80d8
* Kill off ExprArg (now just Expr*) and StmtArg (now just Stmt*).John McCall2010-08-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111863 91177308-0d34-0410-b5e6-96231b3b80d8
* In Sema::AddBuiltinOperatorCandidates, candidate pointer types set can also ↵Argyrios Kyrtzidis2010-08-23
| | | | | | | | contain a ObjCObjectPointerType since r111699. Don't assume that they are only PointerTypes or we will crash. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111798 91177308-0d34-0410-b5e6-96231b3b80d8
* Sundry incremental steps towards killing off Action.John McCall2010-08-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111795 91177308-0d34-0410-b5e6-96231b3b80d8
* twik to my previous patch for pr7936.Fariborz Jahanian2010-08-21
| | | | | | | | Build qualified version of ObjC pointers (not pointers) when doing overload resolution. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111740 91177308-0d34-0410-b5e6-96231b3b80d8
* patch to support comparison involvingFariborz Jahanian2010-08-21
| | | | | | | objctive-c pointer conversions. Fixes pr7936. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111699 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove dead code.Fariborz Jahanian2010-08-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111693 91177308-0d34-0410-b5e6-96231b3b80d8