summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Remember the "found declaration" for an overload candidate, which is theJohn McCall2010-03-191-92/+94
| | | | | | | | | | | | | | | | entity (if applicable) which was actually looked up. If a candidate was found via a using declaration, this is the UsingShadowDecl; otherwise, if the candidate is template specialization, this is the template; otherwise, this is the function. The point of this exercise is that "found declarations" are the entities we do access control for, not their underlying declarations. Broadly speaking, this patch fixes access control for using declarations. There is a *lot* of redundant code calling into the overload-resolution APIs; we really ought to clean that up. llvm-svn: 98945
* Perform access control for the implicit base and member destructor callsJohn McCall2010-03-161-7/+10
| | | | | | required when emitting a destructor definition. llvm-svn: 98609
* objective-c++ must take into account qualifiers when Fariborz Jahanian2010-03-151-0/+6
| | | | | | considering valid objc pointer converions. llvm-svn: 98557
* Reinstate r97674 with a fix for the assertion that was firing in <list>Douglas Gregor2010-03-031-18/+23
| | | | llvm-svn: 97686
* Revert r97674; it's causing failuresDouglas Gregor2010-03-031-21/+16
| | | | llvm-svn: 97677
* Implement disambiguation of base class members via aDouglas Gregor2010-03-031-16/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | nested-name-specifier. For example, this allows member access in diamond-shaped hierarchies like: struct Base { void Foo(); int Member; }; struct D1 : public Base {}; struct D2 : public Base {}; struct Derived : public D1, public D2 { } void Test(Derived d) { d.Member = 17; // error: ambiguous cast from Derived to Base d.D1::Member = 17; // error: okay, modify D1's Base's Member } Fixes PR5820 and <rdar://problem/7535045>. Also, eliminate some redundancy between Sema::PerformObjectMemberConversion() and Sema::PerformObjectArgumentInitialization() -- the latter now calls the former. llvm-svn: 97674
* Warn about the deprecated string literal -> char* conversion. Fixes PR6428.Douglas Gregor2010-02-281-5/+5
| | | | llvm-svn: 97404
* Allow us to compare derived-to-base conversions between a referenceDouglas Gregor2010-02-251-27/+8
| | | | | | | binding and a copy-construction. Fixes an overloading problem in the Clang-on-Clang build. llvm-svn: 97161
* When comparing two method overload candidates during overload diagnostics,John McCall2010-02-251-1/+2
| | | | | | | | | | | skip the object argument conversion if either of the candidates didn't initialize it. Fixes PR6421, which is such a very straightforward extension of PR6398 that I should have worked it into the last test case (and therefore caught it then). Ah well. llvm-svn: 97135
* Add a new conversion rank to classify conversions between complex and scalarChandler Carruth2010-02-251-10/+10
| | | | | | | | types. Rank these conversions below other conversions. This allows overload resolution when the only distinction is between a complex and scalar type. It also brings the complex overload resolutin in line with GCC's. llvm-svn: 97128
* Catch more uses of uninitialized implicit conversion sequences.John McCall2010-02-251-20/+24
| | | | | | | When diagnosing bad conversions, skip the conversion for ignored object arguments. Fixes PR 6398. llvm-svn: 97090
* Do not require a complete type when checking for a pointer conversionDouglas Gregor2010-02-221-0/+1
| | | | | | between cv1 T* and cv2 T*. llvm-svn: 96787
* A constructor template cannot be used to copy to an object of the same class ↵Douglas Gregor2010-02-211-1/+2
| | | | | | type (per C++ [class.copy]p3). Make sure that includes copies that involve a derived-to-base conversion. Fixes PR6141. llvm-svn: 96742
* Improve access control diagnostics. Perform access control on member-pointerJohn McCall2010-02-101-10/+6
| | | | | | | conversions. Fix an access-control bug where privileges were not considered at intermediate points along the inheritance path. Prepare for friends. llvm-svn: 95775
* Thread a source location into the template-argument deduction routines. ThereJohn McCall2010-02-081-28/+41
| | | | | | | may be some other places that could take advantage of this new information, but I haven't really looked yet. llvm-svn: 95600
* When adding ADL candidates for overloadedDouglas Gregor2010-02-051-1/+1
| | | | | | | post-increment/post-decrement operators, be sure to consider both arguments. Fixes PR6237. llvm-svn: 95361
* Extract a common structure for holding information about the definitionJohn McCall2010-02-041-0/+3
| | | | | | | | of a C++ record. Exposed a lot of problems where various routines were silently doing The Wrong Thing (or The Acceptable Thing in The Wrong Order) when presented with a non-definition. Also cuts down on memory usage. llvm-svn: 95330
* Top-level const changes do not make a qualification conversion. Fixes PR6089.Sebastian Redl2010-02-031-1/+1
| | | | llvm-svn: 95239
* Implement promotion for enumeration types.Douglas Gregor2010-02-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | WHAT!?! It turns out that Type::isPromotableIntegerType() was not considering enumeration types to be promotable, so we would never do the promotion despite having properly computed the promotion type when the enum was defined. Various operations on values of enum type just "worked" because we could still compute the integer rank of an enum type; the oddity, however, is that operations such as "add an enum and an unsigned" would often have an enum result type (!). The bug actually showed up as a spurious -Wformat diagnostic (<rdar://problem/7595366>), but in theory it could cause miscompiles. In this commit: - Enum types with a promotion type of "int" or "unsigned int" are promotable. - Tweaked the computation of promotable types for enums - For all of the ABIs, treat enum types the same way as their underlying types (*not* their promotion types) for argument passing and return values - Extend the ABI tester with support for enumeration types llvm-svn: 95117
* Extract a common base class between UnresolvedLookupExpr andJohn McCall2010-02-021-69/+24
| | | | | | UnresolvedMemberExpr and employ it in a few places where it's useful. llvm-svn: 95072
* Improve the diagnostic used when an incompatible overload set is passedJohn McCall2010-02-021-0/+18
| | | | | | as an argument during overload resolution. llvm-svn: 95057
* Note that an overload candidate was non-viable because template argumentJohn McCall2010-02-011-4/+58
| | | | | | | deduction failed. Right now there's a very vague diagnostic for most cases and a good diagnostic for incomplete deduction. llvm-svn: 94988
* And yet another call.Anders Carlsson2010-01-291-2/+8
| | | | llvm-svn: 94824
* Another PerformCopyInitialization call bites the dust.Anders Carlsson2010-01-291-4/+12
| | | | llvm-svn: 94823
* Access control for surrogate function calls. Required a moderately gross hackJohn McCall2010-01-281-3/+3
| | | | | | to get the access bits set properly in conversion sets. llvm-svn: 94744
* Access control for overloaded call operators. Not for surrogates yet,John McCall2010-01-281-0/+5
| | | | | | | | mostly because we're going to want a better diagnostic for conversions. Also this API needs to go back to sanity. llvm-svn: 94730
* Access checking for overloaded operators.John McCall2010-01-281-5/+6
| | | | llvm-svn: 94725
* Fix a major oversight in the comparison of standard conversionDouglas Gregor2010-01-271-29/+56
| | | | | | | | | | | | | | sequences, where we would occasionally determine (incorrectly) that one standard conversion sequence was a proper subset of another when, in fact, they contained completely incomparable conversions. This change records the types in each step within a standard conversion sequence, so that we can check the specific comparison types to determine when one sequence is a proper subset of the other. Fixes this testcase (thanks, Anders!), which was distilled from PR6095 (also thanks to Anders). llvm-svn: 94660
* Implement access control for overloaded functions. Suppress access controlJohn McCall2010-01-271-27/+57
| | | | | | | diagnostics in "early" lookups, such as during typename checks and when building unresolved lookup expressions. llvm-svn: 94647
* Avoid some unnecessary copying of unresolved lookup results.John McCall2010-01-261-16/+12
| | | | llvm-svn: 94531
* Handle redeclarations found by ADL deterministically and reasonably.John McCall2010-01-261-6/+5
| | | | | | | | | This solution relies on an O(n) scan of redeclarations, which means it might scale poorly in crazy cases with tons of redeclarations brought in by a ton of distinct associated namespaces. I believe that avoiding this is not worth the common-case cost. llvm-svn: 94530
* Allow ADL to find functions imported by using decls. Leave wordy commentJohn McCall2010-01-261-2/+7
| | | | | | about interaction between ADL and default arguments. Shrug shoulders, commit. llvm-svn: 94524
* Preserve access bits through overload resolution much better. SomeJohn McCall2010-01-261-52/+45
| | | | | | general refactoring in operator resolution. llvm-svn: 94498
* Pass access specifiers around in overload resolution.John McCall2010-01-261-31/+53
| | | | llvm-svn: 94485
* Produce a special diagnostic when users call a function with an argument ofJohn McCall2010-01-231-1/+16
| | | | | | | | | | | | | | | | incomplete type (or a pointer/reference to such). The causes of this problem are different enough to justify a different "design" for the diagnostic. Most notably, it doesn't give an operand index: it's usually pretty obvious which operand is the problem, it adds a lot of clutter to mention it, and the fix is usually in a different part of the file anyway. This is yet another diagnostic that should really have an analogue in the non-overloaded case --- which should be much easier to write because of the weaker space constraints. llvm-svn: 94303
* During overload resolution diagnostics, sort non-viable candidates by the ↵John McCall2010-01-231-4/+112
| | | | | | | | | | | | | quality of their conversions. To make this work, fill out all conversions for all candidates (but only when diagnosing overload failure). Split out a few cases from ovl_fail_bad_conversion which didn't actually involve a failed argument conversion. I'm pretty sure this is not a well-founded ordering, but I'm not sure it matters. llvm-svn: 94283
* Use raw_ostream instead of cstdio.Daniel Dunbar2010-01-221-19/+21
| | | | llvm-svn: 94136
* Fixes comments.Fariborz Jahanian2010-01-211-2/+2
| | | | llvm-svn: 94053
* Also allow cast of block pointer type toFariborz Jahanian2010-01-211-0/+7
| | | | | | | pointer to an any object. Another variation of radar 7562285. llvm-svn: 94052
* In objective-c++ land, a block pointer is another object pointer.Fariborz Jahanian2010-01-201-1/+9
| | | | | | | So, casting a generic object pointer ('id' or 'Class') to the block pointer is allowed. Fixes radar 7562285. llvm-svn: 94045
* Give UnresolvedSet the ability to store access specifiers for each declaration.John McCall2010-01-201-8/+8
| | | | | | | Change LookupResult to use UnresolvedSet. Also extract UnresolvedSet into its own header and make it templated over an inline capacity. llvm-svn: 93959
* Allow conversion of pointer to an objective-c pointer toFariborz Jahanian2010-01-181-1/+11
| | | | | | a similar pointer. Fixes radar 7552179. llvm-svn: 93803
* Fix a use of uninitialized memory in overload diagnostics.John McCall2010-01-161-1/+4
| | | | llvm-svn: 93629
* Candidates with arity mismatches are extra-special non-viable and need toJohn McCall2010-01-151-16/+32
| | | | | | | | stand at the back of the line. Thanks to Oliver Hunt for reminding me to do this. llvm-svn: 93583
* Improve overload diagnostics some more by calling out qualifier mismatchesJohn McCall2010-01-141-3/+55
| | | | | | | for special diagnostics. Unfortunately, the non-overload diagnostics are not this good. llvm-svn: 93420
* Improve the diagnostic for bad conversions in overload resolution to talkJohn McCall2010-01-141-1/+1
| | | | | | about 'object argument' vs. 'nth argument'. llvm-svn: 93395
* Don't report ambiguities in the user-defined conversion if we weren't supposedJohn McCall2010-01-131-1/+1
| | | | | | | | | | | | to be considering user-defined conversions in the first place. Doug, please review; I'm not sure what we should be doing if we see a real ambiguity in selecting a copy constructor when otherwise suppressing user-defined conversions. Fixes PR6014. llvm-svn: 93365
* Record some basic information about bad conversion sequences. Use thatJohn McCall2010-01-131-60/+89
| | | | | | | information to feed diagnostics instead of regenerating it. Much room for improvement here, but fixes some unfortunate problems reporting on method calls. llvm-svn: 93316
* Improve the reporting of non-viable overload candidates by noting the reasonJohn McCall2010-01-131-44/+107
| | | | | | | | why the candidate is non-viable. There's a lot we can do to improve this, but it's a good start. Further improvements should probably be integrated with the bad-initialization reporting routines. llvm-svn: 93277
* So I was sitting around, trying vainly to think of something to commit, and thenJohn McCall2010-01-121-21/+22
| | | | | | | | I said to myself, self, why don't you go add a couple of parameters to a method and then fail to use them, and I thought that sounded like a pretty good idea, so I did it. llvm-svn: 93233
OpenPOWER on IntegriCloud