summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [coroutines] Creation of promise object, lookup of operator co_await, buildingRichard Smith2015-10-271-12/+8
| | | | | | of await_* calls, and AST representation for same. llvm-svn: 251387
* [coroutines] Add overloaded unary 'operator co_await'.Richard Smith2015-10-221-0/+1
| | | | llvm-svn: 250991
* [modules] libstdc++ defines some static inline functions in its internalRichard Smith2015-10-211-0/+36
| | | | | | | | | | | headers. If those headers end up being textually included twice into the same module, we get ambiguity errors. Work around this by downgrading the ambiguity error to a warning if multiple identical internal-linkage functions appear in an overload set, and just pick one of those functions as the lookup result. llvm-svn: 250884
* [Sema] Fix address-of + enable_if overloading logicGeorge Burgess IV2015-10-161-57/+93
| | | | | | | | | | | | | | | | | Previously, our logic when taking the address of an overloaded function would not consider enable_if attributes, so long as all of the enable_if conditions on a given candidate were true. So, two functions with identical signatures (one with enable_if attributes, the other without), would be considered equally good overloads. If we were calling the function instead of taking its address, then the function with enable_if attributes would be preferred. This patch makes us prefer the candidate with enable_if regardless of if we're calling or taking the address of an overloaded function. Differential Revision: http://reviews.llvm.org/D13795 llvm-svn: 250486
* [Sema] Make `&function_with_enable_if_attrs` an errorGeorge Burgess IV2015-10-121-13/+44
| | | | | | | | | | | | | | | | | | This fixes a bug where one can take the address of a conditionally enabled function to drop its enable_if guards. For example: int foo(int a) __attribute__((enable_if(a > 0, ""))); int (*p)(int) = &foo; int result = p(-1); // compilation succeeds; calls foo(-1) Overloading logic has been updated to reflect this change, as well. Functions with enable_if attributes that are always true are still allowed to have their address taken. Differential Revision: http://reviews.llvm.org/D13607 llvm-svn: 250090
* [Sema] Don't emit multiple diags for one errorGeorge Burgess IV2015-10-121-5/+13
| | | | | | | | | Fixed a bug where we'd emit multiple diagnostics if there was a problem taking the address of an overloaded template function. Differential Revision: http://reviews.llvm.org/D13664 llvm-svn: 250078
* [Sema] Allow C conversions in C overload logicGeorge Burgess IV2015-10-111-15/+36
| | | | | | | | | | C allows for some implicit conversions that C++ does not, e.g. void* -> char*. This patch teaches clang that these conversions are okay when dealing with overloads in C. Differential Revision: http://reviews.llvm.org/D13604 llvm-svn: 249995
* SourceRanges are small and trivially copyable, don't them by reference.Craig Topper2015-10-041-1/+1
| | | | llvm-svn: 249259
* Make incomplete type errors better with enable_ifGeorge Burgess IV2015-09-251-10/+15
| | | | | | | | | | | | This patch fixes the order in which we evaluate the different ways that a function call could be disallowed. Now, if you call a non-overloaded function with an incomplete type and failing enable_if, we'll prioritize reporting the more obvious error (use of incomplete type) over reporting the failing enable_if. Thanks to Ettore Speziale for the patch! llvm-svn: 248595
* Remove wrong implication that value-dependent implies instantiation-dependent,Richard Smith2015-09-231-0/+2
| | | | | | | | | and fix the only code that was depending on this so that it sets all the relevant flags appropriately. No functionality change intended. llvm-svn: 248430
* [CUDA] Allow function overloads in CUDA based on host/device attributes.Artem Belevich2015-09-221-1/+35
| | | | | | | | | | | | | | | | | | | The patch makes it possible to parse CUDA files that contain host/device functions with identical signatures, but different attributes without having to physically split source into host-only and device-only parts. This change is needed in order to parse CUDA header files that have a lot of name clashes with standard include files. Gory details are in design doc here: https://goo.gl/EXnymm Feel free to leave comments there or in this review thread. This feature is controlled with CC1 option -fcuda-target-overloads and is disabled by default. Differential Revision: http://reviews.llvm.org/D12453 llvm-svn: 248295
* [modules] A using-declaration doesn't introduce a new entity, just a new nameRichard Smith2015-09-151-0/+5
| | | | | | | for an existing entity, and as such a using-declaration doesn't need to conflict with a hidden entity (nor vice versa). llvm-svn: 247654
* [MS ABI] Make member pointers return true for isIncompleteTypeDavid Majnemer2015-09-101-4/+0
| | | | | | | The type of a member pointer is incomplete if it has no inheritance model. This lets us reuse more general logic already embedded in clang. llvm-svn: 247346
* Add a new frontend warning for referencing members from the handler of a ↵Aaron Ballman2015-09-011-3/+3
| | | | | | | | constructor or destructor function-try-block, which is UB in C++. This corresponds to the CERT secure coding rule ERR53-CPP. llvm-svn: 246548
* Make sure that we evaluate __attribute__((enable_if)) on a method with no ↵Nick Lewycky2015-08-251-1/+34
| | | | | | overloads. Patch by Ettore Speziale! llvm-svn: 245985
* Clarify the error message when the reason the conversion is not viable is ↵Nick Lewycky2015-08-251-1/+1
| | | | | | because the returned value does not match the function return type. llvm-svn: 245979
* Fix typo - symetric -> symmetric.Eric Christopher2015-08-211-3/+3
| | | | llvm-svn: 245706
* [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
OpenPOWER on IntegriCloud