Граф коммитов

51 Коммитов

Автор SHA1 Сообщение Дата
Dmitri Gribenko 959dc8475f Use trailing documentation comments properly
Patch by Alexander Zinenko.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175376 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-16 22:21:38 +00:00
Guy Benyei 6959acd4bb Enable overloading of OpenCL events - this is needed for the overloaded OpenCL builtin functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174630 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 16:05:33 +00:00
Richard Smith 0efa62f209 Replace "failed template argument deduction" diagnostic with something useful
in the one case where we've already factored out a reason code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174036 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 04:03:12 +00:00
Dmitri Gribenko cfa88f8939 Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172323 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-12 19:30:44 +00:00
Benjamin Kramer f5b132f7b3 Clearing a SmallPtrSet is still expensive, split it out from OverloadCandidateSet::clear and don't do it on destruction.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165501 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-09 15:52:25 +00:00
David Blaikie 0bea86307e StringRef-ify Binary/UnaryOperator::getOpcodeStr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165383 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-08 01:11:04 +00:00
Craig Topper be2fa7ebf0 Mark unimplemented copy constructors and copy assignment operators with LLVM_DELETED_FUNCTION.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164102 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-18 04:52:05 +00:00
Richard Smith e3898ac6cc Fix OverloadCandidateSet::clear to not leak PartialDiagnostics, found by Samuel
Panzer. I've not been able to trigger a failure caused by this, so no test yet.
Also included is a small change from Paul Robinson to only consider the
FailureKind if the overload candidate did actually fail.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160470 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-18 23:52:59 +00:00
Richard Smith b8590f3572 When we suppress an error due to SFINAE, stash the diagnostic away with the
overload candidate, and include its message in any subsequent 'candidate not
viable due to substitution failure' note we may produce.

To keep the note small (since the 'overload resolution failed' diagnostics are
often already very verbose), the text of the SFINAE diagnostic is included as
part of the text of the note, and any notes which were attached to it are
discarded.

There happened to be spare space in OverloadCandidate into which a
PartialDiagnosticAt could be squeezed, and this patch goes to lengths to avoid
unnecessary PartialDiagnostic copies, resulting in no slowdown that I could
measure. (Removal in passing of some PartialDiagnostic copies has resulted in a
slightly smaller clang binary overall.) Even on a torture test, I was unable to
measure a memory increase of above 0.2%.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156297 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-07 09:03:25 +00:00
Richard Smith f602806965 Teach APValue printer to print boolean 0 and 1 as 'false' and 'true'. Fix up
some calling code to actually pass in a non-null type, to avoid a crash.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153358 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-23 23:55:39 +00:00
Sebastian Redl adfb535905 Implement a FIXME for conversion sequence distinction. Should fix PR12092.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151577 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-27 22:38:26 +00:00
Ahmed Charles 13a140caba ArrayRef'ize various functions in the AST/Parser/Sema.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151447 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-25 11:00:22 +00:00
Richard Smith 8ef7b20333 constexpr: converted constant expression handling for enumerator values, case
values and non-type template arguments of integral and enumeration types.

This change causes some legal C++98 code to no longer compile in C++11 mode, by
enforcing the C++11 rule that narrowing integral conversions are not permitted
in the final implicit conversion sequence for the above cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148439 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 23:55:52 +00:00
Richard Smith 4c3fc9b38d Move narrowing conversion detection code from SemaInit to SemaOverload, ready
for it to be used in converted constant expression checking, and fix a couple
of issues:
 - Conversion operators implicitly invoked prior to the narrowing conversion
   were not being correctly handled when determining whether a constant value
   was narrowed.
 - For conversions from floating-point to integral types, the diagnostic text
   incorrectly always claimed that the source expression was not a constant
   expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148381 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 05:21:49 +00:00
