summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/lambda-expressions.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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