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
35d6e3e710
Don't check member and base initializers if the constructor is dependent.
...
llvm-svn: 80211
2009-08-27 05:57:30 +00:00
Anders Carlsson
e0eebb3ee4
Use early returns to avoid indentation.
...
llvm-svn: 80209
2009-08-27 05:45:01 +00:00
Eli Friedman
561154dd6b
Stub out an error so we don't crash.
...
llvm-svn: 80207
2009-08-27 05:09:36 +00:00
Anders Carlsson
574315a0fa
Add a BuildCXXTemporaryObjectExpr and use it so default arguments will be instantiated correctly for temporary object expressions.
...
llvm-svn: 80206
2009-08-27 05:08:22 +00:00
Anders Carlsson
eabf770457
New RequireNonAbstractType function.
...
llvm-svn: 80183
2009-08-27 00:13:57 +00:00
Anders Carlsson
d624e16833
Bye-bye old RequireCompleteType.
...
llvm-svn: 80182
2009-08-26 23:45:07 +00:00
Douglas Gregor
402250f2f9
Implement support for C++ direct initializers that involve dependent
...
types or type-dependent expressions.
llvm-svn: 80143
2009-08-26 21:14:46 +00:00
Anders Carlsson
114056f22c
If a parameter has a default argument expression, make sure to instantiate the parameter type before checking that the expression is a valid initializer.
...
llvm-svn: 79986
2009-08-25 13:46:13 +00:00
Anders Carlsson
10ebe78730
Improved support for default arguments in constructors for class templates.
...
llvm-svn: 79984
2009-08-25 13:07:08 +00:00
Anders Carlsson
c1eb79b7c9
InitializeVarWithConstructor now returns true on failure.
...
llvm-svn: 79976
2009-08-25 05:18:00 +00:00
Anders Carlsson
6eb55575da
BuildCXXConstructExpr now returns an OwningExprResult.
...
llvm-svn: 79975
2009-08-25 05:12:04 +00:00
Anders Carlsson
4562f1f066
Basic support for default argument expressions for function templates.
...
llvm-svn: 79972
2009-08-25 03:18:48 +00:00
Anders Carlsson
c80a127c4d
Factor setting default arguments out into SetParamDefaultArgument.
...
llvm-svn: 79970
2009-08-25 02:29:20 +00:00
Anders Carlsson
5a532380a1
Use hasDefaultArg instead of getDefaultArg.
...
llvm-svn: 79967
2009-08-25 01:23:32 +00:00
Anders Carlsson
f1c2695d48
Check that the default argument is well-formed before checking the initializer types.
...
llvm-svn: 79964
2009-08-25 01:02:06 +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
c8c277a1b3
Make sure to adjust function template declarations to their templated
...
declarations (e.g., FunctionTemplateDecl -> CXXConstructorDecl) before
performing semantic analysis on the declarations. Fixes PR4761.
llvm-svn: 79911
2009-08-24 11:57:43 +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
e5bbb7d4ef
Fix parsing for out-of-line definitions of constructors and
...
destructors of class templates.
llvm-svn: 79678
2009-08-21 22:16:40 +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
Argyrios Kyrtzidis
6032ef1aa3
Remove TypeSpecStartLocation from VarDecl/FunctionDecl/FieldDecl, and use DeclaratorInfo to get this information.
...
llvm-svn: 79584
2009-08-21 00:31:54 +00:00
Douglas Gregor
3447e76762
Initial support for parsing and representation of member function templates.
...
llvm-svn: 79570
2009-08-20 22:52:58 +00:00
John McCall
950aac085d
Add syntax examples for the friend declaration types.
...
Remove an assert trivialized by dominating code.
llvm-svn: 79520
2009-08-20 07:19:42 +00:00
Argyrios Kyrtzidis
c7148c974d
Use Sema's LocInfoType to pass and preserve type source info through the Parser.
...
llvm-svn: 79395
2009-08-19 01:28:28 +00:00
Argyrios Kyrtzidis
60ed560428
Introduce DeclaratorDecl and pass DeclaratorInfo through the Decl/Sema interfaces.
...
DeclaratorDecl contains a DeclaratorInfo* to keep type source info.
Subclasses of DeclaratorDecl are FieldDecl, FunctionDecl, and VarDecl.
EnumConstantDecl still inherits from ValueDecl since it has no need for DeclaratorInfo.
Decl/Sema interfaces accept a DeclaratorInfo as parameter but no DeclaratorInfo is created yet.
llvm-svn: 79392
2009-08-19 01:27:57 +00:00
John McCall
5ed6e8f54c
Teach Sema how to pop out of friend function definitions in nested classes.
...
llvm-svn: 79291
2009-08-18 00:00:49 +00:00
Anders Carlsson
250aada4b9
AddInitializerToDecl can't take a FullExprArg. Make it take an ExprArg, and create the CXXExprWithTemporaries before setting the initializer on the VarDecl.
...
llvm-svn: 79176
2009-08-16 05:13:48 +00:00
Anders Carlsson
f86a8d1030
BuildCXXConstructExpr doesn't need to take an ASTContext.
...
llvm-svn: 79149
2009-08-15 23:41:35 +00:00
Eli Friedman
c96d4963eb
Implement __is_empty. Patch by Sean Hunt.
...
llvm-svn: 79143
2009-08-15 21:55:26 +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
Fariborz Jahanian
4985b33fd7
Patch to force synthesis of copy assignment operator
...
function in the order according to c++03. ir-gen
for copy assignment in the trivial case and the first
test case.
llvm-svn: 78938
2009-08-13 21:09:41 +00:00
Fariborz Jahanian
bbd5e8c2cf
More toward synthesizing copy assignments. SWIP.
...
llvm-svn: 78861
2009-08-12 23:34:46 +00:00
Fariborz Jahanian
de7d4c264a
Patch for synthesizing copy assignment operator.
...
WIP.
llvm-svn: 78841
2009-08-12 21:14:35 +00:00
John McCall
2658c4e2d9
Add a FriendClassDecl type for holding declarations of friend types in
...
the AST, and create such declarations.
llvm-svn: 78719
2009-08-11 21:13:21 +00:00
Fariborz Jahanian
b2197042b8
ir-gen support for anonymous union data member
...
copying in copy constructors and used in
default constructor's initializer list.
llvm-svn: 78700
2009-08-11 18:49:54 +00:00
John McCall
d1e9d835f3
Argument-dependent lookup for friend declarations. Add a new decl type,
...
FriendFunctionDecl, and create instances as appropriate.
The design of FriendFunctionDecl is still somewhat up in the air; you can
befriend arbitrary types of functions --- methods, constructors, etc. ---
and it's not clear that this representation captures that very well.
We'll have a better picture when we start consuming this data in access
control.
llvm-svn: 78653
2009-08-11 06:59:38 +00:00
John McCall
2c5206d22e
Drop the friend-inner-class diagnostic from an extwarn to an ext and don't
...
guard its report on GNUMode.
llvm-svn: 78338
2009-08-06 21:21:21 +00:00
John McCall
93343b9466
Permit a class to friend its members in C++0x, without restriction.
...
Permit a class to friend its class members in C++ 98, as long as extensions
are enabled (and even when they aren't, only give an extwarn about it).
llvm-svn: 78332
2009-08-06 20:49:32 +00:00
John McCall
07e91c04ba
First pass at friend semantics.
...
llvm-svn: 78274
2009-08-06 02:15:43 +00:00
Eli Friedman
44b83eea30
Get rid of "smart" quotes. Per report on cfe-dev.
...
llvm-svn: 78230
2009-08-05 19:21:58 +00:00
Fariborz Jahanian
d460cb4356
Handle destruction of temporaries used in default argument
...
construction of constructor calls.
llvm-svn: 78222
2009-08-05 18:17:32 +00:00
Fariborz Jahanian
aa890bf2f3
Patch to improve ir-gen for constructors with default argument
...
expressions and a test case.
llvm-svn: 78213
2009-08-05 17:03:54 +00:00
Douglas Gregor
2211d345d2
Introduce the canonical type smart pointers, and use them in a few places to
...
tighten up the static type system.
llvm-svn: 78164
2009-08-05 05:36:45 +00:00
Fariborz Jahanian
800f37262c
Support for use of default argument in constructors.
...
work in progress.
llvm-svn: 78132
2009-08-05 00:26:10 +00:00
Mike Stump
12b8ce168d
Canonicalize else.
...
llvm-svn: 78102
2009-08-04 21:02:39 +00:00
Fariborz Jahanian
6782844874
Minor renaming/refactoring. No change in functionality.
...
llvm-svn: 77985
2009-08-03 19:13:25 +00:00
Anders Carlsson
a076d14514
Add CK_DerivedToBase and use it PerformObjectMemberConversion.
...
llvm-svn: 77652
2009-07-31 01:23:52 +00:00
Ted Kremenek
c23c7e6a51
Change uses of:
...
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
Type::getAsRecordType() -> Type::getAs<RecordType>()
Type::getAsPointerType() -> Type::getAs<PointerType>()
Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>()
Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>()
Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>()
Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>()
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
Type::getAsTagType() -> Type::getAs<TagType>()
And remove Type::getAsReferenceType(), etc.
This change is similar to one I made a couple weeks ago, but that was partly
reverted pending some additional design discussion. With Doug's pending smart
pointer changes for Types, it seemed natural to take this approach.
llvm-svn: 77510
2009-07-29 21:53:49 +00:00
Eli Friedman
8e1433b370
Refactor base/member initializers, and construct them correctly in cases
...
with dependent types. Fixes PR4621 and PR4627.
llvm-svn: 77498
2009-07-29 19:44:27 +00:00
Fariborz Jahanian
a5c335527d
More Sema check for constructor's member initializer along
...
with type conversion to fix ir-gen crash.
llvm-svn: 77000
2009-07-24 20:28:49 +00:00
Fariborz Jahanian
ca2f085a4e
Diagnose when base classes and members to be intialized
...
with constructors don't have a matching constructor.
llvm-svn: 76913
2009-07-23 23:32:59 +00:00
Fariborz Jahanian
0228bc1a41
Add constructor used to initialize base/member in
...
CXXBaseOrMemberInitializer AST node. Needed by
its clients to do the initialization.
llvm-svn: 76826
2009-07-23 00:42:24 +00:00
Douglas Gregor
b77af8f4aa
Fix some memory allocation/deallocation issues
...
llvm-svn: 76783
2009-07-22 20:55:49 +00:00
Douglas Gregor
8a27391190
"This patch implements the restrictions on union members detailed in
...
[class.union]p1", from John McCall!
llvm-svn: 76766
2009-07-22 18:25:24 +00:00
Fariborz Jahanian
5c14ec30cd
Allocate BaseOrMemberInitializers and CXXBaseSpecifier nodes
...
via ASTContext.
llvm-svn: 76758
2009-07-22 17:41:53 +00:00
Fariborz Jahanian
aee31ac316
Patch to accomodate Doug's comment on default
...
destruction of base/members for each destructor AST.
llvm-svn: 76663
2009-07-21 22:36:06 +00:00
Eli Friedman
952c15dd52
Misc fixes for -Wreorder:
...
1. Make it work correctly with anonymous unions.
2. Don't compute it if the warning isn't enabled.
3. Optimize the algorithm slightly to make it linear time in the
case where we don't produce any warnings.
llvm-svn: 76630
2009-07-21 19:28:10 +00:00
Ted Kremenek
8a286fbdb9
Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
...
until Doug Gregor's Type smart pointer code lands (or more discussion occurs).
These methods just call the new Type::getAs<XXX> methods, so we still have
reduced implementation redundancy. Having explicit getAsXXXType() methods makes
it easier to set breakpoints in the debugger.
llvm-svn: 76193
2009-07-17 17:50:17 +00:00
Ted Kremenek
b825c0ddc5
Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents.
...
llvm-svn: 76139
2009-07-17 01:20:38 +00:00
Ted Kremenek
3d486f08cb
Replace Type::getAsReferenceType() with Type::getAs<ReferenceType>().
...
llvm-svn: 76132
2009-07-17 01:01:15 +00:00
Ted Kremenek
e3fb4b6524
Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.
...
This method is intended to eventually replace the individual
Type::getAsXXXType<> methods.
The motivation behind this change is twofold:
1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of
them are basically copy-and-paste.
2) By centralizing the implementation of the getAs<Type> logic we can more
smoothly move over to Doug Gregor's proposed canonical type smart pointer
scheme.
Along with this patch:
a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>.
b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>.
llvm-svn: 76098
2009-07-16 19:58:26 +00:00
Fariborz Jahanian
16094c2467
Added ASTs to destructor decl AST for default destruction of object's
...
base/members.
llvm-svn: 75849
2009-07-15 22:34:08 +00:00
Fariborz Jahanian
49c81799b0
Patch to build AST for ctor's initializer list according to
...
semantics of order of construction [class.init].
llvm-svn: 75649
2009-07-14 18:24:21 +00:00
Fariborz Jahanian
3554b5a37c
Patch to build list of inherited virtual base classes
...
in their order of construction for each class and use it
to to check on propery order of base class construction
under -Wreorder option.
llvm-svn: 75270
2009-07-10 20:13:23 +00:00
Fariborz Jahanian
341583c3ac
Sema check on out of order object initialization of
...
class object's base and members under -Wreorder flag.
llvm-svn: 75168
2009-07-09 19:59:47 +00:00
Anders Carlsson
17973e684d
Use getDeclName in DefineImplicitOverloadedAssign as well.
...
llvm-svn: 75152
2009-07-09 17:47:25 +00:00
Anders Carlsson
52b9180587
Pass the DeclName to the diagnostic builder so that member names will be quoted correctly.
...
llvm-svn: 75150
2009-07-09 17:37:12 +00:00
Sebastian Redl
86be854fa8
Implement checking of exception spec compatibility for overriding virtual functions.
...
llvm-svn: 74943
2009-07-07 20:29:57 +00:00
Sebastian Redl
4f4d7b5d8e
Catch function redeclarations with incompatible exception specifications.
...
llvm-svn: 74787
2009-07-04 11:39:00 +00:00
Fariborz Jahanian
9fa077c626
Patch to allocate list of bases in CXXRecordDecl
...
using ASTContxt allocation.
llvm-svn: 74717
2009-07-02 18:26:15 +00:00
Fariborz Jahanian
5c6af0a998
Use Destroy for member initializer list clean up.
...
Per Doug's comments. Doug please review.
llvm-svn: 74666
2009-07-01 23:35:25 +00:00
Fariborz Jahanian
c1fc3ec878
Patch to implement template types in ctor-initializer list.
...
Also has fix for bugzilla-4469.
llvm-svn: 74631
2009-07-01 19:21:19 +00:00
Fariborz Jahanian
302bb6661f
Patch to support optional nested-name-specifier in in ctor-initializer
...
list.
llvm-svn: 74571
2009-06-30 23:26:25 +00:00
Fariborz Jahanian
cae5482f6c
Diagnose multiple initialization of anonymous union
...
fields in the ctor-initializer list.
llvm-svn: 74554
2009-06-30 21:52:59 +00:00
Fariborz Jahanian
7baa71e2dd
More diagnostics related to initialization of direct bases
...
in ctor-initializer list.
llvm-svn: 74541
2009-06-30 17:34:52 +00:00
Fariborz Jahanian
5f12b5386c
Compute ending of iterator in for-loop once.
...
llvm-svn: 74533
2009-06-30 16:36:53 +00:00
Argyrios Kyrtzidis
cfbfe78e9e
De-ASTContext-ify DeclContext.
...
Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating".
Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit.
llvm-svn: 74506
2009-06-30 02:36:12 +00:00
Fariborz Jahanian
e853bfa970
Take care of Chris's comments.
...
llvm-svn: 74486
2009-06-30 00:17:27 +00:00
Fariborz Jahanian
651185bf47
A more detailed diagnosis of ill-formed ctor-initializer
...
list.
llvm-svn: 74480
2009-06-30 00:02:17 +00:00
Fariborz Jahanian
2be8bf44cd
Diagnose multiple initialzation of data-member/base
...
in the ctor-initializer list. More to come.
llvm-svn: 74465
2009-06-29 22:33:26 +00:00
Fariborz Jahanian
3fe6b61b23
Renamed MarcDestructorReferenced -> MarkDestructorReferenced
...
llvm-svn: 74386
2009-06-27 15:05:11 +00:00
Eli Friedman
173e0b7a96
Fix a bogus error overloading an operator where the only class
...
parameter has a dependent type.
llvm-svn: 74380
2009-06-27 05:59:59 +00:00
Anders Carlsson
74d7f0dd65
Make it possible for using decls to point to operators. Fixes PR4441.
...
llvm-svn: 74362
2009-06-27 00:27:47 +00:00
Fariborz Jahanian
24a175b37c
Patch to mark destructors when they are used.
...
llvm-svn: 74359
2009-06-26 23:49:16 +00:00
Fariborz Jahanian
ebe772e2f2
Minor change per Doug's comments.
...
- Fariborz
llvm-svn: 74287
2009-06-26 16:08:57 +00:00
Douglas Gregor
ad3f2fcf43
Improved semantic analysis and AST respresentation for function
...
templates.
For example, this now type-checks (but does not instantiate the body
of deref<int>):
template<typename T> T& deref(T* t) { return *t; }
void test(int *ip) {
int &ir = deref(ip);
}
Specific changes/additions:
* Template argument deduction from a call to a function template.
* Instantiation of a function template specializations (just the
declarations) from the template arguments deduced from a call.
* FunctionTemplateDecls are stored directly in declaration contexts
and found via name lookup (all forms), rather than finding the
FunctionDecl and then realizing it is a template. This is
responsible for most of the churn, since some of the core
declaration matching and lookup code assumes that all functions are
FunctionDecls.
llvm-svn: 74213
2009-06-25 22:08:12 +00:00
Fariborz Jahanian
41f792735f
Patch to diagnose and Mark use of implicit default assignment operator.
...
llvm-svn: 74205
2009-06-25 21:45:19 +00:00
Duncan Sands
323fc2a229
Explicit braces to avoid ambiguous ‘else’.
...
llvm-svn: 74171
2009-06-25 09:03:06 +00:00
Fariborz Jahanian
a83edb0cc1
Some changes to accomodate Doug's comment for
...
implicit copy constructor definition determination.
llvm-svn: 74025
2009-06-23 23:42:10 +00:00
Fariborz Jahanian
477d242a2e
patch to mark use of implicit copy constructors.
...
llvm-svn: 73922
2009-06-22 23:34:40 +00:00
Douglas Gregor
71a5718f2d
Robustify a bunch of C++-related declaration actions.
...
llvm-svn: 73918
2009-06-22 23:20:33 +00:00
Douglas Gregor
77b50e1126
Implement implicit instantiation of the member functions of a class template
...
specialization. At present, all implicit instantiations occur at the
end of the translation unit.
llvm-svn: 73915
2009-06-22 23:06:13 +00:00
Fariborz Jahanian
18eb69af79
Changes made per Doug's comments.
...
llvm-svn: 73897
2009-06-22 20:37:23 +00:00
Fariborz Jahanian
3a36343b88
Remove ImplicitMustBeDefined, use universal 'Used' flag
...
instead. Do the implicit default ctor checking in MarkDeclarationReferenced.
llvm-svn: 73888
2009-06-22 17:30:33 +00:00
Fariborz Jahanian
1c9d5d956c
Made improvements in c++'s object model patch on Doug's review.
...
llvm-svn: 73833
2009-06-20 20:23:38 +00:00
Douglas Gregor
fec52635f0
Parsing and AST support for using declarations, from John Thompson!
...
llvm-svn: 73812
2009-06-20 00:51:54 +00:00
Douglas Gregor
c9c02ed8f4
Keep track of when declarations are "used" according to C and
...
C++. This logic is required to trigger implicit instantiation of
function templates and member functions of class templates, which will
be implemented separately.
This commit includes support for -Wunused-parameter, printing warnings
for named parameters that are not used within a function/Objective-C
method/block. Fixes <rdar://problem/6505209>.
llvm-svn: 73797
2009-06-19 23:52:42 +00:00
Fariborz Jahanian
423a81f259
Patch for implementation of C++'s object model. This is
...
work in progress.
llvm-svn: 73782
2009-06-19 19:55:27 +00:00