Anders Carlsson
90235beb55
DefineImplicitCopyConstructor now uses SetBaseOrMemberInitializers to create implicit base initializers. (Member initializers are still handled by CodeGenFunction::SynthesizeCXXCopyConstructor for now).
...
llvm-svn: 102279
2010-04-24 22:25:18 +00:00
Anders Carlsson
bea9e74e82
Rename GetAddressOfBaseClass to OldGetAddressOfBaseClass.
...
llvm-svn: 102275
2010-04-24 21:51:08 +00:00
Anders Carlsson
795213efde
Get rid of the old GetNonVirtualBaseClassOffset and change all call sites to use the new version.
...
llvm-svn: 102274
2010-04-24 21:27:51 +00:00
Anders Carlsson
8a64c1c94c
Change CodeGenFunction::GetAddressOfDerivedClass to take a BasePath.
...
llvm-svn: 102273
2010-04-24 21:23:59 +00:00
Anders Carlsson
c6eaea70af
Convert more call sites over to the new GetAddressOfBaseClass.
...
llvm-svn: 102272
2010-04-24 21:12:55 +00:00
Anders Carlsson
d829a02514
Add a new GetAddressOfBaseClass overload that takes a base path and. Use it for derived-to-base casts.
...
llvm-svn: 102270
2010-04-24 21:06:20 +00:00
Anders Carlsson
34f54d55e2
Comment out an assert for now.
...
llvm-svn: 102007
2010-04-21 18:03:05 +00:00
Anders Carlsson
91baecfeb3
Back out r101911 and see if it makes the bots happy.
...
llvm-svn: 101921
2010-04-20 18:05:10 +00:00
Anders Carlsson
6a0227df49
Fix a bug which triggered the assertion I added yesterday. Basically, when we initialize the vtable pointer for a virtual base, and there was another path from the most derived class to another base with the same class type, we would use the wrong base.
...
llvm-svn: 101911
2010-04-20 16:22:16 +00:00
Anders Carlsson
53cebd1ea6
Move code to apply a non-virtual and virtual offset out into a separate function.
...
llvm-svn: 101909
2010-04-20 16:03:35 +00:00
Anders Carlsson
652758c3ec
Pass the nearest virtual base decl to InitializeVTablePointers. No functionality change right now.
...
llvm-svn: 101872
2010-04-20 05:22:15 +00:00
Anders Carlsson
3d4218570a
Assert that the path from the derived to the base class in CodeGenFunction::GetAddressOfBaseClass is not ambiguous.
...
llvm-svn: 101869
2010-04-20 05:07:22 +00:00
Douglas Gregor
c4df407604
Keep track of the actual storage specifier written on a variable or
...
function declaration, since it may end up being changed (e.g.,
"extern" can become "static" if a prior declaration was static). Patch
by Enea Zaffanella and Paolo Bolzoni.
llvm-svn: 101826
2010-04-19 22:54:31 +00:00
Anders Carlsson
1c0f8bb4ce
Have the CXXBaseOrMemberInitializer keep track of whether an initializer initializes a virtual base or not.
...
llvm-svn: 101004
2010-04-12 00:51:03 +00:00
Rafael Espindola
c50c27cca8
the big refactoring bits of PR3782.
...
This introduces FunctionType::ExtInfo to hold the calling convention and the
noreturn attribute. The next patch will extend it to include the regparm
attribute and fix the bug.
llvm-svn: 99920
2010-03-30 20:24:48 +00:00
Anders Carlsson
f141dd1b95
Remove the old vtable layout code.
...
llvm-svn: 99869
2010-03-30 03:43:47 +00:00
Anders Carlsson
9d08fc1cd2
Use the new function in EmitClassAggrMemberwiseCopy, fixing the same assert as seen in PR6628 but for arrays this time.
...
llvm-svn: 99867
2010-03-30 03:30:08 +00:00
Anders Carlsson
093bdff0c5
Factor emitting a call to a copy constructor out into a separate function.
...
llvm-svn: 99866
2010-03-30 03:27:09 +00:00
Anders Carlsson
b9fd57f198
Introduce a CXXTemporariesCleanupScope RAII object and use it to cleanup the temporaries code.
...
llvm-svn: 99865
2010-03-30 03:14:41 +00:00
Anders Carlsson
10834b8d56
Handle default arguments when calling copy constructors for bases or members when synthesizing a copy constructor. Fixes PR6628.
...
llvm-svn: 99864
2010-03-30 02:57:48 +00:00
Anders Carlsson
383f4cc8b9
Flip the switch to always get vtables from the VTT when necessary, I've verified that clang bootstraps with this.
...
llvm-svn: 99800
2010-03-29 02:38:51 +00:00
Anders Carlsson
f6f24c609b
Cleanup, no functionality change.
...
llvm-svn: 99798
2010-03-29 02:08:26 +00:00
Anders Carlsson
948d3f4ec6
Fix another thinko, so that flags don't depend on previous bases.
...
llvm-svn: 99791
2010-03-29 01:16:41 +00:00
Anders Carlsson
74d7dfcf8e
When generating base ctors/dtors, we need to lookup virtual bases using the vtable.
...
llvm-svn: 99790
2010-03-29 01:14:25 +00:00
Anders Carlsson
5889027ccc
Use construction vtables when needed. This is currently guarded by -fdump-vtable-layouts since it doesn't work 100% yet :)
...
llvm-svn: 99787
2010-03-29 01:08:49 +00:00
Anders Carlsson
d589593c93
Reapply r99775 with a fix for a silly bug - we were setting the vtable pointer for all bases, even those without a vtable pointer :)
...
llvm-svn: 99777
2010-03-28 21:07:49 +00:00
Anders Carlsson
fcc9f91287
Looks like I broke self-host again :(.
...
llvm-svn: 99776
2010-03-28 20:55:21 +00:00
Anders Carlsson
74eab715ae
More improvements to setting the vtable pointer. We now no longer set the vtable pointer for non-virtual primary bases. We also do a pre-order traversal of the class hierarchy; this is necessary in order to get the right vbase offset offsets in base ctors/dtors.
...
llvm-svn: 99775
2010-03-28 20:34:31 +00:00
Anders Carlsson
e87fae9afa
Factor vtable pointer setting code out into a separate function.
...
llvm-svn: 99773
2010-03-28 19:40:00 +00:00
Anders Carlsson
aaf8acfea1
Revert r99612 and see if it fixes self-host.
...
llvm-svn: 99614
2010-03-26 06:35:42 +00:00
Anders Carlsson
6fffc64dd2
Don't initialize virtual pointers for primary bases, they've already been initialized.
...
llvm-svn: 99612
2010-03-26 05:53:12 +00:00
Anders Carlsson
1f9348c1fc
Simplify InitializeVtablePtrs in preparation of making it work with construction vtables.
...
llvm-svn: 99609
2010-03-26 04:39:42 +00:00
Anders Carlsson
67fbf9853f
Use getNamedGlobal instead of getGlobalVariable. (Fixes self-host).
...
llvm-svn: 99385
2010-03-24 05:32:05 +00:00
Anders Carlsson
b35ea55e2e
More vtable work; preparations for moving over to the new vtable layout code (finally).
...
llvm-svn: 99381
2010-03-24 03:57:14 +00:00
Anders Carlsson
a864caff8c
Rename CGVtableInfo to CodeGenVTables in preparation of adding another VTableInfo class.
...
llvm-svn: 99250
2010-03-23 04:11:45 +00:00
Anders Carlsson
4cbe83cccb
Rename getVirtualBaseOffsetIndex to getVirtualBaseOffsetOffset to reflect what it actually does.
...
llvm-svn: 98248
2010-03-11 07:15:17 +00:00
John McCall
f8ff7b9fd1
Perform two more constructor/destructor code-size optimizations:
...
1) emit base destructors as aliases to their unique base class destructors
under some careful conditions. This is enabled for the same targets that can
support complete-to-base aliases, i.e. not darwin.
2) Emit non-variadic complete constructors for classes with no virtual bases
as calls to the base constructor. This is enabled on all targets and in
theory can trigger in situations that the alias optimization can't (mostly
involving virtual bases, mostly not yet supported).
These are bundled together because I didn't think it worthwhile to split them,
not because they really need to be.
llvm-svn: 96842
2010-02-23 00:48:20 +00:00
John McCall
b81884d347
More refactoring around constructor/destructor code generation.
...
Fix some bugs with function-try-blocks and simplify normal try-block
code generation.
This implementation excludes a deleting destructor's call to
operator delete() from the function-try-block, which I believe
is correct but which I can't find straightforward support for at
a moment's glance.
llvm-svn: 96670
2010-02-19 09:25:03 +00:00
John McCall
5c60a6f597
Make deleting and complete dtor variants defer to other dtor variants by
...
calling them as subroutines. This triggers whenever the alias optimization
doesn't, i.e. when the dtor has linkonce linkage or there are virtual bases
or it's the deleting dtor.
llvm-svn: 96605
2010-02-18 19:59:28 +00:00
John McCall
89b12b34f6
Extract out function-body code generation into its own method. No functionality
...
change.
llvm-svn: 96564
2010-02-18 03:17:58 +00:00
John McCall
347132b32f
IRgen optimization: cache the value of 'this' and 'vtt' instead of
...
repeatedly reloading from an alloca. We still need to create the alloca
for debug info purposes (although we currently create it in all cases
because of some abstraction boundaries that're hard to break down).
llvm-svn: 96403
2010-02-16 22:04:33 +00:00
John McCall
6ce747220a
When emitting complete destructors for classes with virtual bases, compute
...
the offset to the virtual bases statically inside of relying on the virtual
base offsets in the object's vtable(s). This is both more efficient and
sound against the destructor's manipulation of the vtables.
Also extract a few helper routines.
Oh and we seem to pass all tests with an optimized clang now.
llvm-svn: 96327
2010-02-16 04:15:37 +00:00
Anders Carlsson
ff8cce4395
Make sure to set vtable pointers in the destructors as well.
...
llvm-svn: 95525
2010-02-07 19:45:40 +00:00
Anders Carlsson
5ade5d39b4
Call destructors for constructed bases as well.
...
llvm-svn: 95502
2010-02-06 20:00:21 +00:00
Anders Carlsson
ba63167b64
If a constructor throws an exception we need to execute the destructors for all fully constructed members. Fixes ctor_dtor_count.cpp in the test suite.
...
llvm-svn: 95501
2010-02-06 19:50:17 +00:00
Ted Kremenek
9c193965ba
Remove unused variable.
...
llvm-svn: 95476
2010-02-06 03:29:18 +00:00
John McCall
ca972cd1f1
Rearrange some checks to avoid call to isCopyConstructor() and clarify path
...
taken for non-trivial constructors.
llvm-svn: 95457
2010-02-06 00:25:16 +00:00
John McCall
ab26cfa58d
Standardize the parsing of function type attributes in a way that
...
follows (as conservatively as possible) gcc's current behavior: attributes
written on return types that don't apply there are applied to the function
instead, etc. Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks). Consistently consume CC/noreturn
information throughout codegen; enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().
llvm-svn: 95436
2010-02-05 21:31:56 +00:00
Anders Carlsson
3b227bd629
Revert the new reference binding code; I came up with a way simpler solution for the reference binding bug that is preventing self-hosting.
...
llvm-svn: 95223
2010-02-03 16:38:03 +00:00
Anders Carlsson
5dc86337fb
Set the correct vtable pointers _before_ generating code for any member initializers. Fixes about ~2000 clang/LLVM tests in the clang-on-clang build.
...
llvm-svn: 95116
2010-02-02 19:58:43 +00:00