summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Always add the built-in overload candidates for operators &&, ||, andDouglas Gregor2011-10-101-1/+5
| | | | | | !. Fixes PR9865. llvm-svn: 141537
* Added a flag to identify resolved overloaded function references.Abramo Bagnara2011-10-051-36/+73
| | | | llvm-svn: 141171
* Don't allow an rvalue reference to bind to the result of a calling aDouglas Gregor2011-10-041-0/+23
| | | | | | | | | conversion function whose result type is an lvalue reference. The initialization code already handled this properly, but overload resolution was allowing the binding. Fixes PR11003 / <rdar://problem/10233078>. llvm-svn: 141137
* CUDA: diagnose invalid calls across targetsPeter Collingbourne2011-10-021-0/+32
| | | | llvm-svn: 140978
* objc arc: Diagnose block pointer type mismatch whenFariborz Jahanian2011-09-281-16/+4
| | | | | | | | some arguments types are ns_consumed and some otherwise matching types are not. This is objc side of // rdar://10187884 llvm-svn: 140729
* objc++ arc: Diagnose block pointer type mismatch whenFariborz Jahanian2011-09-281-0/+17
| | | | | | | | some arguments types are ns_consumed and some otherwise matching types are not. This fixes the objc++ side only *auch*. // rdar://10187884 llvm-svn: 140717
* Only print _Bool as 'bool' when 'bool' is defined as an object-likeDouglas Gregor2011-09-271-1/+1
| | | | | | macro whose only replacement token is '_Bool'. llvm-svn: 140656
* When 'bool' is not a built-in type but is defined as a macro, printDouglas Gregor2011-09-271-1/+1
| | | | | | | 'bool' rather than '_Bool' within types, to make things a bit more readable. Fixes <rdar://problem/10063263>. llvm-svn: 140650
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-2/+3
| | | | llvm-svn: 140478
* Add a special note for overload resolution when an initializer list argumentSebastian Redl2011-09-241-0/+11
| | | | | | | | | cannot be converted. This is in preparation for overload resolution of initializer lists. Currently, you will always get this message when you try to pass an init list to an overloaded function. llvm-svn: 140461
* Give InitListChecker a verification-only mode, where it neither emits ↵Sebastian Redl2011-09-241-15/+19
| | | | | | | | | | | diagnostics nor builds a semantic (structured) initializer list, just reports on whether it can match the given list to the target type. Use this mode for doing init list checking in the initial step of initialization, which will eventually allow us to do overload resolution based on the outcome. llvm-svn: 140457
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-2/+0
| | | | llvm-svn: 140407
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-6/+7
| | | | llvm-svn: 140367
* Enforce access control for conversion operators used in contextualJohn McCall2011-09-211-5/+4
| | | | | | conversions (rather than just call-arguments). llvm-svn: 140244
* In Microsoft mode(-fms-compatibility), prefer an integral conversion to a ↵Francois Pichet2011-09-181-0/+19
| | | | | | | | | | | | | | | | floating-to-integral conversion if the integral conversion is between types of the same size. For example: void f(float); void f(int); int main { long a; f(a); } Here, MSVC will call f(int) instead of generating a compile error as clang will do in standard mode. This fixes a few errors when parsing MFC code with clang. llvm-svn: 140007
* Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear ↵Francois Pichet2011-09-171-3/+3
| | | | | | | | that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag. Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag. llvm-svn: 139987
* Silence "end of non-void function" warnings with llvm_unreachable and add an ↵Benjamin Kramer2011-09-101-2/+5
| | | | | | assert. llvm-svn: 139474
* Fix a -Wreturn-type warning due to this field not explicitly having theChandler Carruth2011-09-101-1/+1
| | | | | | enumeration type. llvm-svn: 139445
* Add smarter sorting of overload candidates that failed template deduction.Kaelyn Uhrain2011-09-091-0/+37
| | | | llvm-svn: 139417
* Contextually converting to 'id' is not a useful operation. ContextuallyJohn McCall2011-09-091-14/+46
| | | | | | | | | | | | converting to an arbitrary Objective-C pointer type is. Without significantly re-implementing anything, change the API to reflect this, and as a minor optimization, strip the pointer conversion off before potentially building it. Mostly, this removes a really bizarre-looking bit of code from BuildInstanceMessage. llvm-svn: 139354
* Give conversions of block pointers to ObjC pointers a different cast kindJohn McCall2011-09-091-6/+13
| | | | | | | | than conversions of C pointers to ObjC pointers. In order to ensure that we've caught every case, add asserts to CastExpr that strictly determine which cast kind is used for which kind of bit cast. llvm-svn: 139352
* In Microsoft mode, if we are inside a template class member function and we ↵Francois Pichet2011-09-071-1/+14
| | | | | | | | can't resolve a function call then create a type-dependent CallExpr even if the function has no type dependent arguments. The goal is to postpone name lookup to instantiation time to be able to search into type dependent base classes. With this patch in, clang will generate only 37 errors (down from 212) when parsing a typical MFC source file. llvm-svn: 139210
* Be sure to emit lvalue-to-rvalue casts for loads from x-values.John McCall2011-08-301-4/+4
| | | | | | | Doing this happens to disrupt the pattern that ARC was looking for for move optimizations, so we need to fix that simultaneously. llvm-svn: 138789
* Make sure we don't crash printing builtin candidates for overloads of ↵Eli Friedman2011-08-261-4/+5
| | | | | | deleted operators. Fixes PR10757. llvm-svn: 138645
* Teach reference initialization from the result of a user-definedDouglas Gregor2011-08-151-5/+5
| | | | | | | conversion to initialize the standard conversion *after* the user-defined conversion properly. Fixes PR10644. llvm-svn: 137608
* Have the typo correction in DiagnoseEmptyLookup properly handle templateKaelyn Uhrain2011-08-051-1/+1
| | | | | | functions when performing function overload resolution. llvm-svn: 136948
* Improve overloaded function handling in the typo correction code.Kaelyn Uhrain2011-08-031-1/+2
| | | | | | | | Change TypoCorrection to store a set of NamedDecls instead of a single NamedDecl. Also add initial support for performing function overload resolution to Sema::DiagnoseEmptyLookup. llvm-svn: 136807
* Refactor the */& mismatch fixit generation out of SemaOverload and provide a ↵Anna Zaks2011-07-281-113/+16
| | | | | | simple conversion checking function. llvm-svn: 136376
* Tests for explicit conversion operators, along with a fix to avoidDouglas Gregor2011-07-231-12/+15
| | | | | | | | | | considering explicit conversion operators when determining surrogate functions. Fixes PR10453. Note that there are a few test cases where Clang is still wrong because it does not implement DR899; see PR10456. Patch by Jonathan Sauer! llvm-svn: 135857
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-10/+10
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* kill a FIXME in IsIntegralPromotionDavid Majnemer2011-07-221-4/+1
| | | | | | | | IsIntegralPromotion should consider the signedness of FromType when calculating promotions. This, as of now, cannot be exercised on any platform so there is no corresponding test. llvm-svn: 135803
* Addressing code review comments for commit 135509 - Add FixItHints in case a ↵Anna Zaks2011-07-211-8/+32
| | | | | | C++ function call is missing * or & operators on llvm-svn: 135643
* arc-objc++: Issue an arc specific diagnostic when overload resolutionFariborz Jahanian2011-07-201-1/+14
| | | | | | | fails because of lifetime differences of parameter and argument type. // rdar://9790531 llvm-svn: 135593
* Add FixItHints in case a C++ function call is missing * or & operators on ↵Anna Zaks2011-07-191-6/+125
| | | | | | one/several of it's parameters (addresses http://llvm.org/PR5941). llvm-svn: 135509
* Store bracket locations for array subscript expressions, from Erik Verbruggen!Douglas Gregor2011-07-151-3/+8
| | | | llvm-svn: 135275
* PR8800: When building a conversion to A& using a member operatorA&(), do not ↵Richard Smith2011-07-131-4/+4
| | | | | | require A to be a complete type. llvm-svn: 135101
* Fix missing braces around two statements that were intended to be partChandler Carruth2011-06-271-1/+2
| | | | | | | | | | | of a single if block. This is really annoying to track down and test. Silly changes to the test case caused it to stop showing up. I wish there were a more concrete way of asserting that a note attaches to the intended diagnostic. This fixes PR10195. llvm-svn: 133907
* Fix PR10187: when diagnosing a two-phase-lookup-related failure, don't ↵Richard Smith2011-06-261-8/+12
| | | | | | assert that any names we find are valid candidates for the call. llvm-svn: 133898
* Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about ↵Argyrios Kyrtzidis2011-06-241-1/+1
| | | | | | | | 'ownership', not 'lifetime'. rdar://9477613. llvm-svn: 133779
* Allow unavailable function calls inside unavailable functions in C++/ObjC++ ↵Argyrios Kyrtzidis2011-06-231-2/+13
| | | | | | as well. rdar://9660196 llvm-svn: 133672
* Accept no-return stripping conversions for pointer type arguments afterChandler Carruth2011-06-181-6/+6
| | | | | | | | | | | | | | | | | | | deducing template parameter types. Recently Clang began enforcing the more strict checking that the argument type and the deduced function parameter type (after substitution) match, but that only consideres qualification conversions. One problem with this patch is that we check noreturn conversions and qualification conversions independently. If a valid conversion would require *both*, perhaps interleaved with each other, it will be rejected. If this actually occurs (I'm not yet sure it does) and is in fact a problem (I'm not yet sure it is), there is a FIXME to implement more intelligent conversion checking. However, this step at least allows Clang to resume accepting valid code we're seeing in the wild. llvm-svn: 133327
* Automatic Reference Counting.John McCall2011-06-151-54/+244
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Fix a regression in the two-phase lookup diagnostics that switching theChandler Carruth2011-06-081-0/+3
| | | | | | | | namespace set algorithm (re-)introduced. We may not have seen the 'std' namespace, but we should still suggested associated namespaces. Easy fix, but a bit annoying to test. llvm-svn: 132744
* Richard Smith was correct about how the sets should be computed forChandler Carruth2011-06-051-11/+8
| | | | | | | | | this. My suggestion assumed a viable erase method for iterators on SmallPtrSet. This patch restores his original pattern. llvm-svn: 132673
* Fix PR10053: Improve diagnostics and error recovery for code which some ↵Richard Smith2011-06-051-8/+140
| | | | | | compilers incorrectly accept due to a lack of proper support for two-phase name lookup. llvm-svn: 132672
* Identity and non-identity standard conversion sequences can beDouglas Gregor2011-06-051-6/+4
| | | | | | | | | compared even when one is a reference binding and the other is not (<rdar://problem/9173984>), but the definition of an identity sequence does not involve lvalue-to-rvalue adjustments (PR9507). Fix both inter-related issues. llvm-svn: 132660
* Update our diagnostics to properly account for move operations.Alexis Hunt2011-05-251-2/+14
| | | | llvm-svn: 132096
* Audit and finish the implementation of C++0x nullptr, fixing twoDouglas Gregor2011-05-211-2/+21
| | | | | | | | | | | | | | minor issues along the way: - Non-type template parameters of type 'std::nullptr_t' were not permitted. - We didn't properly introduce built-in operators for nullptr ==, !=, <, <=, >=, or > as candidate functions . To my knowledge, there's only one (minor but annoying) part of nullptr that hasn't been implemented: catching a thrown 'nullptr' as a pointer or pointer-to-member, per C++0x [except.handle]p4. llvm-svn: 131813
* Allow implicit conversion from function pointer to void* in Microsoft mode. Francois Pichet2011-05-081-0/+9
| | | | | | Necessary to parse MFC code. llvm-svn: 131076
* Relax the conversion rules for Objective-C GC qualifiers aDouglas Gregor2011-05-081-0/+7
| | | | | | | | | | | | | | | | | | | | | | bit by allowing __weak and __strong to be added/dropped as part of implicit conversions (qualification conversions in C++). A little history: GCC lets one add/remove/change GC qualifiers just about anywhere, implicitly. Clang did roughly the same before, but we recently normalized the semantics of qualifiers across the board to get a semantics that we could reason about (yay). Unfortunately, this tightened the screws a bit too much for GC qualifiers, where it's common to add/remove these qualifiers at will. Overall, we're still in better shape than we were before: we don't permit directly changing the GC qualifier (e.g., __weak -> __strong), so type safety is improved. More importantly, we're internally consistent in our handling of qualifiers, and the logic that allows adding/removing GC qualifiers (but not adding/removing address spaces!) only touches two obvious places. Fixes <rdar://problem/9402499>. llvm-svn: 131065
OpenPOWER on IntegriCloud