David Blaikie 7530c034c0 Remove unreachable code in Clang. (replace with llvm_unreachable where appropriate or when GCC requires it)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148292 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 06:56:22 +00:00
Benjamin Kramer 9e2822bb4a Clear ImplicitConversionSequence the obvious way which turns out to be less fragile.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148200 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-14 20:16:52 +00:00
Benjamin Kramer 314f5544fb Give OverloadCandidateSet the responsibility for destroying the implicit conversion sequences so we don't get double frees when the vector reallocates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148198 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-14 19:31:39 +00:00
Benjamin Kramer 448ce0f1b4 Reorder initializers, make use of the whole array.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148193 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-14 17:59:15 +00:00
Benjamin Kramer 7268c8b92d Move the inline array to the end.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148192 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-14 17:23:10 +00:00
Benjamin Kramer 527610d92b Destroy OverloadCandidates before taking away the underlying memory.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148190 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-14 17:10:59 +00:00
Benjamin Kramer 09dd3798e1 Pool allocate ImplicitConversionSequences.
To avoid malloc thrashing give OverloadCandidateSet an inline capacity for conversion sequences.
We use the fact that OverloadCandidates never outlive the OverloadCandidateSet and have a fixed
amount of conversion sequences.

This eliminates the oversized SmallVector from OverloadCandidate shrinking it from 752 to 208 bytes.

On the test case from the "Why is CLANG++ so freaking slow" thread on llvmdev this avoids one gig
of vector reallocation (including memcpy) which translates into 5-10% speedup on Lion/x86_64.

