John McCall
8ccfcb51ee
Refactor the representation of qualifiers to bring ExtQualType out of the
...
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
2009-09-24 19:53:00 +00:00
Douglas Gregor
c809cc2efa
Improve diagnostic location information when checking the initialization of a reference
...
llvm-svn: 82666
2009-09-23 23:04:10 +00:00
Douglas Gregor
2a920014d3
When code-completion after a "," is building an overload set, note
...
that there is one more argument (the one following the comma) and make
the candidate non-viable if the function cannot accept any argument in
that position.
llvm-svn: 82625
2009-09-23 14:56:09 +00:00
Fariborz Jahanian
21ccf06352
Produce detailed diagnostics when overload
...
resolution failed to select a candidate due to
ambiguity in type conversion function selection.
llvm-svn: 82596
2009-09-23 00:58:07 +00:00
Fariborz Jahanian
f0647a5fbc
Code refactoring and cleanup.
...
llvm-svn: 82566
2009-09-22 20:24:30 +00:00
Fariborz Jahanian
0b51c729c9
Issue good ambiguity diagnostic when convesion fails.
...
llvm-svn: 82565
2009-09-22 19:53:15 +00:00
Douglas Gregor
cabea40ea3
Implement code completion within a function call, triggered after the
...
opening parentheses and after each comma. We gather the set of visible
overloaded functions, perform "partial" overloading based on the set
of arguments that we have thus far, and return the still-viable
results sorted by the likelihood that they will be the best candidate.
Most of the changes in this patch are a refactoring of the overloading
routines for a function call, since we needed to separate out the
notion of building an overload set (common to code-completion and
normal semantic analysis) and then what to do with that overload
set. As part of this change, I've pushed explicit template arguments
into a few more subroutines.
There is still much more work to do in this area. Function templates
won't be handled well (unless we happen to deduce all of the template
arguments before we hit the completion point), nor will overloaded
function-call operators or calls to member functions.
llvm-svn: 82549
2009-09-22 15:41:20 +00:00
John McCall
9dd450bb78
Change all the Type::getAsFoo() methods to specializations of Type::getAs().
...
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely. Several more 'leaf'
optimizations were introduced.
The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.
llvm-svn: 82501
2009-09-21 23:43:11 +00:00
Douglas Gregor
4fb9cde8ef
When printing an overload candidate that is a function template specialization,
...
point at the template and print out its template arguments, e.g.,
ambiguous-ovl-print.cpp:5:8: note: candidate function template specialization
[with T = int]
void f(T*, long);
llvm-svn: 81907
2009-09-15 20:11:42 +00:00
Fariborz Jahanian
3e6b57e593
Issue good diagnostics when initialization failes due to
...
ambiguity in type conversion function selection.
llvm-svn: 81898
2009-09-15 19:12:21 +00:00
Fariborz Jahanian
19c7328881
Issue a good diagnostics when attempt to select
...
a type convesion function results in ambiguity.
llvm-svn: 81812
2009-09-15 00:10:11 +00:00
Douglas Gregor
6010da024c
Implement partial ordering of function templates when calling a
...
conversion function.
llvm-svn: 81807
2009-09-14 23:02:14 +00:00
Douglas Gregor
48bc374d1e
Test function template partial ordering when resolving the address of
...
an overloaded function (template).
llvm-svn: 81804
2009-09-14 22:02:01 +00:00
Fariborz Jahanian
f4061e39a3
Used visible conversion function api to do overload
...
resolution of type conversion functions in base and
current class.
llvm-svn: 81784
2009-09-14 20:41:01 +00:00
Douglas Gregor
0ff7d92048
Implement partial ordering of function template specializations
...
(C++ [temp.func.order]).
llvm-svn: 81777
2009-09-14 18:39:43 +00:00
Anders Carlsson
7ec8ccde01
Use the correct CastKind for derived-to-base pointer conversions.
...
llvm-svn: 81608
2009-09-12 04:46:44 +00:00
Fariborz Jahanian
f9012a3e9d
Undid my yesterday patch which is not needed with an upcoming patch.
...
llvm-svn: 81549
2009-09-11 18:46:22 +00:00
Anders Carlsson
78b5493994
Look for overloaded arrow operators in base classes.
...
llvm-svn: 81475
2009-09-10 23:18:36 +00:00
Fariborz Jahanian
c571f790fc
Patch to collect conversion methods in base(s) and derived
...
class into a candidate set.
llvm-svn: 81467
2009-09-10 22:26:16 +00:00
Mike Stump
11289f4280
Remove tabs, and whitespace cleanups.
...
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Douglas Gregor
84f14dd674
Preliminary AST representation and semantic analysis for
...
explicitly-specified template argument lists in member reference
expressions, e.g.,
x->f<int>()
llvm-svn: 80646
2009-09-01 00:37:14 +00:00
Anders Carlsson
d20e795a5b
Fix this for real.
...
llvm-svn: 80377
2009-08-28 16:57:08 +00:00
Anders Carlsson
759b78951e
When doing overload resolution, expressions that are value dependent but not type dependent and of integral type should not be treated as null pointer constants.
...
llvm-svn: 80369
2009-08-28 15:55:56 +00:00
Anders Carlsson
228eea36a3
Pass InOverloadResolution all the way down to IsPointerConversion.
...
llvm-svn: 80368
2009-08-28 15:33:32 +00:00
Douglas Gregor
6a1f965853
When looking for overloaded member operators, make sure to instantiate
...
class template specializations (when possible) and look into base
classes. Thanks to Eli for the test case!
FIXME -=1.
llvm-svn: 80302
2009-08-27 23:35:55 +00:00
Anders Carlsson
20d1332d76
Add an InOverloadResolution flag to TryCopyInitialization.
...
llvm-svn: 80261
2009-08-27 17:37:39 +00:00
Anders Carlsson
271e3a4d47
Remove more default arguments.
...
llvm-svn: 80260
2009-08-27 17:30:43 +00:00
Anders Carlsson
ef4c72135f
Remove default arguments from TryImplicitConversion and fix a bug found in the process.
...
llvm-svn: 80258
2009-08-27 17:24:15 +00:00
Anders Carlsson
03068aa077
Remove default argument from TryCopyInitialization.
...
llvm-svn: 80256
2009-08-27 17:18:13 +00:00
Anders Carlsson
5ec4abf268
Revert the flags change for now, I have a better idea for this.
...
llvm-svn: 80255
2009-08-27 17:14:02 +00:00
Anders Carlsson
2f7e956f16
Add a OverloadResolutionFlags and start converting some of the overload methods over to using it instead of bools arguments.
...
llvm-svn: 80248
2009-08-27 16:01:18 +00:00
Anders Carlsson
d624e16833
Bye-bye old RequireCompleteType.
...
llvm-svn: 80182
2009-08-26 23:45:07 +00:00
Douglas Gregor
e9899d9769
Fix for overloaded binary operators whose operands need implicit
...
conversions, from Sylvere Teissier!
llvm-svn: 80112
2009-08-26 17:08:25 +00:00
Douglas Gregor
8a2e601917
Try to complete a type before looking for conversion functions within
...
that type. Note that we do not produce a diagnostic if the type is
incomplete; rather, we just don't look for conversion functions. Fixes PR4660.
llvm-svn: 79919
2009-08-24 15:23:48 +00:00
Douglas Gregor
84605aeac9
Refactor the template-instantiation logic for expressions into a
...
generic tree transformation (also used for recanonicalization) and a
small amount of template-instantiation-specific logic.
llvm-svn: 79917
2009-08-24 13:43:27 +00:00
Torok Edwin
db7149246f
Fix build of clang with gcc-4.4: #include <cstdio> was missing.
...
llvm-svn: 79916
2009-08-24 13:25:12 +00:00
Anders Carlsson
d7923c6ed7
Add CK_NullToMemberPointer and CK_BaseToDerivedMemberPointer cast kinds. Make -ast-dump print out the cast kinds of cast expressions.
...
llvm-svn: 79787
2009-08-22 23:33:40 +00:00
Douglas Gregor
05155d8d7b
Implement conversion function templates, along with the ability to use
...
template argument deduction from a conversion function (C++
[temp.deduct.conv]) with implicit conversions.
llvm-svn: 79693
2009-08-21 23:19:43 +00:00
Douglas Gregor
5ed5ae476e
Introduce support for constructor templates, which can now be declared
...
and will participate in overload resolution. Unify the instantiation
of CXXMethodDecls and CXXConstructorDecls, which had already gotten
out-of-sync.
llvm-svn: 79658
2009-08-21 18:42:58 +00:00
Daniel Dunbar
6d886b056a
gcc told me to add these.
...
llvm-svn: 79589
2009-08-21 02:43:05 +00:00
Douglas Gregor
97628d6a4c
Implement support for calling member function templates, which involves:
...
- Allowing one to name a member function template within a class
template and on the right-hand side of a member access expression.
- Template argument deduction for calls to member function templates.
- Registering specializations of member function templates (and
finding them later).
llvm-svn: 79581
2009-08-21 00:16:32 +00:00
Eli Friedman
5ae98ee006
Make integer promotions work correctly on PIC16 and other platforms
...
where sizeof(short) == sizeof(int). Move UsualArithmeticConversionsType
out of Sema, since it was only there as a historical artifact. Patch by
Enea Zaffanella.
llvm-svn: 79412
2009-08-19 07:44:53 +00:00
Anders Carlsson
e80ccac2cb
Call MaybeBindToTemporary for overloaded binary and unary operators.
...
llvm-svn: 79173
2009-08-16 04:11:06 +00:00
Anders Carlsson
1c83debc36
Call MaybeBindToTemporary when constructing functino call operator calls.
...
llvm-svn: 79172
2009-08-16 03:53:54 +00:00
Anders Carlsson
8c84c206d9
Add MaybeBindToTemporary calls for member call expressions.
...
llvm-svn: 79171
2009-08-16 03:42:12 +00:00
Anders Carlsson
bc4c107836
Move builtin call checking out into a separate function, make CheckFunctionCall and CheckBlockCall return bool instead. No intended functionality change.
...
llvm-svn: 79157
2009-08-16 01:56:34 +00:00
Anders Carlsson
e827123f08
Make the CXXDefaultArgExpr constructor protected and add a static Create function.
...
llvm-svn: 79013
2009-08-14 18:30:22 +00:00
Anders Carlsson
4f4aab2aeb
Use the correct cast kind as suggested by Doug.
...
llvm-svn: 78395
2009-08-07 18:45:49 +00:00
Fariborz Jahanian
11a8e95a1a
After reporting ill-formed copy constructor(12.8.p3)
...
don't recurs and crash.
llvm-svn: 78323
2009-08-06 17:22:51 +00:00
Douglas Gregor
d806156d54
Support nested-name-specifiers for C++ member access expressions, e.g.,
...
this->Base::foo
from James Porter!
llvm-svn: 78278
2009-08-06 03:17:00 +00:00