summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Simplify mem{cpy, move, set} creation with IRBuilder.Benjamin Kramer2010-12-301-8/+3
| | | | llvm-svn: 122634
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-071-4/+3
| | | | | | | | zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method trunc(), to be const and to return a new value instead of modifying the object in place. llvm-svn: 121121
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-1/+1
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* Remove some defensive calls to EmitLoadOfPropertyRefLValue that shouldn'tJohn McCall2010-12-041-32/+5
| | | | | | | be required, and then fix up some missing loads on overloaded-operator paths which that exposed. llvm-svn: 120896
* Kill the KVC l-value kind and calculate the base expression when emittingJohn McCall2010-12-041-13/+6
| | | | | | the l-value. llvm-svn: 120884
* IR Gen. part of API support for __block cxxFariborz Jahanian2010-12-021-2/+1
| | | | | | | | objects imported into blocks. //rdar://8594790. Will have a test case coming (as well as one sent to llvm test suite). llvm-svn: 120713
* Silence an unused variable warning during release builds by folding theChandler Carruth2010-11-151-3/+2
| | | | | | expression into the assert. llvm-svn: 119143
* Block API patch to do copy ctor of copied-in cxx objects inFariborz Jahanian2010-11-131-0/+27
| | | | | | | | copy helper function and dtor of copied cxx objects in dispose helper functions. __block variables TBD next. llvm-svn: 119011
* Also devirtualize calls to a member functions where the containing class has ↵Anders Carlsson2010-10-271-2/+7
| | | | | | been marked final. llvm-svn: 117445
* If a virtual member function has the 'final' attribute, we can devirtualize ↵Anders Carlsson2010-10-271-4/+11
| | | | | | calls to it. llvm-svn: 117444
* Factor out the code for emitting code to load vtable pointer membersDan Gohman2010-10-261-7/+4
| | | | | | so that it's done in one place. llvm-svn: 117386
* After discussion with Doug and John, I am revertingFariborz Jahanian2010-10-221-1/+0
| | | | | | the patch. llvm-svn: 117159
* Patch fixes miscompile with non-trivial copy constructors and Fariborz Jahanian2010-10-221-0/+1
| | | | | | statement expressions, //rdar: //8540501 llvm-svn: 117146
* Delay record type's debug info emission, in -flimit-debug-info mode, if ↵Devang Patel2010-10-221-1/+2
| | | | | | member expression's base is call expr. llvm-svn: 117127
* More class anonymization.Benjamin Kramer2010-10-221-0/+2
| | | | llvm-svn: 117106
* Introduce -flimit-debug-info.Devang Patel2010-09-301-0/+11
| | | | | | In this experimental mode try avoiding debug info emission for classes as much as possible. The goal is to reduce size of produced debuginfo without reducing quality of debug info in general. This is a work in progress. llvm-svn: 115188
* Kill FunctionDecl's IsCopyAssignment bit; it duplicated what couldDouglas Gregor2010-09-271-2/+2
| | | | | | | | already be determined by isCopyAssignmentOperator(), and was set too late in the process for all clients to see the appropriate value. Cleanup only; no functionality change. llvm-svn: 114916
* Fix a bug with binding l-values to elided temporaries, and leave a coupleJohn McCall2010-09-181-3/+5
| | | | | | helpful asserts behind. llvm-svn: 114250
* When emitting a new-expression inside a conditional expression,John McCall2010-09-171-7/+198
| | | | | | | | | | | | | | | | the cleanup might not be dominated by the allocation code. In this case, we have to store aside all the delete arguments in case we need them later. There's room for optimization here in cases where we end up not actually needing the cleanup in different branches (or being able to pop it after the initialization code). Also make sure we only call this operator delete along the path where we actually allocated something. Fixes rdar://problem/8439196. llvm-svn: 114145
* one piece of code is responsible for the lifetime of every aggregateJohn McCall2010-09-151-19/+17
| | | | | | | | | | | | | slot. The easiest way to do that was to bundle up the information we care about for aggregate slots into a new structure which demands that its creators at least consider the question. I could probably be convinced that the ObjC 'needs GC' bit should be rolled into this structure. Implement generalized copy elision. The main obstacle here is that IR-generation must be much more careful about making sure that exactly llvm-svn: 113962
* Tweak this assert.John McCall2010-09-141-1/+1
| | | | llvm-svn: 113863
* Implement the EH cleanup to call 'operator delete' if a new-expression throwsJohn McCall2010-09-141-0/+76
| | | | | | (but not if destructors associated with the full-expression throw). llvm-svn: 113836
* IRGen fix for using property-dot syntax to pass Fariborz Jahanian2010-09-101-1/+9
| | | | | | | reference object to a c++ member function. fixes radar 8409336. llvm-svn: 113602
* Re-commit r112916 with an additional fix for the self-host failures.John McCall2010-09-031-18/+26
| | | | | | I've audited the remaining getFunctionInfo call sites. llvm-svn: 112936
* Revert r112916, it's breaking selfhost pretty badly.John McCall2010-09-031-24/+17
| | | | llvm-svn: 112925
* It's not safe to use the generic CXXMethodDecl overload of CGT::getFunctionInfoJohn McCall2010-09-031-17/+24
| | | | | | | to set up a destructor call, because ABIs can tweak these conventions. Fixes rdar://problem/8386802. llvm-svn: 112916
* Fix a few more ConvertTypes that should be ConvertTypeForMems, fixingDouglas Gregor2010-09-021-2/+3
| | | | | | two regressions in Boost.Config. llvm-svn: 112908
* Revert my two IRgen fixes for "bool", then use a far simpler approachDouglas Gregor2010-09-021-3/+2
| | | | | | | based on ConvertTypeForMem. Thanks to John for pointing out the right solution. llvm-svn: 112838
* Fix more i1/i8 pointer madness. Here, an overactive assertionDouglas Gregor2010-09-021-2/+3
| | | | | | | | | | | | complains when the element type of a C++ "delete" expression is different from what we would expect from the pointer type. When deleting a bool*, we end up with an i1 on one side (where we compute the LLVM type from the Clang bool type) and i8 on the other (where we grab the LLVM type from the LLVM pointer type). I've weakened the assertion appropriately, and the Boost Parallel Graph Library now passes its regression tests. llvm-svn: 112821
* Abstract IR generation of array cookies into the C++ ABI class andJohn McCall2010-09-021-226/+347
| | | | | | | | | | | | | | implement ARM array cookies. Also fix a few unfortunate bugs: - throwing dtors in deletes prevented the allocation from being deleted - adding the cookie to the new[] size was not being considered for overflow (and, more seriously, was screwing up the earlier checks) - deleting an array via a pointer to array of class type was not causing any destructors to be run and was passing the unadjusted pointer to the deallocator - lots of address-space problems, in case anyone wants to support free store in a variant address space :) llvm-svn: 112814
* Fix IRGen when property-dot syntax used to accessFariborz Jahanian2010-09-011-5/+14
| | | | | | a c++ class object 'ivar'. Fixes radar 8366604. llvm-svn: 112729
* Teach IR generation to return 'this' from constructors and destructorsJohn McCall2010-08-311-0/+1
| | | | | | under the ARM ABI. llvm-svn: 112588
* Rename DeclContext::getLookupContext to getRedeclContext and change its ↵Sebastian Redl2010-08-311-1/+1
| | | | | | semantics slightly. No functionality change in the absence of inline namespaces. Also, change a few places where inline namespaces actually make a difference to be prepared for them. llvm-svn: 112563
* Fix miscompilation. The cookie was not used when new'ing arrays with ↵Argyrios Kyrtzidis2010-08-261-4/+16
| | | | | | multiple dimensions. llvm-svn: 112188
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-3/+3
| | | | | | to the new constants. llvm-svn: 112047
* Extract a method to check whether a function is the global placementJohn McCall2010-08-231-10/+21
| | | | | | operator new[]. llvm-svn: 111788
* Go back to asking CodeGenTypes whether a type is zero-initializable.John McCall2010-08-221-2/+1
| | | | | | | | | Make CGT defer to the ABI on all member pointer types. This requires giving CGT a handle to the ABI. It's way easier to make that work if we avoid lazily creating the ABI. Make it so. llvm-svn: 111786
* When performing value-initialization for a class with a non-trivial,Douglas Gregor2010-08-221-19/+15
| | | | | | | | | | | | implicitly-defined default constructor, zero-initialize the memory before calling the default constructor. Previously, we would only zero-initialize in the case of a trivial default constructor. Also, simplify the hideous logic that determines when we have a trivial default constructor and, therefore, don't need to emit any call at all. llvm-svn: 111779
* Experiment with using first-class aggregates to represent member functionJohn McCall2010-08-221-2/+1
| | | | | | | | | | pointers. I find the resulting code to be substantially cleaner, and it makes it very easy to use the same APIs for data member pointers (which I have conscientiously avoided here), and it avoids a plethora of potential inefficiencies due to excessive memory copying, but we'll have to see if it actually works. llvm-svn: 111776
* Abstract more member-pointerness out.John McCall2010-08-221-1/+1
| | | | llvm-svn: 111771
* Extract calls to method pointers out as an ABI routine.John McCall2010-08-221-65/+4
| | | | | | No functionality change. llvm-svn: 111752
* IRgen: Change Emit{Load,Store}OfScalar to take a required Alignment argument andDaniel Dunbar2010-08-211-2/+5
| | | | | | | | update callers as best I can. - This is a work in progress, our alignment handling is very horrible / sketchy -- I am just aiming for monotonic improvement. - Serious review appreciated. llvm-svn: 111707
* Fix a major regression with value-initialization of class types withDouglas Gregor2010-08-201-1/+7
| | | | | | | | trivial default constructors. We're weren't zero-initializing them, which manifested as <rdar://problem/8320532> (a regression in the GCC test suite) and is likely to have caused significant other breakage. llvm-svn: 111650
* Implement zero-initialization for array new when there is anDouglas Gregor2010-07-211-13/+61
| | | | | | | | | initializer of (). Make sure to use a simple memset() when we can, or fall back to generating a loop when a simple memset will not suffice. Fixes <rdar://problem/8212208>, a regression due to my work in r107857. llvm-svn: 108977
* in 'new int[4]', constant fold the 4*4=16 instead of Chris Lattner2010-07-201-34/+56
| | | | | | doing an overflow check. llvm-svn: 108943
* Follow the implementation approach suggested by PR6687,Chris Lattner2010-07-201-5/+16
| | | | | | | | | | | | | | | | | | | | | | which generates more efficient and more obviously conformant code. We now test for overflow of the multiply then force the result to -1 if so. On X86, this generates nice code like this: __Z4testl: ## @_Z4testl ## BB#0: ## %entry subl $12, %esp movl $4, %eax mull 16(%esp) testl %edx, %edx movl $-1, %ecx cmovel %eax, %ecx movl %ecx, (%esp) call __Znam addl $12, %esp ret llvm-svn: 108927
* implement rdar://5739832 - operator new should check for overflow in multiply,Chris Lattner2010-07-201-5/+21
| | | | | | | | | | | | | | | | | | | | causing clang to compile this code into something that correctly throws a length error, fixing a potential integer overflow security attack: void *test(long N) { return new int[N]; } int main() { test(1L << 62); } We do this even when exceptions are disabled, because it is better for the code to abort than for the attack to succeed. This is heavily based on a patch that Fariborz wrote. llvm-svn: 108915
* delete a loop that just generates dead code. In an exampleChris Lattner2010-07-201-10/+0
| | | | | | | | | | | | | | | | | | | | like this: void *test(long N) { return new int[N][42][42]; } the loop generates two dead mul instructions: %tmp = load i64* %N.addr ; <i64> [#uses=2] %0 = mul i64 %tmp, 7056 ; <i64> [#uses=1] %1 = mul i64 %tmp, 42 ; <i64> [#uses=1] %2 = mul i64 %1, 42 ; <i64> [#uses=0] %call = call noalias i8* @_Znam(i64 %0) ; <i8*> [#uses=1] The scale of these multiplies is already handled by the typesize stuff. llvm-svn: 108884
* remove the special case for constant array sizes from Chris Lattner2010-07-201-24/+2
| | | | | | | EmitCXXNewAllocSize. This code uses IRBuilder, which does constant folding already. llvm-svn: 108882
* Reinstate the fix for PR7556. A silly use of isTrivial() wasDouglas Gregor2010-07-081-0/+8
| | | | | | suppressing copies of objects with trivial copy constructors. llvm-svn: 107857
OpenPOWER on IntegriCloud