Overload candidate computation is still the biggest malloc contributor when compiling templated
c++ code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148186 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-14 16:32:05 +00:00
Benjamin Kramer 0e6a16f3e8 OverloadCandidateSet: Stop exposing SmallVector internals
Replace push_back with addCandidate which will let us make use of the fixed size of
the conversion sequence vector soon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148185 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-14 16:31:55 +00:00
Douglas Gregor 459001f735 Initialize ImplicitConversionSequence::ListInitializationSequence. Fixes PR11394
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144992 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-19 09:56:57 +00:00
Sebastian Redl cc7a6484d8 Enable function call and some overload resolution with parameters of aggregate class type and initializer list arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143462 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 15:53:09 +00:00
Abramo Bagnara 7cc58b4c92 Added a flag to identify resolved overloaded function references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141171 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-05 07:56:41 +00:00
Peter Collingbourne 78dd67e78c CUDA: diagnose invalid calls across targets
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140978 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-02 23:49:40 +00:00
Sebastian Redl 14b0c194b3 Give InitListChecker a verification-only mode, where it neither emits diagnostics nor
builds a semantic (structured) initializer list, just reports on whether it can match
the given list to the target type.
Use this mode for doing init list checking in the initial step of initialization, which
will eventually allow us to do overload resolution based on the outcome.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140457 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-24 17:48:00 +00:00
John McCall ca82a82082 Enforce access control for conversion operators used in contextual
conversions (rather than just call-arguments).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140244 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 08:36:56 +00:00
Anna Zaks f3546eeef1 Refactor the */& mismatch fixit generation out of SemaOverload and provide a simple conversion checking function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136376 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-28 19:46:48 +00:00
Anna Zaks ffe9edd45f Addressing code review comments for commit 135509 - Add FixItHints in case a C++ function call is missing * or & operators on
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135643 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-21 00:34:39 +00:00
Chris Lattner 686775deca now that we have a centralized place to do so, add some using declarations for
some common llvm types: stringref and smallvector.  This cleans up the codebase
quite a bit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135576 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-20 06:58:45 +00:00
Anna Zaks b89fe6b04c Add FixItHints in case a C++ function call is missing * or & operators on one/several of it's parameters (addresses http://llvm.org/PR5941).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135509 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 19:49:12 +00:00
John McCall f85e193739 Automatic Reference Counting.
Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15 23:02:42 +00:00
Douglas Gregor 4ae5b7208e Identity and non-identity standard conversion sequences can be
compared even when one is a reference binding and the other is not
(<rdar://problem/9173984>), but the definition of an identity sequence
does not involve lvalue-to-rvalue adjustments (PR9507). Fix both
inter-related issues.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132660 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-05 06:15:20 +00:00
Fariborz Jahanian d97f558f48 Support for Transparent unions used as overloadable
function parameter. // rdar:// 9129552
and PR9406.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128159 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-23 19:50:54 +00:00
Benjamin Kramer e5a3ce6dd5 Don't clear OverloadCandidateSets on destruction, it has no effect anymore.
And clearing a SmallPtrSet can be an expensive operation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128081 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 09:46:54 +00:00
Chandler Carruth 25ca421a60 Remove the FIXME I introduced last night, and pull the logic for
marking selected overloads into the callers. This allows a few callers
to skip it altogether (they would have anyways because they weren't
interested in successful overloads) or defer until after further checks
take place much like the check required for PR9323 to avoid marking
unused copy constructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126503 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-25 19:41:05 +00:00
Chandler Carruth 30028234f3 Rough fix for PR9323 that prevents Clang from marking copy constructor
declarations as referenced when in fact we're not going to even form
a call in the AST. This is significant because we attempt to allow as an
extension classes with intentionally private and undefined copy
constructors to have temporaries bound to references, and so shouldn't
warn about the lack of definition for that copy constructor when the
class is internal.

Doug, John wasn't really satisfied with the presence of overloading at
all. This is a stop-gap and there may be a better solution. If you can
give me some hints for how you'd prefer to see this solved, I'll happily
switch things over.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126480 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-25 08:52:25 +00:00
Fariborz Jahanian e3c8c64e77 Implement objective-c++'s block pointer type matching involving
types which are contravariance in argument types and covariance
in return types. // rdar://8979379.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125445 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-12 19:07:46 +00:00
Douglas Gregor fcab48b626 Rvalue references for *this: explicitly keep track of whether a
reference binding is for the implicit object parameter of a member
function with a ref-qualifier. My previous comment, that we didn't
need to track this explicitly, was wrong: we do in fact get
rvalue-references-prefer-rvalues overloading with ref-qualifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124313 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 19:41:18 +00:00
Douglas Gregor 2c9a03f3b2 Rvalue references for *this: implement the implicit conversion rules
for the implicit object argument to a non-static member function with
a ref-qualifier (C++0x [over.match.funcs]p4).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124311 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 19:30:28 +00:00
Douglas Gregor c78e259a5f Clean up the C++0x __has_feature tests. Specifically:
- Don't publicize a C++0x feature through __has_feature if we aren't
    in C++0x mode (even if the feature is available only with a
    warning). 
  - "auto" is not implemented well enough for its __has_feature to be
    turned on.
  - Fix the test of C++0x __has_feature to actually test what we're
  trying to test. Searching for the substring "foo" when our options
  are "foo" and "no_foo" doesn't work :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124291 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 15:36:03 +00:00
Douglas Gregor 440a48318c Reinstate r124236 (tweaking the rvalue-reference overload resolution
rules), now that we've actually have a clean build for me to sully.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124290 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 14:52:12 +00:00
Douglas Gregor 4d4feead7e Speculatively revert r124236
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124247 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 23:49:36 +00:00
Douglas Gregor b7cd135215 Speculatively implement a tweak to the C++0x overload resolution rules
for reference binding (C++ [over.rank.ics]p3b1sb4), so that we prefer
the binding of an lvalue reference to a function lvalue over the
binding of an rvalue reference. This change resolves the ambiguity
with std::forward and lvalue references to function types in a way
that seems consistent with the original rvalue references proposal.

My proposed wording for this change is shown in
isBetterReferenceBindingKind(); we'll try to get this change adopted
in the C++0x working paper as well.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124236 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 22:19:32 +00:00
Douglas Gregor 83eecbefa4 When building a user-defined conversion sequence, keep track of the
declaration that name lookup actually found, so that we can use it for
access checking later on. Fixes <rdar://problem/8876150>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123867 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 01:32:05 +00:00
Douglas Gregor dfc331e04d Explicitly track the number of call arguments provided when performing
overload resolution, so that we only use that number of call arguments
for partial ordering. Fixes PR9006, a recent regression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123861 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-19 23:54:39 +00:00
Douglas Gregor 8fcc516a5d When performing overload resolution, only compare the final conversion
sequences for two conversion functions when in fact we are in the text
of initialization by a user-defined conversion sequences. Fixes PR8034.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113724 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-12 08:07:23 +00:00
John McCall 2a7fb27913 Move more stuff out of Sema.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112026 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 05:32:35 +00:00
John McCall 120d63cd44 Move some of SemaOverload's API to various places in Overload.h, and kill
some of it off completely.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111957 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 20:38:10 +00:00