Douglas Gregor
e1314a64b8
Switch the initialization required by return statements over to the
...
new InitializationSequence. This fixes some bugs (e.g., PR5808),
changed some diagnostics, and caused more churn than expected. What's
new:
- InitializationSequence now has a "C conversion sequence" category
and step kind, which falls back to
- Changed the diagnostics for returns to always have the result type
of the function first and the type of the expression second.
CheckSingleAssignmentConstraints to peform checking in C.
- Improved ASTs for initialization of return values. The ASTs now
capture all of the temporaries we need to create, but
intentionally do not bind the tempoary that is actually returned,
so that it won't get destroyed twice.
- Make sure to perform an (elidable!) copy of the class object that
is returned from a class.
- Fix copy elision in CodeGen to properly see through the
subexpressions that occur with elidable copies.
- Give "new" its own entity kind; as with return values and thrown
objects, we don't bind the expression so we don't call a
destructor for it.
Note that, with this patch, I've broken returning move-only types in
C++0x. We'll fix it later, when we tackle NRVO.
llvm-svn: 91669
2009-12-18 05:02:21 +00:00
Douglas Gregor
4f4b186215
When value-initializing a class with no user-defined constructors but
...
with a non-trivial default constructor, zero-initialize the storage
and then call the default constructor. Fixes PR5800.
llvm-svn: 91548
2009-12-16 18:50:27 +00:00
Eli Friedman
d777cccb47
Don't force the emission of destructor definitions.
...
llvm-svn: 91394
2009-12-15 02:06:15 +00:00
Anders Carlsson
21122cf657
More array cookie improvements.
...
llvm-svn: 91247
2009-12-13 20:04:38 +00:00
Benjamin Kramer
b11118bd0b
Random string-related cleanups.
...
llvm-svn: 91119
2009-12-11 13:33:18 +00:00
Eli Friedman
d5bc94e2eb
Get rid of static variable.
...
llvm-svn: 91041
2009-12-10 02:21:21 +00:00
Anders Carlsson
633c6f6f36
Move more decl related functions to CGDeclCXX.cpp
...
llvm-svn: 91012
2009-12-10 00:30:05 +00:00
Anders Carlsson
bc49cfed84
Add CGDeclCXX.cpp and move EmitCXXGlobalVarDeclInit there.
...
llvm-svn: 91006
2009-12-10 00:16:00 +00:00
Mike Stump
2600491817
Fix spacing.
...
llvm-svn: 91000
2009-12-10 00:05:14 +00:00
Eli Friedman
80888c7b38
Build fix.
...
llvm-svn: 90841
2009-12-08 06:54:20 +00:00
Eli Friedman
bb5008a32a
Fix for PR5707: make sure implicit copy constructors initialize the vtable
...
pointer.
llvm-svn: 90840
2009-12-08 06:46:18 +00:00
Eli Friedman
8aaff69e86
Fix some direct checks of expressions which might be surrounded by parentheses.
...
llvm-svn: 90825
2009-12-08 02:09:46 +00:00
Eli Friedman
cd6a50f3e5
Make copy assignment operator synthesis not explode for classes with complex
...
or non-record aggregate members.
It might be worth spending some time to optimize this code (and the parallel
code for copy constructors) to memcpy in larger chunks, rather than copying
one member at a time. Not sure exactly how beneficial that would be, but
it seems like could help for large classes with, for example, a vtable pointer
forcing the generation of a copy constructor.
llvm-svn: 90823
2009-12-08 01:57:53 +00:00
Eli Friedman
31bc3ad275
A bunch more thunk fixes from misc testing.
...
(Yes, I do intend to commit some tests for this.)
llvm-svn: 90818
2009-12-07 23:56:34 +00:00
Eli Friedman
8174f2c23c
Work-in-progess rewrite of thunks: move thunk generation outside of vtable
...
generation, and make sure we generate thunks when the function is defined
rather than when the vtable is defined.
llvm-svn: 90722
2009-12-06 22:01:30 +00:00
Anders Carlsson
b3f54b748d
CodeGenModule::GenerateVtable now returns a pointer directly to the vtable and not to the address point.
...
llvm-svn: 90676
2009-12-05 21:28:12 +00:00
Anders Carlsson
5a1a84f9fa
Simplify some code.
...
llvm-svn: 90670
2009-12-05 18:38:15 +00:00
Anders Carlsson
ce460529c0
When generating a virtual destructor, don't try to make a virtual call to the base class destructor because then we'll just re-enter the same destructor!
...
This was done to fix PR5619, so I went ahead and passed a dummy VTT pointer for now.
llvm-svn: 90578
2009-12-04 19:33:17 +00:00
Eli Friedman
4039f35344
Fix thunk generation for thunks with a parameter with reference type.
...
llvm-svn: 90412
2009-12-03 04:49:52 +00:00
Eli Friedman
551fe84d0e
Minor cleanup.
...
llvm-svn: 90411
2009-12-03 04:27:05 +00:00
Mike Stump
e2d4a2c3a8
Add support for thunking dtors. Oh why does this make my head hurt?
...
llvm-svn: 90409
2009-12-03 03:47:56 +00:00
Fariborz Jahanian
037bcb5be3
Added an assert.
...
llvm-svn: 90285
2009-12-01 23:35:33 +00:00
Fariborz Jahanian
be64149749
More support for virtual destructor calls.
...
Fixes pr5619
llvm-svn: 90158
2009-11-30 22:07:18 +00:00
Daniel Dunbar
dacbe6bdcd
Don't pass false (default) for isVolatile parameter to CreateStore.
...
llvm-svn: 90094
2009-11-29 21:11:41 +00:00
Anders Carlsson
f942ee0297
Don't build the entire vtable when all we want is the index of a virtual method.
...
llvm-svn: 90017
2009-11-27 20:47:55 +00:00
Eli Friedman
250534cf9a
Fix for PR5594: use EmitGlobalDefinition instead of EmitCXXDestructor so that
...
we check whether the vtable needs to be generated.
llvm-svn: 89984
2009-11-27 01:42:12 +00:00
Eli Friedman
4907c6f2ed
Remove unused variable.
...
llvm-svn: 89945
2009-11-26 07:48:44 +00:00
Eli Friedman
ffc066f4b9
Shortcut explicit calls to a trivial copy assignment operator.
...
llvm-svn: 89944
2009-11-26 07:45:48 +00:00
Eli Friedman
84a7e347bf
Simplify and fix up the handling of implicit constructors, copy assignment
...
operators, and destructors. Avoids generating declarations/definitions of
trivial constructors/destructors, and makes sure the trivial copy assignment
operator is generated when necessary.
llvm-svn: 89943
2009-11-26 07:40:08 +00:00
Anders Carlsson
2f87c4f1a5
Add a CovariantThunkAdjustment struct that represents the adjustments needed for a covariant thunk.
...
llvm-svn: 89933
2009-11-26 03:09:37 +00:00
Anders Carlsson
abe274a8b0
Move the mangler into the CodeGen namespace. Change mangleThunk to take a ThunkAdjustment.
...
llvm-svn: 89930
2009-11-26 02:49:32 +00:00
Anders Carlsson
c778540f9a
Add a ThunkAdjustment struct which holds a non-virtual and a virtual adjustment offset. Start using it. General cleanup in Mangle.cpp.
...
llvm-svn: 89925
2009-11-26 02:32:05 +00:00
Anders Carlsson
82ba57c8f0
Add VTT parameter to base ctors/dtors with virtual bases. (They aren't used yet).
...
llvm-svn: 89835
2009-11-25 03:15:49 +00:00
Anders Carlsson
3c9beab48a
Handle references correctly when synthesizing copy constructors.
...
With this change, the clang-on-clang test result is now
Expected Passes : 224
Unexpected Failures: 37
Which means that we can compile over 80% of clang with clang! :)
llvm-svn: 89799
2009-11-24 21:08:10 +00:00
Anders Carlsson
3a202f601e
Handle cases where we're constructing an array of objects and the constructor has default arguments.
...
llvm-svn: 89783
2009-11-24 18:43:52 +00:00
Anders Carlsson
8c793172c2
Handle base-to-derived casts. Will land test case shortly.
...
llvm-svn: 89678
2009-11-23 17:57:54 +00:00
Daniel Dunbar
e128dd18ab
IRgen: Switch the C++ mangler interfaces to take the SmallVector to write into,
...
instead of requiring clients to make a raw_svector_ostream, which is just an
implementation detail.
llvm-svn: 89548
2009-11-21 09:06:22 +00:00
Daniel Dunbar
ef5d75afeb
Sink free mangle* methods into MangleContext.
...
llvm-svn: 89547
2009-11-21 09:06:10 +00:00
Mike Stump
58ef18b38c
Checkpoint current work. WIP.
...
llvm-svn: 89513
2009-11-20 23:44:51 +00:00
Mike Stump
ea950e249f
Reflow to fit 80-col.
...
llvm-svn: 89222
2009-11-18 18:57:56 +00:00
Eli Friedman
fe81e3fb3c
Refactor emitting call to delete operator into common function EmitDeleteCall.
...
llvm-svn: 89173
2009-11-18 00:50:08 +00:00
Anders Carlsson
dee9a30204
Unify the way destructor epilogues are generated for synthesized and regular destructors. Also fix PR5529.
...
llvm-svn: 89034
2009-11-17 04:44:12 +00:00
Eli Friedman
e85ef718d5
Fix up EmitMemberInitializer to handle many more cases.
...
llvm-svn: 88999
2009-11-16 23:53:01 +00:00
Eli Friedman
5e7d969526
Reorganize EmitMemberInitializer to put anonymous unions on the common codepath.
...
llvm-svn: 88995
2009-11-16 23:34:11 +00:00
Eli Friedman
c1daba3ec8
Make member initializers for union members work correctly.
...
llvm-svn: 88989
2009-11-16 22:58:01 +00:00
Eli Friedman
c2ef215bda
Implement a few more cases for copy constructor synthesis.
...
llvm-svn: 88971
2009-11-16 21:47:41 +00:00
Eli Friedman
e6ce354795
Fix a couple of cases where we weren't generating the right kind of call
...
for a call to a virtual function.
llvm-svn: 88891
2009-11-16 05:31:29 +00:00
Anders Carlsson
d787204e6d
When generating the deleting ctor, emit a call to delete.
...
llvm-svn: 88878
2009-11-15 23:03:25 +00:00
Eli Friedman
b572c92674
PR5483: Generate missing form of destructor when it is virtual. (Someone
...
more familiar with this stuff should double-check that there isn't some more
general rule; this is purely from inspecting g++ output.)
llvm-svn: 88755
2009-11-14 04:19:37 +00:00
Fariborz Jahanian
ebea005812
Code gen. For virtual destructor call on array objects
...
(still part of pr5472).
llvm-svn: 88712
2009-11-13 22:29:45 +00:00
Fariborz Jahanian
6814eaa2cc
Code gen for arrady delete operator. Fixes pr5472.
...
llvm-svn: 88680
2009-11-13 19:27:47 +00:00
Anders Carlsson
fb4dda4fed
Instead of storing CXXMethodDecls in the vtable builder, store GlobalDecls so we can represent both the complete and deleting destructors. Also, when encountering a destructor decl, emit entries for both the complete and deleting destructors. Mike, please review.
...
With this change, FileCheck builds and runs the clang test suite without failures!
llvm-svn: 88663
2009-11-13 17:08:56 +00:00
Anders Carlsson
e828c36933
Add a special BuildVirtualCall that's going to be used for building calls to destructors. This is needed because when compiling:
...
struct A {
virtual ~A();
};
void f(A* a) {
delete a;
}
A's deleting destructor should be called.
llvm-svn: 87083
2009-11-13 04:45:41 +00:00
Anders Carlsson
78cfaa9e56
Fix two bugs with temporaries:
...
1. For
A f() {
return A();
}
we were incorrectly calling the A destructor on the returned object.
2. For
void f(A);
void g() {
A a;
f(a);
}
we were incorrectly not calling the copy constructor.
llvm-svn: 87082
2009-11-13 04:34:45 +00:00
Fariborz Jahanian
03f62ed9bb
Value initialize non-class array members in ctor's
...
initializer list. Fixes PR5463.
llvm-svn: 86849
2009-11-11 17:55:25 +00:00
Fariborz Jahanian
e6c8112572
Avoid generating additional destructor(s) for initialized constructed
...
objects.
llvm-svn: 86778
2009-11-11 01:13:34 +00:00
Fariborz Jahanian
1254a0978c
This patch implements Code gen. for destruction of
...
global array of objects.
llvm-svn: 86701
2009-11-10 19:24:06 +00:00
Mike Stump
d846d0825b
Add vtable caching to prevent multiple vtables for the same class from
...
being generated.
Add the most derived vtable pointer to the VTT.
llvm-svn: 86671
2009-11-10 07:44:33 +00:00
Eli Friedman
d7686ef31c
Unify the codepaths used to verify base and member initializers for explicitly
...
and implicitly defined constructors. This has a number of benefits:
1. Less code.
2. Explicit and implicit constructors get the same diagnostics.
3. The AST explicitly contains constructor calls from implicit default
constructors. This allows handing some cases that previously weren't handled
correctly in IRGen without any additional code. Specifically, implicit default
constructors containing calls to constructors with default arguments are now
handled correctly.
llvm-svn: 86500
2009-11-09 01:05:47 +00:00
Fariborz Jahanian
c2d71b531c
This patch fixes code gen. part of pr5333 (Conversion
...
using elipsis conversion).
llvm-svn: 86276
2009-11-06 18:47:57 +00:00
Anders Carlsson
5852b13827
If a member initializer create temporaries we need to destroy them. Fixes PR5077.
...
llvm-svn: 86225
2009-11-06 04:11:09 +00:00
Anders Carlsson
a7cb98b202
More cleanup.
...
llvm-svn: 86224
2009-11-06 03:23:06 +00:00
Mike Stump
c550768a11
References can't be zero; omit zero check for return value adjustments
...
in covariant thunks that return references.
llvm-svn: 86121
2009-11-05 06:32:02 +00:00
Mike Stump
b8da7a046d
Refine covariant return value adjustments for thunks when null
...
pointers are returned.
llvm-svn: 86120
2009-11-05 06:12:26 +00:00
Fariborz Jahanian
18bc195473
Add code gen for pointer-to-member function in
...
ctor's initializer. Fixes pr5178.
llvm-svn: 86040
2009-11-04 19:13:37 +00:00
Douglas Gregor
615ac67fb8
Store the unresolved class type in MemberPointerType's Class field,
...
from Peter Collingbourne!
llvm-svn: 86030
2009-11-04 16:49:01 +00:00
Mike Stump
b9c9b351e9
Fix 80-col violations.
...
llvm-svn: 85990
2009-11-04 01:11:15 +00:00
Mike Stump
71609a2874
Split out return adjustments in thunks from this adjustment in thunks
...
so the optimizer can tailcall into the return value adjustment thunk.
This improves codesize for complex hierarchies.
llvm-svn: 85988
2009-11-04 00:53:51 +00:00
Mike Stump
8117848174
Misc cleanups.
...
llvm-svn: 85978
2009-11-03 23:50:34 +00:00
Mike Stump
53f9ded62b
Refine volatile handling, specifically, we must have the canonical
...
type to look at the volatile specifier. I found these all from just
hand auditing the code.
llvm-svn: 85967
2009-11-03 23:25:48 +00:00
Mike Stump
77738205e6
Refine return value adjustments for thunks.
...
llvm-svn: 85905
2009-11-03 16:59:27 +00:00
Mike Stump
92e5f8cb39
Refine codegen for non-virtual this adjustments for thunks.
...
llvm-svn: 85856
2009-11-03 03:16:46 +00:00
Mike Stump
f358972fdc
Add virtual adjustments for this for thunks.
...
llvm-svn: 85852
2009-11-03 02:12:59 +00:00
Mike Stump
31e1d43729
Add basic codegen for thunks that return values.
...
llvm-svn: 85842
2009-11-02 23:47:45 +00:00
Mike Stump
33ccd9e354
Refine codegen for thunks.
...
llvm-svn: 85839
2009-11-02 23:22:01 +00:00
Fariborz Jahanian
29baa2b1ba
Minor cleanup.
...
llvm-svn: 85434
2009-10-28 21:07:28 +00:00
Fariborz Jahanian
f1639fffbc
Code gen for array construction - WIP
...
llvm-svn: 85432
2009-10-28 20:55:41 +00:00
Fariborz Jahanian
e4d94cee05
Code-gen for CXXZeroInitValueExpr AST passed
...
as argument to a function call. Removes a FIXME.
llvm-svn: 84694
2009-10-20 23:29:04 +00:00
Fariborz Jahanian
da21efb566
Implement derived-to-base AST/code gen. There is a
...
FIXME in CGCXX.cpp that I would like Anders to
take a look at.
llvm-svn: 84265
2009-10-16 19:20:59 +00:00
Anders Carlsson
6bfee8f3e3
Don't assume that the LHS and RHS of a member pointer expression is a DeclRefExpr. Fixes PR5177.
...
llvm-svn: 83986
2009-10-13 17:41:28 +00:00
Anders Carlsson
a1b54fdbe1
Even more devirtualization cleverness.
...
llvm-svn: 83886
2009-10-12 19:59:15 +00:00
Anders Carlsson
2a01709204
More devirtualization improvements.
...
llvm-svn: 83883
2009-10-12 19:51:33 +00:00
Anders Carlsson
b61301f353
Devirtualize calls on temporaries. A().f() for example.
...
llvm-svn: 83882
2009-10-12 19:45:47 +00:00
Anders Carlsson
d7432dfb0a
Factor out devirtualization checking into a separate function and make it handle references correctly.
...
llvm-svn: 83880
2009-10-12 19:41:04 +00:00
Anders Carlsson
b5296558f1
If the base type of a member call is a record type we don't need to emit a virtual call.
...
llvm-svn: 83816
2009-10-11 23:55:52 +00:00
Anders Carlsson
2bb27f53e0
Move the vtable builder to CGVtable.cpp, general cleanup.
...
llvm-svn: 83798
2009-10-11 22:13:54 +00:00
Anders Carlsson
2295f31810
Change mangleCXXVtable and mangleCXXRtti to take CXXRecordDecls instead of QualTypes.
...
llvm-svn: 83793
2009-10-11 21:24:51 +00:00
Anders Carlsson
6ce51fdf43
Move our (non-existing) RTTI emission code into CGRtti.cpp. No functionality change.
...
llvm-svn: 83732
2009-10-10 20:49:04 +00:00
Mike Stump
0d479e6653
Avoid warning.
...
llvm-svn: 83609
2009-10-09 01:25:47 +00:00
Anders Carlsson
ff971e8bf4
Add a MangleContext and pass it to all mangle functions. It will be used for keeping state, such as identifiers assigned to anonymous structs as well as scope encoding.
...
llvm-svn: 83442
2009-10-07 01:06:45 +00:00
Anders Carlsson
b703fd2216
Uncomment some commented out code.
...
llvm-svn: 83428
2009-10-06 23:02:00 +00:00
Anders Carlsson
c6d171ec77
Change GetAddressCXXOfBaseClass to use CXXBasePaths for calculating base class offsets. Fix the code to handle virtual bases as well.
...
llvm-svn: 83426
2009-10-06 22:43:30 +00:00
Anders Carlsson
80ef6f1a46
Pass the right type to GetAddrOfFunction when getting functions for the VTable. Fixes PR5021.
...
llvm-svn: 83395
2009-10-06 17:54:23 +00:00
Anders Carlsson
2ee3c011d9
Implement code generation of member function pointer calls. Fixes PR5121.
...
llvm-svn: 83271
2009-10-03 19:43:08 +00:00
Anders Carlsson
32bfb1ce8f
Move some functions from CodeGenFunctions to CodeGenModule so they can be used by CGExprConstant.
...
llvm-svn: 83263
2009-10-03 14:56:57 +00:00
Anders Carlsson
8f4fd60c47
Handle CXXMemberCallExprs that point to a static method. Fixes PR5093.
...
llvm-svn: 83045
2009-09-29 03:54:11 +00:00
Mike Stump
e7a2b48572
Fix http://llvm.org/PR5090 .
...
llvm-svn: 83035
2009-09-29 00:50:50 +00:00
Anders Carlsson
52d78a518a
CodeGen for try statements. (We just emit the body for now).
...
llvm-svn: 82910
2009-09-27 18:58:34 +00:00
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
Anders Carlsson
d49844b715
Add a new variant of EmitCXXAggrConstructorCall that takes a Value that holds the number of elements to construct, to be used when implementing new[].
...
llvm-svn: 82602
2009-09-23 02:45:36 +00:00
Anders Carlsson
cc52f65500
Move codegen of new and delete to CGCXXExpr.cpp
...
llvm-svn: 82585
2009-09-22 22:53:17 +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
Mike Stump
f9c95be2f6
Generate more of the vbase virtual offset for covariant thunks. WIP.
...
llvm-svn: 82253
2009-09-18 19:06:35 +00:00
Anders Carlsson
ddf57d3df9
Remove an unnecessary FunctionDecl parameter to the synthesizing functions.
...
llvm-svn: 81759
2009-09-14 05:32:02 +00:00
Anders Carlsson
8783737029
Handle delete where the class has a virtual destructor.
...
llvm-svn: 81733
2009-09-14 00:16:25 +00:00
Anders Carlsson
864d525533
Rename AddressCXXOfBaseClass to GetAddressCXXOfBaseClass. Add a NullCheckValue argument (currently unused).
...
llvm-svn: 81606
2009-09-12 04:26:35 +00:00
Anders Carlsson
307408d2af
Add CGCXXClass.cpp. and move CodeGenFunction::AddressCXXOfBaseClass there.
...
llvm-svn: 81604
2009-09-12 03:29:09 +00:00
Anders Carlsson
97c7eda14a
Fix a crash when generating vtables that contain destructors.
...
llvm-svn: 81587
2009-09-12 00:00:29 +00:00
Mike Stump
80f6ac5a4f
Add basic covariant thunk generation support. WIP.
...
llvm-svn: 81585
2009-09-11 23:25:56 +00:00
Anders Carlsson
73fcc95f0f
Pass GlobalDecls to GenerateCode and StartFunction.
...
llvm-svn: 81485
2009-09-11 00:07:24 +00:00
Anders Carlsson
ecf9bf0158
GlobalDecl doesn't have an explicit constructor anymore.
...
llvm-svn: 81481
2009-09-10 23:43:36 +00:00
Anders Carlsson
1ca52689e7
Use the right GlobalDecl type for destructors.
...
llvm-svn: 81398
2009-09-09 23:17:18 +00:00
Anders Carlsson
e9766d559b
If a cast expression needs either a conversion function or a constructor to be called, generate implicit child expressions that call them.
...
llvm-svn: 81383
2009-09-09 21:33:21 +00:00
Mike Stump
11289f4280
Remove tabs, and whitespace cleanups.
...
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Mike Stump
e73d5ca9a8
Refine vcall offsets. Cleanups. WIP.
...
llvm-svn: 81143
2009-09-07 04:27:52 +00:00
Mike Stump
b82db12b35
Refine overrides and thunks for virtual bases. Cleanups. WIP.
...
llvm-svn: 81080
2009-09-05 11:28:33 +00:00
Mike Stump
c9eb1727db
Cleanup.
...
llvm-svn: 81078
2009-09-05 09:24:43 +00:00
Mike Stump
69bbd6ce84
Cleanups.
...
llvm-svn: 81077
2009-09-05 09:10:58 +00:00
Mike Stump
6363021ab9
Cleanups.
...
llvm-svn: 81075
2009-09-05 08:47:24 +00:00
Mike Stump
3cdb051425
Cleanups.
...
llvm-svn: 81074
2009-09-05 08:45:02 +00:00
Mike Stump
5e3ac0249c
Cleanups.
...
llvm-svn: 81073
2009-09-05 08:40:18 +00:00
Mike Stump
ea8eea2c45
Cleanups.
...
llvm-svn: 81072
2009-09-05 08:37:03 +00:00
Mike Stump
db14a73606
Cleanups.
...
llvm-svn: 81071
2009-09-05 08:07:32 +00:00
Mike Stump
001ad31c9a
Cleanups. WIP.
...
llvm-svn: 81069
2009-09-05 07:49:12 +00:00
Mike Stump
453fe4285d
Install thunks later to fixup overrides. Track space taken by vbase
...
offsets better for thunk refinements. Cleanups. WIP.
llvm-svn: 81067
2009-09-05 07:20:32 +00:00
Douglas Gregor
d94105a1c2
Don't generate any code for an explicit call to a trivial destructor.
...
Now that parsing, semantic analysis, and (I think) code generation of
pseudo-destructor expressions and explicit destructor calls works,
update the example-dynarray.cpp test to destroy the objects it
allocates and update the test to actually compile + link.
The code seems correct, but the Clang-compiled version dies with a
malloc error. Time to debug!
llvm-svn: 81025
2009-09-04 19:04:08 +00:00
Mike Stump
5a522353c3
Add overidding for methods for vtable building for the secondary
...
vtables. Add thunk generation. WIP.
llvm-svn: 81014
2009-09-04 18:27:16 +00:00
Anders Carlsson
35dca26835
Fix an assertion when initializing a union using a member initializer. (We weren't casting from the union type to the initializer type correctly).
...
llvm-svn: 80837
2009-09-02 21:14:47 +00:00
Mike Stump
2348e62498
More overriding base work and some cleanups. WIP.
...
llvm-svn: 80737
2009-09-01 23:22:44 +00:00
Mike Stump
40dc64bcfc
Split out overriding. WIP.
...
llvm-svn: 80732
2009-09-01 22:20:28 +00:00
Anders Carlsson
783ab50b33
Assert that we don't have any virtual bases. We can emit dtors for polymorphics classes just fune.
...
llvm-svn: 80722
2009-09-01 21:12:16 +00:00
Anders Carlsson
6b8b4b459d
We can generate constructors/destructors with base classes and non-trivial fields just fine now.
...
llvm-svn: 80701
2009-09-01 18:33:46 +00:00
Douglas Gregor
96ee789d33
Rename CXXQualifiedMemberExpr -> CXXAdornedMemberExpr, since we will
...
also be adding explicit template arguments as an additional
"adornment". No functionality change.
llvm-svn: 80628
2009-08-31 21:41:48 +00:00
Eli Friedman
033e8d4ae6
Make IRGen for initializing a member reference work correctly.
...
llvm-svn: 80439
2009-08-29 20:58:20 +00:00
Mike Stump
beefdc8948
iGenerate vcalls as we build up the methods. WIP.
...
llvm-svn: 80405
2009-08-28 23:22:54 +00:00
Fariborz Jahanian
8b899e4247
ir-gen related patch for type conversion
...
with class type conversion methods. WIP.
llvm-svn: 80365
2009-08-28 15:11:24 +00:00
Mike Stump
a0d0e6fcb1
Fixup codegen for static dispatch to a virtual function that was
...
almost correct. :-)
llvm-svn: 80181
2009-08-26 23:38:08 +00:00
Fariborz Jahanian
c71f094c08
ir-gen for type convesion of class objects. WIP.
...
llvm-svn: 80178
2009-08-26 23:31:30 +00:00
Douglas Gregor
c190523d7a
When a member reference expression includes a qualifier on the member
...
name, e.g.,
x->Base::f()
retain the qualifier (and its source range information) in a new
subclass of MemberExpr called CXXQualifiedMemberExpr. Provide
construction, transformation, profiling, printing, etc., for this new
expression type.
When a virtual function is called via a qualified name, don't emit a
virtual call. Instead, call that function directly. Mike, could you
add a CodeGen test for this, too?
llvm-svn: 80167
2009-08-26 22:36:53 +00:00
Mike Stump
a5588bf3ac
Implement virtual dispatch. :-) This is self-consistent with clang,
...
but not yet necessarily perfectly consistent with gcc. Also addressed
Doug and John's comments.
llvm-svn: 80137
2009-08-26 20:46:33 +00:00
Anders Carlsson
458055a890
Revert r80064 since it broke the build.
...
llvm-svn: 80066
2009-08-26 03:30:14 +00:00
Mike Stump
fbddfdacdc
Implement virtual dispatch. :-) This is self-consistent with clang, but not yet
...
necessarily perfectly consistent with gcc.
llvm-svn: 80064
2009-08-26 01:54:35 +00:00
Fariborz Jahanian
2c73b1d2a2
Simplified default construction of array data members
...
in the constructor prologue.
llvm-svn: 80060
2009-08-26 00:23:27 +00:00
Anders Carlsson
9cedbefb24
Add a -fno-elide-constructors option to clang-cc.
...
llvm-svn: 79782
2009-08-22 22:30:33 +00:00
Mike Stump
0b8c5ae7af
Calculate the address point for a vtable better, and start fleshing out the vcall
...
calculations better.
llvm-svn: 79687
2009-08-21 23:09:30 +00:00
Fariborz Jahanian
8adc973483
Patch to ir-gen copy assigning array members when synthesizing
...
a copy assignment operator function.
llvm-svn: 79681
2009-08-21 22:34:55 +00:00
Fariborz Jahanian
5626384384
Patch to provide ir-gen support in copying array members
...
when synthesizing a copy constructor. Arrays's base element
may have a trivial or non-trivial copy constructor.
llvm-svn: 79653
2009-08-21 18:30:26 +00:00
Fariborz Jahanian
7481bd88bb
Array member construction in prologue of user-declared
...
constructors.
llvm-svn: 79640
2009-08-21 17:09:38 +00:00
Fariborz Jahanian
6c9e5a2b9e
Introduce getConstantArrayElementCount API and use it in
...
construction/destruction of array members.
llvm-svn: 79637
2009-08-21 16:31:06 +00:00
Mike Stump
a002945a20
We now support overriding base functions in vtables. WIP.
...
llvm-svn: 79587
2009-08-21 01:45:00 +00:00
Fariborz Jahanian
1a606ab12a
Patch to ir-gen destruction of array member elements in revers order
...
of their construction.
llvm-svn: 79571
2009-08-20 23:02:58 +00:00
Fariborz Jahanian
9c83720d17
ir-gen patch to destruct array members. WIP.
...
llvm-svn: 79565
2009-08-20 20:54:15 +00:00
Mike Stump
cae6178b3b
Refine vbase offsets for the inductive case. Things are now starting
...
to come together nicely. Still a WIP.
llvm-svn: 79521
2009-08-20 07:22:17 +00:00
Mike Stump
2220447adc
Ensure we don't output repeated vbase offsets. I have a testcase for
...
this, but need to fixup the actual offset value before I can check it
in. WIP.
llvm-svn: 79506
2009-08-20 02:11:48 +00:00
Fariborz Jahanian
dd46eb770f
Test case for my last patch plus a minor clean up.
...
llvm-svn: 79500
2009-08-20 01:01:06 +00:00
Fariborz Jahanian
eeb0e57247
ir-gen for multi-dimensional array construction. WIP.
...
llvm-svn: 79497
2009-08-20 00:15:15 +00:00
Fariborz Jahanian
a8fe2c26a8
Removed unneeded code for break/continue statements in
...
manufactured for-loop per Anders feedback (thanks).
- Fariborz
llvm-svn: 79466
2009-08-19 21:10:38 +00:00
Fariborz Jahanian
431c883287
ir-gen for constructing arrays as non-static data members. WIP.
...
llvm-svn: 79464
2009-08-19 20:55:16 +00:00
Daniel Dunbar
58bc48c14e
Switch to SmallString::str from SmallString::c_str.
...
- Several FIXMEs due to non-Twinification of IRBuilder.
llvm-svn: 79455
2009-08-19 20:04:03 +00:00
Mike Stump
3bc0a3bf7d
One second thought, I think I want to limit this class to just vtable
...
building activities.
llvm-svn: 79438
2009-08-19 18:10:47 +00:00
Mike Stump
b386941208
Cleanup: fold IndirectPrimary into builder.
...
llvm-svn: 79423
2009-08-19 14:40:47 +00:00
Mike Stump
3b09f004db
We don't want to confuse this layout with the BLayout from the builder.
...
llvm-svn: 79422
2009-08-19 14:06:50 +00:00
Mike Stump
984c99d190
Restore vbase offsets for classes without a primary.
...
llvm-svn: 79402
2009-08-19 02:53:08 +00:00
Mike Stump
583ef62149
Refine vcalls a little.
...
llvm-svn: 79400
2009-08-19 02:06:38 +00:00
Mike Stump
6fe6ca11da
Cleanup.
...
llvm-svn: 79374
2009-08-18 22:04:08 +00:00
Mike Stump
07347353a0
Cleanups. Move GenerateRtti to CodeGenModule.
...
llvm-svn: 79372
2009-08-18 21:49:00 +00:00
Mike Stump
ee81dca8c7
Move the rest of the vtable building code into the new builder.
...
llvm-svn: 79370
2009-08-18 21:30:21 +00:00
Mike Stump
1f18b9a301
Suck up method generation.
...
llvm-svn: 79367
2009-08-18 21:03:28 +00:00
Mike Stump
5cb34077ef
Split out vtable bulding code into a builder.
...
llvm-svn: 79366
2009-08-18 20:50:28 +00:00
Fariborz Jahanian
d172e91f2a
Patch to 1) synthesizing non-trivial default destructor when
...
one is not provided by user. 2) More complete
emission of ctor prologue when it has no initializer
list or when it is synthesized.
llvm-svn: 79269
2009-08-17 19:04:50 +00:00
Anders Carlsson
49033712e4
Remove an ErrorUnsupported call.
...
llvm-svn: 79261
2009-08-17 18:24:57 +00:00
Anders Carlsson
81f0df9601
Improve handling of delete expressions.
...
llvm-svn: 79205
2009-08-16 21:13:42 +00:00
Mike Stump
22ea1f8a30
Cleanups and fixups for calculating the virtual base offsets. WIP.
...
llvm-svn: 79156
2009-08-16 01:46:26 +00:00
Fariborz Jahanian
0aed0225b4
Improved on ir-gen for synthesis of non-trivial default
...
constructor body whose class has non-static data-members which
required non-trivial construction.
llvm-svn: 79125
2009-08-15 18:55:17 +00:00
Fariborz Jahanian
42af5ba7b7
ir-gen for generation of trvial copy constructor
...
call.
llvm-svn: 79034
2009-08-14 20:11:43 +00:00
Mike Stump
bcf756cbac
Deconflate virtual base offsets from non-virtual base offsets.
...
Deconflate a virtual base primary from a non-virtual base.
llvm-svn: 78971
2009-08-14 01:44:03 +00:00
Fariborz Jahanian
92b3f47de2
Fixed a bug in ir-gen for copy assignment synthesis.
...
Fixed a bug when evaluating those copy-assignments
which need by lazily syntheized. A test case
for these.
llvm-svn: 78965
2009-08-14 00:01:54 +00:00
Mike Stump
c2f591b1e6
Refine vtable layout for virtual bases and keep better track of
...
primaries. WIP.
llvm-svn: 78950
2009-08-13 22:53:07 +00:00
Owen Anderson
41a750271b
Update for LLVM API change.
...
llvm-svn: 78946
2009-08-13 21:57:51 +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
Mike Stump
2631d8c517
Minor cleanups.
...
llvm-svn: 78927
2009-08-13 18:39:54 +00:00
Mike Stump
1300754fdd
Prep for vbase layout refinements. WIP.
...
llvm-svn: 78882
2009-08-13 02:02:14 +00:00
Fariborz Jahanian
9b630c3040
Minor refactoring of copy assign operator ir-gen. SWIP.
...
llvm-svn: 78875
2009-08-13 00:53:36 +00:00
Fariborz Jahanian
bbd5e8c2cf
More toward synthesizing copy assignments. SWIP.
...
llvm-svn: 78861
2009-08-12 23:34:46 +00:00
Mike Stump
b661738203
Cleanup.
...
llvm-svn: 78858
2009-08-12 23:25:18 +00:00
Mike Stump
938f15b033
Refactor. WIP. Eventually, this will all go into a vtable builder class.
...
llvm-svn: 78857
2009-08-12 23:14:12 +00:00
Mike Stump
480212253a
Cleanup.
...
llvm-svn: 78855
2009-08-12 23:03:28 +00:00
Mike Stump
82165efbc4
Refactor.
...
llvm-svn: 78854
2009-08-12 23:00:59 +00:00
Mike Stump
dc94d3fd27
Refactor.
...
llvm-svn: 78851
2009-08-12 22:34:12 +00:00
Fariborz Jahanian
de7d4c264a
Patch for synthesizing copy assignment operator.
...
WIP.
llvm-svn: 78841
2009-08-12 21:14:35 +00:00
Mike Stump
9deb22b850
Improve the secondary vtables to not include vbase offsets. WIP.
...
llvm-svn: 78831
2009-08-12 18:50:26 +00:00
Mike Stump
cecfe61cd1
Refine vtable building for the secondary vtables to exclude yet more
...
cases where a virtual base was already used as a primary base class.
WIP.
llvm-svn: 78820
2009-08-12 17:42: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
Mike Stump
78696a70bf
Implement more of the inductive case for vtable layout involving
...
virtual base primaries and improve the layout of classes with virtual
bases. WIP.
Hey, I've decided I want a change to FileCheck, I need to ensure that
the group is together, nothing in between. Can we change it to check
the match line is from the line immediately following the last matched
line, if the source for the matched line is immediately after the
source for the previously matched line?
// CHECK: 1
// CHECK: 2
// CHECK: 3
// CHECK: 4
// CHECK: 5
// CHECK: 6
would require 1 2 and 3 to be continuous in the output, and 4 5 and 6
to be continuous.
llvm-svn: 78638
2009-08-11 04:03:59 +00:00
Fariborz Jahanian
296584b2a9
Support for anonymous union in ctor's initializer and
...
bunch of FIXMEs for their is-gen.
llvm-svn: 78623
2009-08-10 23:56:17 +00:00
Fariborz Jahanian
9d3405ceab
minor refactoring. No change otherwise.
...
llvm-svn: 78582
2009-08-10 18:46:38 +00:00
Fariborz Jahanian
7cc52cf09f
ir-gen for generating copying of scalar data members in
...
a synthesized copy constructor.
llvm-svn: 78580
2009-08-10 18:34:26 +00:00
Fariborz Jahanian
2a26e351fc
Fixed a ir-gen bug in synthesizing copy constructors.
...
llvm-svn: 78570
2009-08-10 17:20:45 +00:00
Benjamin Kramer
b57e5d2f4f
Older GCCs don't have vector::data().
...
llvm-svn: 78519
2009-08-08 23:43:26 +00:00
Fariborz Jahanian
24f38969d5
ir-gen for initialization, in synthesize copy constructor,
...
of base/field which have trivial copy constructor.
llvm-svn: 78516
2009-08-08 23:32:22 +00:00