summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Improve handling of value dependent expressions in ↵Nick Lewycky2014-12-161-2/+12
| | | | | | __attribute__((enable_if)), both in the condition expression and at the call site. Fixes PR20988! llvm-svn: 224320
* If a non-template constructor instantiated to X(X),John McCall2014-12-141-10/+20
| | | | | | | | | | | | | | | | | | | | | | | ignore it during overload resolution when initializing X from a value of type cv X. Previously, our rule here only ignored specializations of constructor templates. That's probably because the standard says that constructors are outright ill-formed if their first parameter is literally X and they're callable with one argument. However, Clang only enforces that prohibition against non-implicit instantiations; I'm not sure why, but it seems to be deliberate. Given that, the most sensible thing to do is to just ignore the "illegal" constructor regardless of where it came from. Also, stop ignoring such constructors silently: print a note explaining why they're being ignored. Fixes <rdar://19199836>. llvm-svn: 224205
* [c++1z] Most of N4268 (allow constant evaluation for non-type template ↵Richard Smith2014-11-261-62/+97
| | | | | | | | | arguments). We don't yet support pointer-to-member template arguments that have undergone pointer-to-member conversions, mostly because we don't have a mangling for them yet. llvm-svn: 222807
* Update for LLVM API change to make Small(Ptr)Set::insert return ↵David Blaikie2014-11-191-13/+13
| | | | | | pair<iterator, bool> as per the C++ standard's associative container concept. llvm-svn: 222335
* Wrap to 80 columns, no behavior change.Nico Weber2014-11-191-4/+4
| | | | llvm-svn: 222315
* Missing comma in a string array initialization (CID 1254893)Sylvestre Ledru2014-11-171-1/+1
| | | | | | | | | | | | | | Summary: We have this error from a while (Wed Jun 15 18:02:42 2011 r133103) Reviewers: rsmith Reviewed By: rsmith Differential Revision: http://reviews.llvm.org/D6296 llvm-svn: 222169
* Fix this code to follow the coding style regarding anonymous namespaces andRichard Smith2014-11-121-93/+58
| | | | | | | static functions. Make a bunch of file-local functions static. Remove one unused static function revealed by this. llvm-svn: 221745
* Pass around CorrectionCandidateCallbacks as unique_ptrs soKaelyn Takata2014-10-271-9/+14
| | | | | | TypoCorrectionConsumer can keep the callback around as long as needed. llvm-svn: 220693
* CUDA: Fix incorrect target inference for implicit members.Eli Bendersky2014-09-291-3/+47
| | | | | | | | | | | | As PR20495 demonstrates, Clang currenlty infers the CUDA target (host/device, etc) for implicit members (constructors, etc.) incorrectly. This causes errors and even assertions in Clang when compiling code (assertions in C++11 mode where implicit move constructors are added into the mix). Fix the problem by inferring the target from the methods the implicit member should call (depending on its base classes and fields). llvm-svn: 218624
* Fix PR20886 - enforce CUDA target match in method callsEli Bendersky2014-09-251-0/+21
| | | | | | http://reviews.llvm.org/D5298 llvm-svn: 218482
* Don't perform ADL when looking up operator=; there is no non-member form ofRichard Smith2014-09-231-4/+7
| | | | | | | | | that function, and apart from being slow, this is unnecessary: ADL can trigger instantiations that are not permitted here. The standard isn't *completely* clear here, but this seems like the intent, and in any case this approach is permitted by [temp.inst]p7. llvm-svn: 218330
* Use llvm::makeArrayRef instead of explicitly calling ArrayRef constructor ↵Craig Topper2014-08-291-3/+1
| | | | | | and mentioning the type. This works now that we have a conversion from ArrayRef<T*> to ArrayRef<const T*>. llvm-svn: 216710
* Objective-C. When multiple nullary selectors are found inFariborz Jahanian2014-08-271-1/+11
| | | | | | | | | | global pool in the course of method selection for a messaging expression, select one with the most general return type of 'id'. This is to remove type-mismatch warning (which is useless) as result of random selection of method with more restrictive return type. rdar://18095772 llvm-svn: 216560
* Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or ↵Craig Topper2014-08-271-2/+2
| | | | | | just letting them be implicitly created. llvm-svn: 216528
* C++1y is now C++14!Aaron Ballman2014-08-191-8/+8
| | | | | | Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording. llvm-svn: 215982
* Objective-C. Minor refactoring of my last patch.Fariborz Jahanian2014-08-131-1/+5
| | | | | | // rdar://16808765 llvm-svn: 215581
* Objective-C. This patch is to resolve the method used in methodFariborz Jahanian2014-08-131-0/+73
| | | | | | | expression to the best method found in global method pools. This is wip. // rdar://16808765 llvm-svn: 215577
* MS ABI: Handle member function pointers returning a member data pointerDavid Majnemer2014-08-071-0/+4
| | | | | | | | | MSVC doesn't decide what the inheritance model for a returned member pointer *until* a call expression returns it. This fixes PR20017. llvm-svn: 215164
* Use the correct from type in a SCSEhsan Akhgari2014-07-221-0/+1
| | | | | | | | | | | | | | | | | | Summary: If during constructing a standard conversion sequence, we resolve an overload, we need to adjust the from type in the SCS according to the resolved operator. I found this bug when debugging PR20218. This doesn't seem to be observable, so there is no good way of testing it. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4402 llvm-svn: 213680
* Remove dead code.Richard Smith2014-07-141-11/+0
| | | | llvm-svn: 213013
* In C++98, if an rvalue reference binds to a function lvalue (or an xvalue or anRichard Smith2014-07-141-1/+1
| | | | | | | | array prvalue), treat that as a direct binding. Only the class prvalue case needs to be excluded here; the rest are extensions anyway, so we can treat them as we would in C++11. llvm-svn: 212978
* Superficial fix for PR20218: binding a function lvalue to a const reference toRichard Smith2014-07-141-17/+28
| | | | | | | | | | | | | a function pointer is neither better nor worse than binding a function lvalue to a function rvalue reference. Don't get confused and think that both bindings are binding to a function lvalue (which would make the lvalue form win); the const reference is binding to an rvalue. The "real" bug in PR20218 is still present: we're getting the wrong answer from template argument deduction, and that's what leads us to this weird overload set. llvm-svn: 212916
* Import MutableArrayRef into clang namespace.Craig Topper2014-06-281-1/+1
| | | | llvm-svn: 211988
* Remove llvm:: from uses of ArrayRef.Craig Topper2014-06-281-2/+2
| | | | llvm-svn: 211987
* Refactoring. Remove Owned method from Sema.Nikola Smiljanic2014-05-291-49/+37
| | | | llvm-svn: 209812
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-291-36/+36
| | | | | | takeAs to getAs. llvm-svn: 209800
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-261-96/+100
| | | | llvm-svn: 209613
* Add hasSameType overload to ASTContext for Type pointers. Switch a typeRichard Trieu2014-05-221-2/+1
| | | | | | comparison check to use this instead of calling Type::getCanonicalTypeInternal llvm-svn: 209378
* Fix diagnostic message for member function pointer mismatches where one of theRichard Trieu2014-05-201-1/+2
| | | | | | classes is a template argument. llvm-svn: 209190
* More fixes for isBetterOverloadCandidate not being a strict weak ordering. TheRichard Smith2014-05-171-19/+8
| | | | | | bug was obvious from inspection, figuring out a way to test it was... less so. llvm-svn: 209060
* Switch to a more efficient expression of this check.Richard Smith2014-05-171-20/+24
| | | | llvm-svn: 209055
* Correct incoherent function versus function template partial ordering for ↵Richard Smith2014-05-171-24/+30
| | | | | | conversion operators (the comparison could claim that two conversion operators are both better than each other). Actually implement DR495, rather than passing its test by chance because the declarations happened to be in the "lucky" order. llvm-svn: 209054
* Decouple ExprCXX.h and DeclCXX.h and clean up includes a bit.Benjamin Kramer2014-05-101-0/+1
| | | | | | | Required pulling LambdaExpr::Capture into its own header. No functionality change. llvm-svn: 208470
* Try harder to ensure a strict weak ordering of overload candidates thatKaelyn Takata2014-05-071-6/+11
| | | | | | have arity mismatches. llvm-svn: 208146
* Fix crash when one overload candidate is a template instead of a function. ↵Nick Lewycky2014-05-061-0/+1
| | | | | | | | | | Patch by Kaelyn Takata. Testcase coming out of creduce will land in a separate commit shortly. Also, it appears that this callback is used even in a SFINAE context where the results are never displayed. llvm-svn: 208062
* Fix a bunch of mislayered clang/Lex includes from SemaAlp Toker2014-05-031-2/+1
| | | | llvm-svn: 207896
* Use std::abs(int) portably.David Blaikie2014-05-011-2/+3
| | | | | | Code review feedback from Reid Kleckner on r207806. llvm-svn: 207811
* Fix some -Wabsolute-value warnings introduced in r207796.David Blaikie2014-05-011-2/+2
| | | | llvm-svn: 207806
* When sorting overload candidates, sort arity mismatches in ascendingKaelyn Takata2014-05-011-3/+16
| | | | | | | | order by the number of missing or extra parameters. This is useful if there are more than a few overload candidates with arity mismatches, particularly in the presence of -fshow-overloads=best. llvm-svn: 207796
* Implement [over.match.oper]p3 properly, by filtering the non-candidates outRichard Smith2014-04-171-22/+78
| | | | | | | when building the candidate set, rather than trying to contort name lookup into handling this. llvm-svn: 206436
* Try harder about not suggesting methods as corrections when theyKaelyn Takata2014-04-041-1/+2
| | | | | | | | obviously won't work. Specifically, don't suggest methods (static or not) from unrelated classes when the expression is a method call through a specific object. llvm-svn: 205653
* Add defensive check that argument may be null in call to ↵Ted Kremenek2014-04-011-1/+1
| | | | | | | | | | | compareConversionFunctions() on incorrect code. I'm looking into getting a reduced test case, but it's not immediately available. Fixes <rdar://problem/16344806> llvm-svn: 205285
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-1/+1
| | | | | | class. llvm-svn: 203640
* [C++11] Remove the remaining uses of OwningPtr.Ahmed Charles2014-03-091-1/+1
| | | | | | Replace OwningArrayPtr with std::unique_ptr<T[]>. llvm-svn: 203388
* [C++11] Replacing RecordDecl iterators field_begin() and field_end() with ↵Aaron Ballman2014-03-081-3/+1
| | | | | | iterator_range fields(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203355
* Don't suggest non-static methods as corrections when they obviouslyKaelyn Uhrain2014-02-281-1/+1
| | | | | | | won't work (i.e. when not doing a member lookup and not in a method from the same class or a descendant class). llvm-svn: 202520
* Fix crash with enable_if on constructors.Nick Lewycky2014-02-281-1/+2
| | | | llvm-svn: 202467
* Tighten lax vector-conversion rules and enforce them consistently.John McCall2014-02-041-6/+5
| | | | | | | | | | | | | | | | | | | | When a lax conversion featured a vector and a non-vector, we were only requiring the non-vector to be a scalar type, but really it needs to be a real type (i.e. integral or real floating); it is not reasonable to allow a pointer, member pointer, or complex type here. r198474 required lax conversions to match in "data size", i.e. element size * element count, forbidding matches that happen only because a vector is rounded up to the nearest power of two in size. Unfortunately, the erroneous logic was repeated in several different places; unify them to use the new condition, so that it triggers for arbitrary conversions and not just those performed as part of binary operator checking. rdar://15931426 llvm-svn: 200810
* [Sema] Follow-up on r200521 for the -Wnon-literal-null-conversion warning ↵Argyrios Kyrtzidis2014-02-021-15/+1
| | | | | | and revert its behavior for C++. llvm-svn: 200622
* [Sema] For -Wnon-literal-null-conversion warning, look through integer ↵Argyrios Kyrtzidis2014-01-311-1/+15
| | | | | | | | | | casts, which are used by some projects in their null macro. rdar://15925483 llvm-svn: 200521
OpenPOWER on IntegriCloud