summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Compute standard conversion sequences for conversions to atomicDouglas Gregor2012-04-121-7/+44
| | | | | | | | | | | | types. The second and third conversions in the sequence are based on the conversion for the underlying type, so that we get sensible overloading behavior for, e.g., _Atomic(int) vs. _Atomic(float). As part of this, actually implement the lvalue-to-rvalue conversion for atomic types. There is probably a pile of code in SemaExpr that can now be deleted, but I haven't tracked it down yet. llvm-svn: 154596
* Clean up last commit as per dgregor's comments.David Chisnall2012-04-111-7/+7
| | | | llvm-svn: 154501
* Allow c++ initialisers to initialise _Atomic fields.David Chisnall2012-04-111-0/+7
| | | | llvm-svn: 154499
* Allow a conversion from the empty initializer list {} to anDouglas Gregor2012-04-041-0/+10
| | | | | | | std::initializer_list<T> so long as <T> is known. This conversion has identity rank. llvm-svn: 154065
* When computing the conversion sequence in overload resolutionJohn McCall2012-04-041-0/+2
| | | | | | | | for converting an empty list to a scalar, be sure to initialize the source and destination types so that comparison of conversion sequences will work in case there are multiple viable candidates. llvm-svn: 153993
* Finish PR10217: Ensure we say that a special member was implicitly, notRichard Smith2012-04-021-4/+7
| | | | | | explicitly, deleted in all relevant cases, and explain why. llvm-svn: 153894
* Extend -Wc++11-narrowing to cover converted constant expressions as well as ↵Eli Friedman2012-03-291-9/+6
| | | | | | braced-initializers. <rdar://problem/11121178>. llvm-svn: 153703
* Even more careful consideration of C++11 13.3.3.1p4. Fixes PR12241.Sebastian Redl2012-03-271-11/+21
| | | | llvm-svn: 153523
* Teach APValue printer to print boolean 0 and 1 as 'false' and 'true'. Fix upRichard Smith2012-03-231-5/+15
| | | | | | some calling code to actually pass in a non-null type, to avoid a crash. llvm-svn: 153358
* More careful consideration of C++11 13.3.3.1p4. Fixes PR12257.Sebastian Redl2012-03-201-7/+19
| | | | llvm-svn: 153130
* When emitting a diagnostic about two-phase name lookup, don't do uselessNick Lewycky2012-03-141-0/+3
| | | | | | qualified name lookups into transparent contexts. llvm-svn: 152739
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-33/+33
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-101-2/+4
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* Qualifiers on a canonical array type go on the outermost type, not theDouglas Gregor2012-03-101-6/+0
| | | | | | innermost type. Fixes PR12142. llvm-svn: 152456
* [AST/Sema/libclang] Replace getSourceRange().getBegin() with getLocStart().Daniel Dunbar2012-03-091-20/+20
| | | | | | | | | - getSourceRange().getBegin() is about as awesome a pattern as .copy().size(). I already killed the hot paths so this doesn't seem to impact performance on my tests-of-the-day, but it is a much more sensible (and shorter) pattern. llvm-svn: 152419
* Literal operators can't have default arguments.Richard Smith2012-03-091-7/+0
| | | | llvm-svn: 152394
* Support for raw and template forms of numeric user-defined literals,Richard Smith2012-03-091-71/+50
| | | | | | and lots of tidying up. llvm-svn: 152392
* AST representation for user-defined literals, plus just enough of semanticRichard Smith2012-03-071-0/+103
| | | | | | | | | | | | | | | | | | | | | analysis to make the AST representation testable. They are represented by a new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic properties, including full CodeGen support, are achieved for free by this representation. UserDefinedLiterals can never be dependent, so no custom instantiation behavior is required. They are mangled as if they were direct calls to the underlying literal operator. This matches g++'s apparent behavior (but not its actual mangling, which is broken for literal-operator-ids). User-defined *string* literals are now fully-operational, but the semantic analysis is quite hacky and needs more work. No other forms of user-defined literal are created yet, but the AST support for them is present. This patch committed after midnight because we had already hit the quota for new kinds of literal yesterday. llvm-svn: 152211
* Single- and zero-element initializer lists to scalars are ↵Sebastian Redl2012-02-281-0/+1
| | | | | | list-initializations. Fixes PR12118. llvm-svn: 151666
* Implement a FIXME for conversion sequence distinction. Should fix PR12092.Sebastian Redl2012-02-271-2/+10
| | | | llvm-svn: 151577
* ArrayRef'ize various functions in the AST/Parser/Sema.Ahmed Charles2012-02-251-120/+135
| | | | llvm-svn: 151447
* Fix a regression from r151117: ADL requires that we attempt to complete anyRichard Smith2012-02-251-6/+5
| | | | | | | | associated classes, since it can find friend functions declared within them, but overload resolution does not otherwise require argument types to be complete. llvm-svn: 151434
* Implement C++11 [over.match.copy]p1b2, which allows the use ofDouglas Gregor2012-02-241-5/+9
| | | | | | | | | | | explicit conversion functions to initialize the argument to a copy/move constructor that itself is the subject of direct initialization. Since we don't have that much context in overload resolution, we end up threading more flags :(. Fixes <rdar://problem/10903741> / PR10456. llvm-svn: 151409
* Teach overload resolution to prefer user-defined conversion via aDouglas Gregor2012-02-221-0/+48
| | | | | | | | | | lambda closure type's function pointer conversion over user-defined conversion via a lambda closure type's block pointer conversion, always. This is a preference for more-standard code (since blocks are an extension) and a nod to efficiency, since function pointers don't require any memory management. Fixes PR12063. llvm-svn: 151170
* Implement C++11 [expr.call]p11: If the operand to a decltype-specifier is aRichard Smith2012-02-221-0/+2
| | | | | | | | | | | | | | | | | | function call (or a comma expression with a function call on its right-hand side), possibly parenthesized, then the return type is not required to be complete and a temporary is not bound. Other subexpressions inside a decltype expression do not get this treatment. This is implemented by deferring the relevant checks for all calls immediately within a decltype expression, then, when the expression is fully-parsed, checking the relevant constraints and stripping off any top-level temporary binding. Deferring the completion of the return type exposed a bug in overload resolution where completion of the argument types was not attempted, which is also fixed by this change. llvm-svn: 151117
* Add a bunch of missing calls to DiagnoseSentinelCalls. ↵Eli Friedman2012-02-181-0/+4
| | | | | | | | <rdar://problem/10885993>. This should probably be refactored... but it isn't completely obvious what refactoring is best. llvm-svn: 150869
* When overload resolution picks an implicitly-deleted special memberDouglas Gregor2012-02-151-5/+18
| | | | | | | | | function, provide a specialized diagnostic that indicates the kind of special member function (default constructor, copy assignment operator, etc.) and that it was implicitly deleted. Add a hook where we can provide more detailed information later. llvm-svn: 150611
* Fix parsing new expressions using init lists. Probably still do the wrong ↵Sebastian Redl2012-02-111-4/+82
| | | | | | | | thing in cases involving array new. Show that many cases using initializer list constructors work, in that they parse and pass semantic analysis. llvm-svn: 150316
* Implement the conversion to a function pointer for lambda expressions,Douglas Gregor2012-02-101-3/+5
| | | | | | per C++ [expr.prim.lambda]p6. llvm-svn: 150236
* [libclang] For CXXOperatorCallExprs, give a valid source location to the ↵Argyrios Kyrtzidis2012-02-081-7/+12
| | | | | | | | | | DeclRefExpr that is referencing the member function, so we can index the referenced function. Fixes rdar://10762375&10324915 & http://llvm.org/PR11192 llvm-svn: 150033
* Revise the SplitQualType interface to make it its own thing instead ofJohn McCall2012-02-081-1/+1
| | | | | | | | | | | | | | a typedef of std::pair. This slightly improves type-safety, but mostly makes code using it clearer to read as well as making it possible to add methods to the type. Add such a method for efficiently single-step desugaring a split type. Add a method to single-step desugaring a locally-unqualified type. Implement both the SplitQualType and QualType methods in terms of that. Also, fix a typo ("ObjCGLifetime"). llvm-svn: 150028
* Fixed instantiation of DependentScopeDeclRefExpr.Abramo Bagnara2012-02-061-2/+2
| | | | llvm-svn: 149868
* In C++11 mode, when an integral constant expression is desired and we have aRichard Smith2012-02-041-6/+9
| | | | | | | | | | | | | | | | | | value of class type, look for a unique conversion operator converting to integral or unscoped enumeration type and use that. Implements [expr.const]p5. Sema::VerifyIntegerConstantExpression now performs the conversion and returns the converted result. Some important callers of Expr::isIntegralConstantExpr have been switched over to using it (including all of those required for C++11 conformance); this switch brings a side-benefit of improved diagnostics and, in several cases, simpler code. However, some language extensions and attributes have not been moved across and will not perform implicit conversions on constant expressions of literal class type where an ICE is required. In passing, fix static_assert to perform a contextual conversion to bool on its argument. llvm-svn: 149776
* Don't allow a value of a scoped enumeration to be used as the first bound for anRichard Smith2012-02-041-6/+19
| | | | | | | array new expression. This lays some groundwork for the implicit conversion to integral or unscoped enumeration which C++11 ICEs undergo. llvm-svn: 149772
* Initialize the user defined conversion function to null if this is an ↵Benjamin Kramer2012-02-021-0/+1
| | | | | | | | aggregate initialization from an initializer list. Found by valgrind. llvm-svn: 149627
* Split Sema::MarkDeclarationReferenced into multiple functions; the ↵Eli Friedman2012-02-021-11/+11
| | | | | | additional entry points are needed to implement C++11 odr-use marking correctly. No functional change in this patch; I'll actually make the change which fixes the odr-use marking in a followup patch. llvm-svn: 149586
* constexpr: disallow signed integer overflow in integral conversions in constantRichard Smith2012-01-301-4/+14
| | | | | | expressions in C++11. llvm-svn: 149286
* Added source location for the template keyword in AST template-id expressions.Abramo Bagnara2012-01-271-3/+8
| | | | llvm-svn: 149127
* Slight refactoring; catch yet another case where we were missing an ↵Eli Friedman2012-01-261-2/+9
| | | | | | lvalue-to-rvalue conversion. llvm-svn: 149003
* Allow typo correction to be disabled in BuildOverloadedCallExpr variant.Kaelyn Uhrain2012-01-251-5/+27
| | | | | | | This suppresses typo correction for auto-generated call expressions such as to 'begin' or 'end' within a C++0x for-range statement. llvm-svn: 148979
* Add custom callback object for typo correction in BuildRecoveryCallExpr.Kaelyn Uhrain2012-01-251-3/+49
| | | | | | | | | The new callback, in addition to limiting which keywords to include in the pool of typo correction candidates, also filters out non-keyword candidates that don't refer to (template) functions that accept the number of arguments that are present for the call being recovered. llvm-svn: 148962
* Minor fixups for auto deduction of initializer lists.Sebastian Redl2012-01-231-1/+1
| | | | | | | | Fix some review comments. Add a test for deduction when std::initializer_list isn't available yet. Fix redundant error messages. This fixes and outstanding FIXME too. llvm-svn: 148735
* constexpr: converted constant expression handling for enumerator values, caseRichard Smith2012-01-181-2/+164
| | | | | | | | | | values and non-type template arguments of integral and enumeration types. This change causes some legal C++98 code to no longer compile in C++11 mode, by enforcing the C++11 rule that narrowing integral conversions are not permitted in the final implicit conversion sequence for the above cases. llvm-svn: 148439
* Convert DiagnoseEmptyLookup to use correction callbacks.Kaelyn Uhrain2012-01-181-1/+4
| | | | | | | | | | | | No new unit tests yet as there is no behavioral change (except for slightly more specific filtering in Sema::ActOnStartOfLambdaDefinition). Tests will be added as the code paths are traced in greater depth to determine how to improve the results--there are at least one or two known bugs that require those improvements. This commit lays the groundwork for those changes. llvm-svn: 148382
* Move narrowing conversion detection code from SemaInit to SemaOverload, readyRichard Smith2012-01-181-0/+157
| | | | | | | | | | | | | for it to be used in converted constant expression checking, and fix a couple of issues: - Conversion operators implicitly invoked prior to the narrowing conversion were not being correctly handled when determining whether a constant value was narrowed. - For conversions from floating-point to integral types, the diagnostic text incorrectly always claimed that the source expression was not a constant expression. llvm-svn: 148381
* Basic overloading support for std::initializer_list.Sebastian Redl2012-01-171-3/+29
| | | | llvm-svn: 148350
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-9/+6
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Use a smaller vector than SmallVector.Benjamin Kramer2012-01-141-3/+2
| | | | | | Shrinks OverloadCandidate from 208 to 168 bytes. llvm-svn: 148204
* Clear ImplicitConversionSequence the obvious way which turns out to be less ↵Benjamin Kramer2012-01-141-4/+3
| | | | | | fragile. llvm-svn: 148200
* Give OverloadCandidateSet the responsibility for destroying the implicit ↵Benjamin Kramer2012-01-141-1/+5
| | | | | | conversion sequences so we don't get double frees when the vector reallocates. llvm-svn: 148198
OpenPOWER on IntegriCloud