Anders Carlsson
27da15ba8e
Move a few more functions away from CGCXX and to CGClass and CGExprCXX.
...
llvm-svn: 92399
2010-01-01 20:29:01 +00:00
Eli Friedman
1e26278b3b
Add a sanity assertion so that we don't silently generate bad code; I'll file
...
a bug with a testcase hitting this assertion in a moment.
llvm-svn: 92175
2009-12-27 07:02:50 +00:00
Eli Friedman
af76ad73ed
Fix obvious mistake.
...
llvm-svn: 92172
2009-12-27 03:44:17 +00:00
Eli Friedman
fddc26cc64
Make copy constructor elimination work in more cases; the case in question
...
here affects clang-on-clang.
llvm-svn: 92151
2009-12-24 23:33:34 +00:00
Anders Carlsson
fb404888af
Move a bunch of class related functions to CGClass.cpp, no functionality change.
...
llvm-svn: 92148
2009-12-24 22:46:43 +00:00
Anders Carlsson
bfb3671b25
Pass the return value slot to all call exprs.
...
llvm-svn: 92145
2009-12-24 21:13:40 +00:00
Anders Carlsson
1749083e2e
Fill in the return value slot in CGExprAgg::VisitCallExpr. This takes us halfway towards fixing PR5824.
...
llvm-svn: 92142
2009-12-24 20:40:36 +00:00
Anders Carlsson
61a401caec
Pass ReturnValueSlot to EmitCall. No functionality change yet.
...
llvm-svn: 92138
2009-12-24 19:25:24 +00:00
Anders Carlsson
0435ed5875
Add a ReturnValueSlot class. Change the argument order in EmitCall to match the other overload better.
...
llvm-svn: 92136
2009-12-24 19:08:58 +00:00
Douglas Gregor
507eb87f05
Eliminate the ASTContext argument to CXXConstructorDecl::isCopyConstructor, since the context is available in the Decl
...
llvm-svn: 91862
2009-12-22 00:34:07 +00:00
Eli Friedman
70724ad2ff
Work in progress for setting the vtable pointers for all bases correctly in
...
the constructor. This doesn't handle cases requiring the VTT at the moment,
and generates unnecessary stores, but I think it's essentially correct.
llvm-svn: 91731
2009-12-18 23:47:41 +00:00
Eli Friedman
303e45750e
Fix for PR5830: fix the computation of the offset to a virtual base.
...
llvm-svn: 91724
2009-12-18 23:27:44 +00:00
Anders Carlsson
28a133d602
CK_UserDefinedConversion is a valid kind when doing copy ctor elision.
...
llvm-svn: 91695
2009-12-18 17:29:21 +00:00
Douglas Gregor
357b6fd3e5
Address some of Anders comments
...
llvm-svn: 91670
2009-12-18 05:19:44 +00:00
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