summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Sema] Don't emit "pure virtual" warning for fully qualified calls.Davide Italiano2015-07-141-2/+8
| | | | | | | | | | -fapple-kext is an exception because calls will still go through the vtable in that mode. Add a note to make the user aware of that. PR: 23215 Differential Revision: http://reviews.llvm.org/D10935 llvm-svn: 242246
* Implement the Objective-C __kindof type qualifier.Douglas Gregor2015-07-071-17/+1
| | | | | | | | | | The __kindof type qualifier can be applied to Objective-C object (pointer) types to indicate id-like behavior, which includes implicit "downcasting" of __kindof types to subclasses and id-like message-send behavior. __kindof types provide better type bounds for substitutions into unspecified generic types, which preserves more type information. llvm-svn: 241548
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-6/+6
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-6/+6
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* Diagnose unsafe uses of nil and __nonnull pointers.Douglas Gregor2015-06-191-1/+1
| | | | | | | | | | | | | | | | | | | This generalizes the checking of null arguments to also work with values of pointer-to-function, reference-to-function, and block pointer type, using the nullability information within the underling function prototype to extend non-null checking, and diagnoses returns of 'nil' within a function with a __nonnull return type. Note that we don't warn about nil returns from Objective-C methods, because it's common for Objective-C methods to mimic the nil-swallowing behavior of the receiver by checking ostensibly non-null parameters and returning nil from otherwise non-null methods in that case. It also diagnoses (via a separate flag) conversions from nullable to nonnull pointers. It's a separate flag because this warning can be noisy. llvm-svn: 240153
* [ms] Don't try to delay lookup for failures in SFINAE context (PR23823)Hans Wennborg2015-06-121-1/+2
| | | | | | | | | | | | | The underlying problem in PR23823 already existed before my recent change in r239558, but that change made it worse (failing not only for undeclared symbols, but also failed overload resolution). This makes Clang not try to delay the lookup in SFINAE context. I assume no current code is relying on SFINAE working with lookups that need to be delayed, because that never seems to have worked. Differential Revision: http://reviews.llvm.org/D10417 llvm-svn: 239639
* [ms] Do lookup in dependent base classes also when overload resolution fails ↵Hans Wennborg2015-06-111-22/+28
| | | | | | | | | | | | | | | | | | | (PR23810) This patch does two things in order to enable compilation of the problematic code in PR23810: 1. In Sema::buildOverloadedCallSet, it postpones lookup for MS mode when no viable candidate is found in the overload set. Previously, lookup would only be postponed here if the overload set was empty. 2. Make BuildRecoveryCallExpr call Sema::DiagnoseEmptyLookup under more circumstances. There is a comment in DiagnoseTwoPhaseLookup that says "Don't diagnose names we find in classes; we get much better diagnostics for these from DiagnoseEmptyLookup." The problem was that DiagnoseEmptyLookup might not get called later, and we failed to recover. Differential Revision: http://reviews.llvm.org/D10369 llvm-svn: 239558
* Fix a few line endings. NFC.Yunzhong Gao2015-05-011-11/+11
| | | | llvm-svn: 236301
* [SemaCXX patch] Patch to fix a crash when a 'delete' constructorFariborz Jahanian2015-04-141-4/+5
| | | | | | | is being accessed. Reviewed by Richard Smith. rdar://20281011 llvm-svn: 234912
* A conversion from a scoped enumeration bitfield to an integral type is anRichard Smith2015-03-281-2/+4
| | | | | | | | integral promotion only if it converts to the underlying type or its promoted type, not if it converts to the promoted type that the bitfield would have it if were of the underlying type. llvm-svn: 233457
* Reformatting, NFCRichard Smith2015-03-261-6/+6
| | | | llvm-svn: 233234
* Track the source location of the dot or arrow operator in a MemberExpr.Aaron Ballman2015-03-241-15/+11
| | | | | | Patch by Joe Ranieri! llvm-svn: 233085
* Simplify boolean expressions in clang with clang-tidyDavid Blaikie2015-03-091-4/+1
| | | | | | | | Patch by Richard (legalize at xmission dot com). Differential Revision: http://reviews.llvm.org/D8155 llvm-svn: 231619
* Sema: Parenthesized bound destructor member expressions can be calledDavid Majnemer2015-02-251-0/+4
| | | | | | | | | We would wrongfully reject (a.~A)() in both the destructor and pseudo-destructor cases. This fixes PR22668. llvm-svn: 230512
* Fix UTF8 chars to ASCII.NAKAMURA Takumi2015-02-251-2/+2
| | | | llvm-svn: 230479
* PR22566: a conversion from a floating-point type to bool is a narrowing ↵Richard Smith2015-02-191-7/+13
| | | | | | conversion. llvm-svn: 229792
* Sema: Replace some push_backs of expensive to move objects with emplace_back.Benjamin Kramer2015-02-171-1/+1
| | | | | | NFC. llvm-svn: 229557
* Update APIs that return a pair of iterators to return an iterator_range instead.Benjamin Kramer2015-02-061-34/+12
| | | | | | Convert uses of those APIs into ranged for loops. NFC. llvm-svn: 228404
* Cleanups, and add some FIXMEs. No functional change.Richard Smith2015-01-271-12/+14
| | | | llvm-svn: 227267
* Implement the remaining portion of DR1467 from r227022. I may have ↵Larisse Voufo2015-01-271-17/+70
| | | | | | overlooked a few things, but this implementation comes straight from the DR resolution itself. llvm-svn: 227224
* DR1902: if overload resolution recurses, and the inner overload resolutionRichard Smith2015-01-271-20/+27
| | | | | | | selects a deleted function, the outer function is still a candidate even though the initialization sequence is "otherwise ill-formed". llvm-svn: 227169
* Remove an out-of-date and incorrect comment.Richard Smith2015-01-221-10/+0
| | | | llvm-svn: 226756
* Initial support for C++ parameter completionFrancisco Lopes da Silva2015-01-211-23/+34
| | | | | | | | | | | | | | | | | | | | The improved completion in call context now works with: - Functions. - Member functions. - Constructors. - New expressions. - Function call expressions. - Template variants of the previous. There are still rough edges to be fixed: - Provide support for optional parameters. (fix known) - Provide support for member initializers. (fix known) - Provide support for variadic template functions. (fix unknown) - Others? llvm-svn: 226670
* Extend the self move warning to record types.Richard Trieu2015-01-131-1/+6
| | | | | | | Move the logic for checking self moves into SemaChecking and add that function to Sema since it is now used in multiple places. llvm-svn: 225756
* 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
OpenPOWER on IntegriCloud