summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Ensure that destructors are called for NRVO'd objects when theDouglas Gregor2010-05-171-0/+5
| | | | | | | function does not return. Thanks to Eli for pointing out this corner case. llvm-svn: 103941
* When initializing thread-safe statics, put the call toDouglas Gregor2010-05-161-0/+1
| | | | | | | | | | | | | __cxa_guard_abort along the exceptional edge into (in effect) a nested "try" that rethrows after aborting. Fixes PR7144 and the remaining Boost.ProgramOptions failures, along with the regressions that r103880 caused. The crucial difference between this and r103880 is that we now follow LLVM's little dance with the llvm.eh.exception and llvm.eh.selector calls, then use _Unwind_Resume_or_Rethrow to rethrow. llvm-svn: 103892
* Revert r103880 (thread-safe static initialization w/ exceptions),Douglas Gregor2010-05-161-2/+1
| | | | | | because it's causing strange linker errors. Unfixes PR7144. llvm-svn: 103890
* When initializing thread-safe statics, put the call toDouglas Gregor2010-05-151-1/+2
| | | | | | | | __cxa_guard_abort along the exceptional edge into (in effect) a nested "try" that rethrows after aborting. Fixes PR7144 and the remaining Boost.ProgramOptions failures. llvm-svn: 103880
* Remove an unused function.Anders Carlsson2010-05-141-2/+0
| | | | llvm-svn: 103793
* Reimplement code generation for copying fields in theDouglas Gregor2010-05-051-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicitly-generated copy constructor. Previously, Sema would perform some checking and instantiation to determine which copy constructors, etc., would be called, then CodeGen would attempt to figure out which copy constructor to call... but would get it wrong, or poke at an uninstantiated default argument, or fail in other ways. The new scheme is similar to what we now do for the implicit copy-assignment operator, where Sema performs all of the semantic analysis and builds specific ASTs that look similar to the ASTs we'd get from explicitly writing the copy constructor, so that CodeGen need only do a direct translation. However, it's not quite that simple because one cannot explicit write elementwise copy-construction of an array. So, I've extended CXXBaseOrMemberInitializer to contain a list of indexing variables used to copy-construct the elements. For example, if we have: struct A { A(const A&); }; struct B { A array[2][3]; }; then we generate an implicit copy assignment operator for B that looks something like this: B::B(const B &other) : array[i0][i1](other.array[i0][i1]) { } CodeGen will loop over the invented variables i0 and i1 to visit all elements in the array, so that each element in the destination array will be copy-constructed from the corresponding element in the source array. Of course, if we're dealing with arrays of scalars or class types with trivial copy-assignment operators, we just generate a memcpy rather than a loop. Fixes PR6928, PR5989, and PR6887. Boost.Regex now compiles and passes all of its regression tests. Conspicuously missing from this patch is handling for the exceptional case, where we need to destruct those objects that we have constructed. I'll address that case separately. llvm-svn: 103079
* Remove OldGetAddressOfBaseClass - bye bye ambiguities.Anders Carlsson2010-05-031-4/+0
| | | | llvm-svn: 102889
* More work towards getting rid of OldGetAddressOfBaseClass.Anders Carlsson2010-05-031-0/+2
| | | | llvm-svn: 102887
* Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.Anders Carlsson2010-05-021-1/+1
| | | | llvm-svn: 102882
* Revert my last change and add a 'ForVirtualBase' parameter to ↵Anders Carlsson2010-05-021-3/+2
| | | | | | EmitCXXConstructorCall instead. llvm-svn: 102881
* Pass the construction kind down to EmitCXXConstructorCall.Anders Carlsson2010-05-021-1/+2
| | | | llvm-svn: 102880
* Remove another unused function.Anders Carlsson2010-05-021-3/+0
| | | | llvm-svn: 102871
* Remove an unused function.Anders Carlsson2010-05-021-6/+0
| | | | llvm-svn: 102870
* As per Chris' request, return the Instruction from EmitCall and add the ↵David Chisnall2010-05-021-2/+1
| | | | | | metadata in the caller. llvm-svn: 102862
* Complete reimplementation of the synthesis for implicitly-defined copyDouglas Gregor2010-05-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 102853
* Simplify EmitClassAggrMemberwiseCopy.Anders Carlsson2010-05-011-3/+2
| | | | llvm-svn: 102848
* Clean up EmitClassMemberwiseCopy further.Anders Carlsson2010-05-011-2/+1
| | | | llvm-svn: 102846
* Get rid of a parameter from EmitClassMemberwiseCopy.Anders Carlsson2010-05-011-2/+1
| | | | llvm-svn: 102845
* Tweaked EmitCall() to permit the caller to provide some metadata to attach ↵David Chisnall2010-05-011-1/+4
| | | | | | | | to the call site. Used this in CGObjCGNU to attach metadata about message sends to permit speculative inlining. llvm-svn: 102833
* Remove an unnecessary parameter from EmitClassCopyAssignment.Anders Carlsson2010-04-301-2/+1
| | | | llvm-svn: 102747
* Remove an unnecessary argument to EmitClassCopyAssignment.Anders Carlsson2010-04-291-2/+1
| | | | llvm-svn: 102674
* IRGen for initialization/destruction ofFariborz Jahanian2010-04-281-0/+2
| | | | | | | ivar class objects (NeXt runtime). (radar 7900343). llvm-svn: 102533
* Revert enough of my patches to fix self-host again :(Anders Carlsson2010-04-251-4/+7
| | | | llvm-svn: 102289
* RenameGetAddressOfBaseOfCompleteClass to ↵Anders Carlsson2010-04-241-7/+8
| | | | | | GetAddressOfDirectBaseInCompleteClass to reflect that it only handles direct bases. llvm-svn: 102284
* More cleanup.Anders Carlsson2010-04-241-4/+3
| | | | llvm-svn: 102282
* Simplify EmitClassMemberwiseCopy now that it's only used for fields.Anders Carlsson2010-04-241-3/+1
| | | | llvm-svn: 102281
* Rename GetAddressOfBaseClass to OldGetAddressOfBaseClass.Anders Carlsson2010-04-241-5/+5
| | | | llvm-svn: 102275
* Change CodeGenFunction::GetAddressOfDerivedClass to take a BasePath.Anders Carlsson2010-04-241-1/+1
| | | | llvm-svn: 102273
* Add a new GetAddressOfBaseClass overload that takes a base path and. Use it ↵Anders Carlsson2010-04-241-1/+5
| | | | | | for derived-to-base casts. llvm-svn: 102270
* Handle compound assignment expressions (i += j) as lvalues, which isDouglas Gregor2010-04-231-0/+1
| | | | | | | permitted in C++ but not in C. Fixes PR6900. Clang can now handle all of Boost.Lambda's regression tests. llvm-svn: 102170
* Call PerformCopyInitialization to properly initialize the exception temporaryJohn McCall2010-04-221-0/+3
| | | | | | | | | in a throw expression. Use EmitAnyExprToMem to emit the throw expression, which magically elides the final copy-constructor call (which raises a new strict-compliance bug, but baby steps). Give __cxa_throw a destructor pointer if the exception type has a non-trivial destructor. llvm-svn: 102039
* I failed to notice that my last patch wasn't doing as much as it couldJohn McCall2010-04-211-1/+2
| | | | | | | because EmitBranch actually clears the insert point. This version actually accomplishes what I initially wanted. llvm-svn: 101998
* Miscellaneous codegen cleanups. Mostly, don't create new basic blocksJohn McCall2010-04-211-7/+11
| | | | | | | just to save the current insertion state! This change significantly simplifies the IR CFG in exceptions code. llvm-svn: 101996
* Back out r101911 and see if it makes the bots happy.Anders Carlsson2010-04-201-2/+0
| | | | llvm-svn: 101921
* Fix a bug which triggered the assertion I added yesterday. Basically, when ↵Anders Carlsson2010-04-201-0/+2
| | | | | | 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
* Pass the nearest virtual base decl to InitializeVTablePointers. No ↵Anders Carlsson2010-04-201-4/+4
| | | | | | functionality change right now. llvm-svn: 101872
* Variation of objc_copyStruct API generation whenFariborz Jahanian2010-04-131-0/+1
| | | | | | | property (atomic/nonatomic) is of aggregate type with gc'able member objects) (NeXT runtime). llvm-svn: 101156
* Add support for objc_copyStruct to enforceFariborz Jahanian2010-04-131-0/+1
| | | | | | | atomicity of aggregate properties in setter/getter methods. wip. llvm-svn: 101107
* Minor include pruning.Benjamin Kramer2010-03-311-1/+0
| | | | llvm-svn: 100007
* Factor emitting a call to a copy constructor out into a separate function.Anders Carlsson2010-03-301-3/+4
| | | | llvm-svn: 99866
* Introduce a CXXTemporariesCleanupScope RAII object and use it to cleanup the ↵Anders Carlsson2010-03-301-0/+21
| | | | | | temporaries code. llvm-svn: 99865
* Reapply r99775 with a fix for a silly bug - we were setting the vtable ↵Anders Carlsson2010-03-281-4/+6
| | | | | | pointer for all bases, even those without a vtable pointer :) llvm-svn: 99777
* Looks like I broke self-host again :(.Anders Carlsson2010-03-281-6/+4
| | | | llvm-svn: 99776
* More improvements to setting the vtable pointer. We now no longer set the ↵Anders Carlsson2010-03-281-4/+6
| | | | | | 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
* Factor vtable pointer setting code out into a separate function.Anders Carlsson2010-03-281-1/+13
| | | | llvm-svn: 99773
* Simplify InitializeVtablePtrs in preparation of making it work with ↵Anders Carlsson2010-03-261-5/+2
| | | | | | construction vtables. llvm-svn: 99609
* More vtable work; preparations for moving over to the new vtable layout code ↵Anders Carlsson2010-03-241-1/+1
| | | | | | (finally). llvm-svn: 99381
* Remove old thunks code.Anders Carlsson2010-03-241-14/+0
| | | | llvm-svn: 99374
* Add CodeGenFunction::GenerateThunk and implement it.Anders Carlsson2010-03-241-1/+3
| | | | llvm-svn: 99365
* Rename CGVtableInfo to CodeGenVTables in preparation of adding another ↵Anders Carlsson2010-03-231-1/+1
| | | | | | VTableInfo class. llvm-svn: 99250
OpenPOWER on IntegriCloud