summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGClass.cpp
Commit message (Collapse)AuthorAge
...
* Get rid of the last caller of OldGetAddressOfBaseClass.Anders Carlsson2010-05-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102888 91177308-0d34-0410-b5e6-96231b3b80d8
* More work towards getting rid of OldGetAddressOfBaseClass.Anders Carlsson2010-05-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102887 91177308-0d34-0410-b5e6-96231b3b80d8
* Get rid of a call to GetAddressOfDirectBaseInCompleteClass.Anders Carlsson2010-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102886 91177308-0d34-0410-b5e6-96231b3b80d8
* Have getSubVTTIndex take a BaseSubobject instead of just a base.Anders Carlsson2010-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102885 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass ForVirtualBase all the way to GetVTTParameter.Anders Carlsson2010-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102883 91177308-0d34-0410-b5e6-96231b3b80d8
* Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.Anders Carlsson2010-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102882 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert my last change and add a 'ForVirtualBase' parameter to ↵Anders Carlsson2010-05-02
| | | | | | EmitCXXConstructorCall instead. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102881 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass the construction kind down to EmitCXXConstructorCall.Anders Carlsson2010-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102880 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove another unused function.Anders Carlsson2010-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102871 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an unused function.Anders Carlsson2010-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102870 91177308-0d34-0410-b5e6-96231b3b80d8
* Complete reimplementation of the synthesis for implicitly-defined copyDouglas Gregor2010-05-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | assignment operators. Previously, Sema provided type-checking and template instantiation for copy assignment operators, then CodeGen would synthesize the actual body of the copy constructor. Unfortunately, the two were not in sync, and CodeGen might pick a copy-assignment operator that is different from what Sema chose, leading to strange failures, e.g., link-time failures when CodeGen called a copy-assignment operator that was not instantiation, run-time failures when copy-assignment operators were overloaded for const/non-const references and the wrong one was picked, and run-time failures when by-value copy-assignment operators did not have their arguments properly copy-initialized. This implementation synthesizes the implicitly-defined copy assignment operator bodies in Sema, so that the resulting ASTs encode exactly what CodeGen needs to do; there is no longer any special code in CodeGen to synthesize copy-assignment operators. The synthesis of the body is relatively simple, and we generate one of three different kinds of copy statements for each base or member: - For a class subobject, call the appropriate copy-assignment operator, after overload resolution has determined what that is. - For an array of scalar types or an array of class types that have trivial copy assignment operators, construct a call to __builtin_memcpy. - For an array of class types with non-trivial copy assignment operators, synthesize a (possibly nested!) for loop whose inner statement calls the copy constructor. - For a scalar type, use built-in assignment. This patch fixes at least a few tests cases in Boost.Spirit that were failing because CodeGen picked the wrong copy-assignment operator (leading to link-time failures), and I suspect a number of undiagnosed problems will also go away with this change. Some of the diagnostics we had previously have gotten worse with this change, since we're going through generic code for our type-checking. I will improve this in a subsequent patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102853 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify EmitCopyCtorCall.Anders Carlsson2010-05-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102849 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify EmitClassAggrMemberwiseCopy.Anders Carlsson2010-05-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102848 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up EmitClassMemberwiseCopy further.Anders Carlsson2010-05-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102846 91177308-0d34-0410-b5e6-96231b3b80d8
* Get rid of a parameter from EmitClassMemberwiseCopy.Anders Carlsson2010-05-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102845 91177308-0d34-0410-b5e6-96231b3b80d8
* When defining implicit copy constructors, use SetBaseOrMemberInitializers to ↵Anders Carlsson2010-05-01
| | | | | | initialize the bases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102842 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an unnecessary parameter from EmitClassCopyAssignment.Anders Carlsson2010-04-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102747 91177308-0d34-0410-b5e6-96231b3b80d8
* Account for the VTT argument when making an implicit copy constructor forJohn McCall2010-04-30
| | | | | | | | | | | a class with virtual bases. Just a patch until Sema starts (correctly) doing most of this analysis. Fixes PR 6622. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102692 91177308-0d34-0410-b5e6-96231b3b80d8
* Get the base class addresses before calling EmitClassCopyAssignment.Anders Carlsson2010-04-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102676 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an unnecessary argument to EmitClassCopyAssignment.Anders Carlsson2010-04-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102674 91177308-0d34-0410-b5e6-96231b3b80d8
* Land another cleanup patch.Anders Carlsson2010-04-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102293 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert enough of my patches to fix self-host again :(Anders Carlsson2010-04-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102289 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleanup SynthesizeCXXCopyConstructor.Anders Carlsson2010-04-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102286 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up SynthesizeCXXCopyAssignment a little.Anders Carlsson2010-04-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102285 91177308-0d34-0410-b5e6-96231b3b80d8
* RenameGetAddressOfBaseOfCompleteClass to ↵Anders Carlsson2010-04-24
| | | | | | GetAddressOfDirectBaseInCompleteClass to reflect that it only handles direct bases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102284 91177308-0d34-0410-b5e6-96231b3b80d8
* More cleanup.Anders Carlsson2010-04-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102282 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify EmitClassMemberwiseCopy now that it's only used for fields.Anders Carlsson2010-04-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102281 91177308-0d34-0410-b5e6-96231b3b80d8
* DefineImplicitCopyConstructor now uses SetBaseOrMemberInitializers to create ↵Anders Carlsson2010-04-24
| | | | | | implicit base initializers. (Member initializers are still handled by CodeGenFunction::SynthesizeCXXCopyConstructor for now). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102279 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename GetAddressOfBaseClass to OldGetAddressOfBaseClass.Anders Carlsson2010-04-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102275 91177308-0d34-0410-b5e6-96231b3b80d8
* Get rid of the old GetNonVirtualBaseClassOffset and change all call sites to ↵Anders Carlsson2010-04-24
| | | | | | use the new version. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102274 91177308-0d34-0410-b5e6-96231b3b80d8
* Change CodeGenFunction::GetAddressOfDerivedClass to take a BasePath.Anders Carlsson2010-04-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102273 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert more call sites over to the new GetAddressOfBaseClass.Anders Carlsson2010-04-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102272 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new GetAddressOfBaseClass overload that takes a base path and. Use it ↵Anders Carlsson2010-04-24
| | | | | | for derived-to-base casts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102270 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment out an assert for now.Anders Carlsson2010-04-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102007 91177308-0d34-0410-b5e6-96231b3b80d8
* Back out r101911 and see if it makes the bots happy.Anders Carlsson2010-04-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101921 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug which triggered the assertion I added yesterday. Basically, when ↵Anders Carlsson2010-04-20
| | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101911 91177308-0d34-0410-b5e6-96231b3b80d8
* Move code to apply a non-virtual and virtual offset out into a separate ↵Anders Carlsson2010-04-20
| | | | | | function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101909 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass the nearest virtual base decl to InitializeVTablePointers. No ↵Anders Carlsson2010-04-20
| | | | | | functionality change right now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101872 91177308-0d34-0410-b5e6-96231b3b80d8
* Assert that the path from the derived to the base class in ↵Anders Carlsson2010-04-20
| | | | | | CodeGenFunction::GetAddressOfBaseClass is not ambiguous. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101869 91177308-0d34-0410-b5e6-96231b3b80d8
* Keep track of the actual storage specifier written on a variable orDouglas Gregor2010-04-19
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101826 91177308-0d34-0410-b5e6-96231b3b80d8
* Have the CXXBaseOrMemberInitializer keep track of whether an initializer ↵Anders Carlsson2010-04-12
| | | | | | initializes a virtual base or not. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101004 91177308-0d34-0410-b5e6-96231b3b80d8
* the big refactoring bits of PR3782.Rafael Espindola2010-03-30
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99920 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the old vtable layout code.Anders Carlsson2010-03-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99869 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new function in EmitClassAggrMemberwiseCopy, fixing the same assert ↵Anders Carlsson2010-03-30
| | | | | | as seen in PR6628 but for arrays this time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99867 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor emitting a call to a copy constructor out into a separate function.Anders Carlsson2010-03-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99866 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a CXXTemporariesCleanupScope RAII object and use it to cleanup the ↵Anders Carlsson2010-03-30
| | | | | | temporaries code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99865 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle default arguments when calling copy constructors for bases or members ↵Anders Carlsson2010-03-30
| | | | | | when synthesizing a copy constructor. Fixes PR6628. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99864 91177308-0d34-0410-b5e6-96231b3b80d8
* Flip the switch to always get vtables from the VTT when necessary, I've ↵Anders Carlsson2010-03-29
| | | | | | verified that clang bootstraps with this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99800 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleanup, no functionality change.Anders Carlsson2010-03-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99798 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix another thinko, so that flags don't depend on previous bases.Anders Carlsson2010-03-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99791 91177308-0d34-0410-b5e6-96231b3b80d8