summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* When replacing a template-id expression with a declaration reference ↵Douglas Gregor2009-10-221-3/+12
| | | | | | expression after overloading completes, make sure to keep the qualifier. Still not ready with that test-case... llvm-svn: 84880
* Don't (directly) call RequireCompleteType with an invalid source location.Douglas Gregor2009-10-211-8/+13
| | | | llvm-svn: 84793
* Don't generate pointer types for void or base classes when findingDouglas Gregor2009-10-211-27/+11
| | | | | | | conversion types for builtin overloaded operator candidates; I misread this section in the standard the first time around. llvm-svn: 84788
* Change FixOverloadedFunctionReference to return a (possibly new) expression. ↵Anders Carlsson2009-10-211-11/+19
| | | | | | Substitute TemplateIdRefExprs with DeclRefExprs. Doug, plz review :) llvm-svn: 84763
* Improve diagnostics and template instantiation behavior when callingDouglas Gregor2009-10-211-24/+26
| | | | | | an overloaded function call operator. llvm-svn: 84745
* Change ResolveAddressOfOverloadedFunction to support TemplateIdRefExpr. No ↵Anders Carlsson2009-10-201-4/+17
| | | | | | testcase yet because FixOverloadedFunctionReference needs to be updated too. Doug, plz review. llvm-svn: 84693
* Moved comment to its proper place in my last patch.Fariborz Jahanian2009-10-201-3/+3
| | | | llvm-svn: 84662
* Patch implements ranking conversions between member pointers [over.ics.rank]Fariborz Jahanian2009-10-201-7/+36
| | | | llvm-svn: 84660
* Remove default argument for ImpCastExprToType. Add appropriate argument Eli Friedman2009-10-201-1/+1
| | | | | | | | | | | | | to all callers. Switch a few other users of CK_Unknown to proper cast kinds. Note that there are still some situations where we end up with CK_Unknown; they're pretty easy to find with grep. There are still a few missing conversion kinds, specifically pointer/int/float->bool and the various combinations of real/complex float/int->real/complex float/int. llvm-svn: 84623
* Builtin candidate minimization forFariborz Jahanian2009-10-201-6/+7
| | | | | | <<=, >>= and the rest. llvm-svn: 84568
* Add the built-in candidate set reduction hueristicFariborz Jahanian2009-10-191-8/+11
| | | | | | | to '+=', '-=', '*=' and '/=' builtin operators and fixes a logic bug exposed by doing this. llvm-svn: 84538
* Copy conversion of an expression to its base classFariborz Jahanian2009-10-191-0/+12
| | | | | | | is a standard convesion and not a user-defined conversion. llvm-svn: 84525
* When resolving the address of an overloaded function or function template, ↵Sebastian Redl2009-10-171-11/+20
| | | | | | | | mark the result as referenced. The most important effect of this is that function templates only referenced by address expressions now get instantiated. This, in turn, means that Hello World compiles with the Apache stdcxx library even when using endl. llvm-svn: 84363
* Don't add implicit casts of explicit address-taking of overloaded functions.Sebastian Redl2009-10-171-3/+7
| | | | | | Taking the address of an overloaded function with an explicit address-of operator wrapped the operator in an implicit cast that added yet another pointer level, leaving us with a corrupted AST, which crashed CodeGen in the test case I've added. Fix this by making FixOverloadedFunctionReference return whether there was an address-of operator and not adding the implicit cast in that case. llvm-svn: 84362
* Patch to clean up and improve visual display ofFariborz Jahanian2009-10-161-7/+14
| | | | | | builtin function ambiguity. llvm-svn: 84289
* Use VisibleQuals to control setting of Volatile/Restrict qualifiers onFariborz Jahanian2009-10-161-7/+15
| | | | | | | candidate types in BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants further trimming the overload candidate set. llvm-svn: 84281
* Apply heuristics to cut back on number of candidateFariborz Jahanian2009-10-151-16/+95
| | | | | | | | | | sets of builtin operators. Currently, it is applied to '++' and '->*' operators. I need to apply it to others as well. Also, heuristics need be applied to BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants. This is WIP. llvm-svn: 84187
* Implement support for overloaded operator uses that result to a callDouglas Gregor2009-10-141-4/+15
| | | | | | | | to a member operator template. We missed updating this call site when adding support for function templates; bug exposed by a test for PR5072. llvm-svn: 84111
* Check the return type of binary operators and the arrow operator.Anders Carlsson2009-10-131-7/+20
| | | | llvm-svn: 84043
* More return type checking.Anders Carlsson2009-10-131-0/+4
| | | | llvm-svn: 84034
* Diagnose invalid return types for unary operators.Anders Carlsson2009-10-131-6/+10
| | | | llvm-svn: 84030
* Handle built-in unary operators when reporting ambiguities.Fariborz Jahanian2009-10-121-12/+17
| | | | | | wip - To prune excessive reporting. llvm-svn: 83889
* If built-in operators could not be selected because of ambiguity inFariborz Jahanian2009-10-121-2/+31
| | | | | | | | | | | | | | | | | | user-defined type conversions, issue list of ambiguites in addition to the diagnostic. So, clang now issues the following: b.cpp:19:19: error: left hand operand to ->* must be a pointer to class compatible with the right hand operand, but is 'struct C1' int i = c1->*pmf; ~~^ b.cpp:19:19: note: because of ambiguity in conversion of 'struct C1' to 'struct E *' b.cpp:5:5: note: candidate function operator E*(); ^ b.cpp:11:5: note: candidate function operator E*(); ^ llvm-svn: 83862
* Check that the return type is complete when calling a member function.Anders Carlsson2009-10-101-0/+5
| | | | llvm-svn: 83694
* Add CheckCallReturnType and start using it for regular call expressions. ↵Anders Carlsson2009-10-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This will improve error messages. For struct B; B f(); void g() { f(); } We now get t.cpp:6:3: error: calling 'f' with incomplete return type 'struct B' f(); ^~~ t.cpp:3:3: note: 'f' declared here B f(); ^ t.cpp:1:8: note: forward declaration of 'struct B' struct B; ^ llvm-svn: 83692
* Add some FIXMEsDouglas Gregor2009-10-091-0/+2
| | | | llvm-svn: 83685
* Refactor the LookupResult API to simplify most common operations. Require ↵John McCall2009-10-091-4/+5
| | | | | | | | | users to pass a LookupResult reference to lookup routines. Call out uses which assume a single result. llvm-svn: 83674
* Produce good looking diagnostics on ambiguous built-in operators.Fariborz Jahanian2009-10-091-8/+6
| | | | | | | | | | | | | | Now we produce things like: bug1.cpp:21:11: error: use of overloaded operator '->*' is ambiguous int i = c->*pmf; // expected-error {{use of overloaded operator '->*' is ambiguous}} \ ~^ ~~~ bug1.cpp:21:11: note: built-in candidate operator ->* ('struct A volatile *', 'int const struct A::*') bug1.cpp:21:11: note: built-in candidate operator ->* ('struct A volatile *', 'int restrict struct A::*') ... Still need to look at an issue (indicated as FIXME in the test case). llvm-svn: 83650
* Use the new API for applying the qualifiers on built-in '->*' Fariborz Jahanian2009-10-091-5/+3
| | | | | | operator's types. llvm-svn: 83648
* Improve on reporting ambiguity involving built-in candidates.Fariborz Jahanian2009-10-091-10/+9
| | | | | | I still don't like it but it is improvement over what we had. llvm-svn: 83603
* Handle MemberExprs in ResolveAddressOfOverloadedFunction.Anders Carlsson2009-10-071-0/+3
| | | | llvm-svn: 83495
* When building candidate set for built-ins; when looking forFariborz Jahanian2009-10-071-2/+1
| | | | | | | convesion functions, look in base classes to. (Removes a FIXME). llvm-svn: 83472
* Removed couple of unnecessary canonicalizationFariborz Jahanian2009-10-071-2/+2
| | | | | | per Doug's obsevation. llvm-svn: 83464
* Patch to implement C++ [over.built]p11 of overload resolution.Fariborz Jahanian2009-10-061-1/+39
| | | | | | | | Doug, please review. There is a FIXME in the test case with a question which is unrelated to this patch (that is, error is issued before set of builtins are added to the candidate list). llvm-svn: 83429
* Refactor the code that walks a C++ inheritance hierarchy, searchingDouglas Gregor2009-10-061-3/+3
| | | | | | | | | for bases, members, overridden virtual methods, etc. The operations isDerivedFrom and lookupInBases are now provided by CXXRecordDecl, rather than by Sema, so that CodeGen and other clients can use them directly. llvm-svn: 83396
* Refixed pr5086 by letting Expr::isNullPointerConstantFariborz Jahanian2009-10-061-3/+0
| | | | | | | handle checking for a null pointer for a zero-valued enumerator; moving the test case from CodeGen to Sema. llvm-svn: 83350
* enumerator value of 0 is not a null pointer constant forFariborz Jahanian2009-10-011-0/+3
| | | | | | deciding const of null pointer conversion. Fixes PR5086. llvm-svn: 83217
* Patch to implement static casting which requires one Fariborz Jahanian2009-10-011-5/+14
| | | | | | user-defined type conversion. Fixes PR5040. llvm-svn: 83211
* When overload resolution fails for an overloaded operator, show theDouglas Gregor2009-09-301-10/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | overload candidates (but not the built-in ones). We still rely on the underlying built-in semantic analysis to produce the initial diagnostic, then print the candidates following that diagnostic. One side advantage of this approach is that we can perform more validation of C++'s operator overloading with built-in candidates vs. the semantic analysis for those built-in operators: when there are no viable candidates, we know to expect an error from the built-in operator handling code. Otherwise, we are not modeling the built-in semantics properly within operator overloading. This is checked as: assert(Result.isInvalid() && "C++ binary operator overloading is missing candidates!"); if (Result.isInvalid()) PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false); The assert() catches cases where we're wrong in a +Asserts build. The "if" makes sure that, if this happens in a production clang (-Asserts), we still build the proper built-in operator and continue on our merry way. This is effectively what happened before this change, but we've added the assert() to catch more flies. llvm-svn: 83175
* Note location of operators caused the circularity.Fariborz Jahanian2009-09-301-1/+1
| | | | llvm-svn: 83153
* Fixes a nasty bug which only turned up in 32bit build of clang andFariborz Jahanian2009-09-291-1/+7
| | | | | | | | had to do with an initialized field when multiple type conversions are ambiguous but must be treated as user defined conversion for overload resolution purposes. llvm-svn: 83079
* Define and use a helper method to call a type conversionFariborz Jahanian2009-09-281-8/+3
| | | | | | function. llvm-svn: 83027
* Minor API change. No change in functionality.Fariborz Jahanian2009-09-281-1/+1
| | | | llvm-svn: 83022
* Multiple conversions to the same type are ambiguous but for theFariborz Jahanian2009-09-281-4/+14
| | | | | | | purpose of overload resolution is to be treated as a uner-defined conversion. llvm-svn: 83004
* Patch for AST representation for the implicit conversion to a function Fariborz Jahanian2009-09-281-6/+12
| | | | | | reference/pointer. And a test case for code gen. llvm-svn: 83000
* Don't allow the same function to enter the overload candidate setDouglas Gregor2009-09-281-8/+42
| | | | | | | multiple times. This requires to be more careful about re-adding candidates cached from the function template definition. llvm-svn: 82967
* Yet another simplifying use of Sema::getMostSpecializedDouglas Gregor2009-09-261-46/+16
| | | | llvm-svn: 82844
* Fix checking for a null pointer constant when the expression itself isDouglas Gregor2009-09-251-5/+13
| | | | | | | | | | | | value-dependent. Audit (and fixed) all calls to Expr::isNullPointerConstant() to provide the correct behavior with value-dependent expressions. Fixes PR5041 and a crash in libstdc++ <locale>. In the same vein, properly compute value- and type-dependence for ChooseExpr. Fixes PR4996. llvm-svn: 82748
* WIP implementation of explicit function template specialization. ThisDouglas Gregor2009-09-241-0/+3
| | | | | | | | | | | | | | | | | | | | | first implementation recognizes when a function declaration is an explicit function template specialization (based on the presence of a template<> header), performs template argument deduction + ambiguity resolution to determine which template is being specialized, and hooks There are many caveats here: - We completely and totally drop any explicitly-specified template arguments on the floor - We don't diagnose any of the extra semantic things that we should diagnose. - I haven't looked to see that we're getting the right linkage for explicit specializations On a happy note, this silences a bunch of errors that show up in libstdc++'s <iostream>, although Clang still can't get through the entire header. llvm-svn: 82728
* Refactor the representation of qualifiers to bring ExtQualType out of theJohn McCall2009-09-241-43/+52
| | | | | | | | Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our use of qualifiers and fix a few places that weren't dealing with qualifiers quite right; many more remain. llvm-svn: 82705
OpenPOWER on IntegriCloud