aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
AgeCommit message (Collapse)Author
2010-11-24Switch a lot of call-sites over to using the new value-kind calculations.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120084 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20A bundle of whitespace changes, separated out from the functional changes.Nick Lewycky
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119886 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18Calculate the value kind of an expression when it's created andJohn McCall
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
2010-11-16Improve diagnostic for calling non-const method on const object. Fixes ↵Argyrios Kyrtzidis
rdar://7743000 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119336 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15Assorted work leading towards the elimination of CK_Unknown.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119138 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13When complaining about ambiguous overload resolution for a unary orDouglas Gregor
binary operator, provide the types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119008 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13When we're type-checking the result of calling a conversion functionDouglas Gregor
(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
2010-11-13Pre-compute all possible usual-arithmetic-conversions results for theJohn McCall
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
2010-11-13Store the list of arithmetic types as a static array of member pointersJohn McCall
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
2010-11-10Friend function declarations can overload with tag declarations.John McCall
Fixes PR7915. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118670 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-08Improve our handling of C++ [class.copy]p3, which specifies that aDouglas Gregor
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
2010-11-08Properly diagnose invalid casts to function references. Patch byDouglas Gregor
Faisal Vali, tweaked by me. Fixes PR8230. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118400 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-05Implement [over.ics.rank]p4: A conversion that does not convert an ↵Anders Carlsson
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
2010-11-04std::nullptr_t is a fundamental type for RTTI purposes.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118238 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-03When producing overload candidates for binary built-in operators, keepDouglas Gregor
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
2010-10-26No really, we don't have a retain/release system for statements/expressionsJohn McCall
anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117357 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26Actually, that doesn't really work, and anyway we should chooseJohn McCall
conversion to id over conversion to void*. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117355 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26Consider conversions of Objective-C pointers to 'id' to be basically ofJohn McCall
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
2010-10-21Implement the integral promotion rules for the C++0x char16_t andDouglas Gregor
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
2010-10-15Add builtin conditional operator candidates for scoped enumerationDouglas Gregor
types, from Alp Toker! Fixes PR8344. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116549 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-13Teach the warning about unnamed/local types in template arguments toDouglas Gregor
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
2010-10-12Introduce support for emitting diagnostics (warnings + their notes)Douglas Gregor
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
2010-10-08Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked aDouglas Gregor
bit by me). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116122 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29When performing template argument deduction of a function templateDouglas Gregor
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
2010-09-28Don't warn with -Wbool-conversions if the user wrote an explicit cast like ↵Argyrios Kyrtzidis
"(void *)false". Fixes rdar://8459342. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114955 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27Kill FunctionDecl's IsCopyAssignment bit; it duplicated what couldDouglas Gregor
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
2010-09-24Patch implements passing arrays to functions expectingFariborz Jahanian
vla. Implements pr7827. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114737 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-12Don't assert when attempting to take the address of an overloadedDouglas Gregor
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
2010-09-12When performing overload resolution, only compare the final conversionDouglas Gregor
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
2010-09-12Implement the "note" in C++ [over.built]p1, which is actually meant toDouglas Gregor
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
2010-09-12Don't perform integral promotions from an incompletion enumerationDouglas Gregor
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
2010-09-09Eliminate the comma locations from all of the Sema routines that dealDouglas Gregor
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
2010-08-28Fix the memory leak of FloatingLiteral/IntegerLiteral.Argyrios Kyrtzidis
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
2010-08-27Propagate whether an id-expression is the immediate argument ofJohn McCall
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
2010-08-26One who seeks knowledge learns something new every day.John McCall
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
2010-08-25Split out a header to hold APIs meant for the Sema implementation from Sema.h.John McCall
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
2010-08-25GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall
to the new constants. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112047 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25More incremental progress towards not including Expr.h in Sema.h.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112044 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25Move more stuff out of Sema.h.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112026 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24Catch the case of trying to turn '&(X::a)' into a member pointer as well.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111997 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24When trying to resolve the address of an overloaded expression,John McCall
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
2010-08-24Move some of SemaOverload's API to various places in Overload.h, and killJohn McCall
some of it off completely. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111957 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24Struggle mightily against header inclusion in Sema.h.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111904 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24OwningExprResult -> ExprResult. This patch brought to you byJohn McCall
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
2010-08-24Fold ASTOwningResult back into ActionResult.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111902 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23Kill off ExprArg (now just Expr*) and StmtArg (now just Stmt*).John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111863 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23In Sema::AddBuiltinOperatorCandidates, candidate pointer types set can also ↵Argyrios Kyrtzidis
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
2010-08-23Sundry incremental steps towards killing off Action.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111795 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21twik to my previous patch for pr7936.Fariborz Jahanian
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
2010-08-21patch to support comparison involvingFariborz Jahanian
objctive-c pointer conversions. Fixes pr7936. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111699 91177308-0d34-0410-b5e6-96231b3b80d8