summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/lambda-expressions.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Store a pointer to the return value in a static alloca and let the debugger ↵Amy Huang2019-06-201-1/+0
| | | | | | | | | | | | | | use that as the variable address for NRVO variables. Subscribers: hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D63361 llvm-svn: 363952
* When emitting a multidimensional array copy, only emit a single flattenedRichard Smith2016-12-141-12/+4
| | | | | | cleanup loop for exception handling. llvm-svn: 289623
* Remove custom handling of array copies in lambda by-value array capture andRichard Smith2016-12-141-25/+51
| | | | | | | | | | | copy constructors of classes with array members, instead using ArrayInitLoopExpr to represent the initialization loop. This exposed a bug in the static analyzer where it was unable to differentiate between zero-initialized and unknown array values, which has also been fixed here. llvm-svn: 289618
* When copying an array into a lambda, destroy temporaries fromJohn McCall2016-07-201-2/+52
| | | | | | | | | the copy-constructor immediately and enter a partial array cleanup for previously-copied elements. Fixes PR28595. llvm-svn: 276180
* Allow capture typedefs/type aliases for VLAs in lambdas/captured statements ↵Alexey Bataev2016-01-251-3/+7
| | | | | | | | chain. Previous it was allowed to capture VLAs/types with arrays of runtime bounds only inside the first lambda/capture statement in stack. Patch allows to capture these typedefs implicitly in chains of lambdas/captured statements. llvm-svn: 258669
* Fix crash for typedefs for arrays of runtime bounds in Lambdas/Captured ↵Alexey Bataev2016-01-211-20/+33
| | | | | | Statements, used in sizeof() expression only. llvm-svn: 258396
* Compute and preserve alignment more faithfully in IR-generation.John McCall2015-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce an Address type to bundle a pointer value with an alignment. Introduce APIs on CGBuilderTy to work with Address values. Change core APIs on CGF/CGM to traffic in Address where appropriate. Require alignments to be non-zero. Update a ton of code to compute and propagate alignment information. As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment helper function to CGF and made use of it in a number of places in the expression emitter. The end result is that we should now be significantly more correct when performing operations on objects that are locally known to be under-aligned. Since alignment is not reliably tracked in the type system, there are inherent limits to this, but at least we are no longer confused by standard operations like derived-to-base conversions and array-to-pointer decay. I've also fixed a large number of bugs where we were applying the complete-object alignment to a pointer instead of the non-virtual alignment, although most of these were hidden by the very conservative approach we took with member alignment. Also, because IRGen now reliably asserts on zero alignments, we should no longer be subject to an absurd but frustrating recurring bug where an incomplete type would report a zero alignment and then we'd naively do a alignmentAtOffset on it and emit code using an alignment equal to the largest power-of-two factor of the offset. We should also now be emitting much more aggressive alignment attributes in the presence of over-alignment. In particular, field access now uses alignmentAtOffset instead of min. Several times in this patch, I had to change the existing code-generation pattern in order to more effectively use the Address APIs. For the most part, this seems to be a strict improvement, like doing pointer arithmetic with GEPs instead of ptrtoint. That said, I've tried very hard to not change semantics, but it is likely that I've failed in a few places, for which I apologize. ABIArgInfo now always carries the assumed alignment of indirect and indirect byval arguments. In order to cut down on what was already a dauntingly large patch, I changed the code to never set align attributes in the IR on non-byval indirect arguments. That is, we still generate code which assumes that indirect arguments have the given alignment, but we don't express this information to the backend except where it's semantically required (i.e. on byvals). This is likely a minor regression for those targets that did provide this information, but it'll be trivial to add it back in a later patch. I partially punted on applying this work to CGBuiltin. Please do not add more uses of the CreateDefaultAligned{Load,Store} APIs; they will be going away eventually. llvm-svn: 246985
* Fix assertion failure if a lambda array-capture is followed by a this capture.Richard Smith2015-04-281-0/+9
| | | | llvm-svn: 236043
* Test case updates for explicit type parameter to the gep operatorDavid Blaikie2015-03-131-1/+1
| | | | llvm-svn: 232187
* Update Clang tests to handle explicitly typed load changes in LLVM.David Blaikie2015-02-271-11/+11
| | | | llvm-svn: 230795
* Emit DeferredDeclsToEmit in a DFS order.Rafael Espindola2015-01-221-9/+9
| | | | | | | | | | | | | | Currently we emit DeferredDeclsToEmit in reverse order. This patch changes that. The advantages of the change are that * The output order is a bit closer to the source order. The change to test/CodeGenCXX/pod-member-memcpys.cpp is a good example. * If we decide to deffer more, it will not cause as large changes in the estcases as it would without this patch. llvm-svn: 226751
* Use a CHECK-LABEL. NFCRafael Espindola2015-01-211-1/+1
| | | | llvm-svn: 226709
* CodeGen: Don't crash when a lambda uses a local constexpr variableDavid Majnemer2015-01-011-2/+10
| | | | | | | | | | | The DeclRefExpr might be for a variable initialized by a constant expression which hasn't been ODR used. Emit the initializer for the variable instead of trying to capture the variable itself. This fixes PR22071. llvm-svn: 225060
* CodeGen: Compound literals with funny types shouldn't crashDavid Majnemer2014-12-141-1/+1
| | | | | | | | | | | | | | | | | CodeGen assumed that a compound literal with array type should have a corresponding LLVM IR array type. We had two bugs in this area: - Zero sized arrays in compound literals would lead to the creation of an opaque type. This is unnecessary, we should just create an array type with a bound of zero. - Funny record types (like unions) lead to exotic IR types for compound literals. In this case, CodeGen must be prepared to deal with the possibility that it might not have an array IR type. This fixes PR21912. llvm-svn: 224219
* CHECK-LABEL-ify some code gen tests to improve diagnostic experience when ↵Stephen Lin2013-08-151-14/+14
| | | | | | tests fail. llvm-svn: 188447
* Add the 'target-cpu' and 'target-features' attributes to functions.Bill Wendling2013-02-151-1/+1
| | | | | | | The back-end will use these values to reconfigure code generation for different features. llvm-svn: 175308
* Update the tests.Bill Wendling2013-01-311-1/+1
| | | | | | | This update coincides with r174110. That change ordered the attributes alphabetically. llvm-svn: 174111
* Modify the tests for the (sorted) order that the attributes come out as now.Bill Wendling2013-01-291-1/+1
| | | | llvm-svn: 173762
* Don't assert/crash on reference variables in lambdas bound to aEli Friedman2013-01-031-2/+13
| | | | | | static local variable from the parent scope. PR14773. llvm-svn: 171433
* clang/test/CodeGenCXX/lambda-expressions.cpp: Relax expression for -Asserts.NAKAMURA Takumi2012-12-141-2/+2
| | | | | | "entry:" is not met in -Asserts build. llvm-svn: 170175
* Make sure the __invoke function for lambdas returns properly. Per bug ↵Eli Friedman2012-12-131-0/+9
| | | | | | report on IRC> llvm-svn: 170160
* Fix the determination of whether a capture refers to an enclosingDouglas Gregor2012-12-011-1/+12
| | | | | | scope when dealing with nested blocks. Fixes <rdar://problem/12778708>. llvm-svn: 169065
* DR1472: A reference isn't odr-used if it has preceding initialization,Richard Smith2012-10-201-0/+9
| | | | | | | | | initialized by a reference constant expression. Our odr-use modeling still needs work here: we don't yet implement the 'set of potential results of an expression' DR. llvm-svn: 166361
* Teach Expr::HasSideEffects about all the Expr types, and fix a bug where itRichard Smith2012-08-071-2/+6
| | | | | | | | | | | | | | | | | | | was mistakenly classifying dynamic_casts which might throw as having no side effects. Switch it from a visitor to a switch, so it is kept up-to-date as future Expr nodes are added. Move it from ExprConstant.cpp to Expr.cpp, since it's not really related to constant expression evaluation. Since we use HasSideEffect to determine whether to emit an unused global with internal linkage, this has the effect of suppressing emission of globals in some cases. I've left many of the Objective-C cases conservatively assuming that the expression has side-effects. I'll leave it to someone with better knowledge of Objective-C than mine to improve them. llvm-svn: 161388
* Implement non-internal linkage for lambda closure types that need aDouglas Gregor2012-02-211-16/+16
| | | | | | | | | stable mangling, since these lambdas can end up in multiple translation units. Sema is responsible for deciding when this is the case, because it's already responsible for choosing the mangling number. llvm-svn: 151029
* Make sure that we set up the right declaration contexts when creatingDouglas Gregor2012-02-201-0/+3
| | | | | | | | | and introducing the lambda closure type and its function call operator. Previously, we assumed that the lambda closure type would land directly in the current context, and not some parent context (as occurs with linkage specifications). Thanks to Richard for the test case. llvm-svn: 150987
* When we resolve the type of an 'auto' variable, clear out the linkageDouglas Gregor2012-02-201-0/+3
| | | | | | | of that variable; it will need to be recomputed with the resolved type. llvm-svn: 150984
* Basic support for name mangling of C++11 lambda expressions. BecauseDouglas Gregor2012-02-201-16/+16
| | | | | | | | | | | | | | | name mangling in the Itanium C++ ABI for lambda expressions is so dependent on context, we encode the number used to encode each lambda as part of the lambda closure type, and maintain this value within Sema. Note that there are a several pieces still missing: - We still get the linkage of lambda expressions wrong - We aren't properly numbering or mangling lambda expressions that occur in default function arguments or in data member initializers. - We aren't (de-)serializing the lambda numbering tables llvm-svn: 150982
* Rework the Sema/AST/IRgen dance for the lambda closure type'sDouglas Gregor2012-02-171-0/+18
| | | | | | | | | | | | | | | | | | | | conversion to function pointer. Rather than having IRgen synthesize the body of this function, we instead introduce a static member function "__invoke" with the same signature as the lambda's operator() in the AST. Sema then generates a body for the conversion to function pointer which simply returns the address of __invoke. This approach makes it easier to evaluate a call to the conversion function as a constant, makes the linkage of the __invoke function follow the normal rules for member functions, and may make life easier down the road if we ever want to constexpr'ify some of lambdas. Note that IR generation is responsible for filling in the body of __invoke (Sema just adds a dummy body), because the body can't generally be expressed in C++. Eli, please review! llvm-svn: 150783
* Add a coverage test for lambda expression IRGen.Eli Friedman2012-02-141-0/+54
llvm-svn: 150458
OpenPOWER on IntegriCloud