ef8225444452a1486bd721f3285301fe84643b00 |
|
21-Jul-2014 |
Stephen Hines <srhines@google.com> |
Update Clang for rebase to r212749. This also fixes a small issue with arm_neon.h not being generated always. Includes a cherry-pick of: r213450 - fixes mac-specific header issue r213126 - removes a default -Bsymbolic on Android Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
/external/clang/lib/Sema/SemaLambda.cpp
|
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 |
|
29-May-2014 |
Stephen Hines <srhines@google.com> |
Update Clang for 3.5 rebase (r209713). Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
/external/clang/lib/Sema/SemaLambda.cpp
|
651f13cea278ec967336033dd032faef0e9fc2ec |
|
24-Apr-2014 |
Stephen Hines <srhines@google.com> |
Updated to Clang 3.5a. Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/lib/Sema/SemaLambda.cpp
|
2434dcfb022778b06cfd257d830d0249680b87cf |
|
05-Dec-2013 |
Bill Wendling <isanbard@gmail.com> |
Merging r196454: ------------------------------------------------------------------------ r196454 | faisalv | 2013-12-04 17:40:41 -0800 (Wed, 04 Dec 2013) | 43 lines Fix init-captures for generic lambdas. For an init capture, process the initialization expression right away. For lambda init-captures such as the following: const int x = 10; auto L = [i = x+1](int a) { return [j = x+2, &k = x](char b) { }; }; keep in mind that each lambda init-capture has to have: - its initialization expression executed in the context of the enclosing/parent decl-context. - but the variable itself has to be 'injected' into the decl-context of its lambda's call-operator (which has not yet been created). Each init-expression is a full-expression that has to get Sema-analyzed (for capturing etc.) before its lambda's call-operator's decl-context, scope & scopeinfo are pushed on their respective stacks. Thus if any variable is odr-used in the init-capture it will correctly get captured in the enclosing lambda, if one exists. The init-variables above are created later once the lambdascope and call-operators decl-context is pushed onto its respective stack. Since the lambda init-capture's initializer expression occurs in the context of the enclosing function or lambda, therefore we can not wait till a lambda scope has been pushed on before deciding whether the variable needs to be captured. We also need to process all lvalue-to-rvalue conversions and discarded-value conversions, so that we can avoid capturing certain constant variables. For e.g., void test() { const int x = 10; auto L = [&z = x](char a) { <-- don't capture by the current lambda return [y = x](int i) { <-- don't capture by enclosing lambda return y; } }; If x was not const, the second use would require 'L' to capture, and that would be an error. Make sure TranformLambdaExpr is also aware of this. Patch approved by Richard (Thanks!!) http://llvm-reviews.chandlerc.com/D2092 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@196470 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
c00e4194296e994efab0e4bf64ca66737850bdf0 |
|
07-Nov-2013 |
Faisal Vali <faisalv@yahoo.com> |
This patch implements capturing of variables within generic lambdas. Both Richard and I felt that the current wording in the working paper needed some tweaking - Please see http://llvm-reviews.chandlerc.com/D2035 for additional context and references to core-reflector messages that discuss wording tweaks. What is implemented is what we had intended to specify in Bristol; but, recently felt that the specification might benefit from some tweaking and fleshing. As a rough attempt to explain the semantics: If a nested lambda with a default-capture names a variable within its body, and if the enclosing full expression that contains the name of that variable is instantiation-dependent - then an enclosing lambda that is capture-ready (i.e. within a non-dependent context) must capture that variable, if all intervening nested lambdas can potentially capture that variable if they need to, and all intervening parent lambdas of the capture-ready lambda can and do capture the variable. Of note, 'this' capturing is also currently underspecified in the working paper for generic lambdas. What is implemented here is if the set of candidate functions in a nested generic lambda includes both static and non-static member functions (regardless of viability checking - i.e. num and type of parameters/arguments) - and if all intervening nested-inner lambdas between the capture-ready lambda and the function-call containing nested lambda can capture 'this' and if all enclosing lambdas of the capture-ready lambda can capture 'this', then 'this' is speculatively captured by that capture-ready lambda. Hopefully a paper for the C++ committee (that Richard and I had started some preliminary work on) is forthcoming. This essentially makes generic lambdas feature complete, except for known bugs. The more prominent ones (and the ones I am currently aware of) being: - generic lambdas and init-captures are broken - but a patch that fixes this is already in the works ... - nested variadic expansions such as: auto K = [](auto ... OuterArgs) { vp([=](auto ... Is) { decltype(OuterArgs) OA = OuterArgs; return 0; }(5)...); return 0; }; auto M = K('a', ' ', 1, " -- ", 3.14); currently cause crashes. I think I know how to fix this (since I had done so in my initial implementation) - but it will probably take some work and back & forth with Doug and Richard. A warm thanks to all who provided feedback - and especially to Doug Gregor and Richard Smith for their pivotal guidance: their insight and prestidigitation in such matters is boundless! Now let's hope this commit doesn't upset the buildbot gods ;) Thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194188 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
6bae51a21c29e00050dddc76f3ea42af21745ebd |
|
05-Nov-2013 |
David Majnemer <david.majnemer@gmail.com> |
Sema: Improve comment introduced in r193397 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194052 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
9d33c40838367ffcc3206a7120a0ce32922b66d8 |
|
25-Oct-2013 |
David Majnemer <david.majnemer@gmail.com> |
Sema: Do not allow lambda expressions to appear inside of constant expressions We would previously not diagnose this which would lead to crashes (on very strange code). This fixes PR17675. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193397 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
605f91ffd18f35ffcb5fcdd38379bd09b67a6cb8 |
|
24-Oct-2013 |
Faisal Vali <faisalv@yahoo.com> |
Fix an instantiation bug with nested generic lambdas and conversion to fptrs. This patch fixes the typelocs of the conversion-operator and the conversion-operator-name and adds the parameters of the call operator to the FunctionProtoTypeLoc of the respective entities. Thus, when the template declarations (conversion operators) undergo deduction and instantiation/transformation/substitution - they add themselves to the local instantiation scope if needed. This patch supports the following: auto L = [](auto b) { return [](auto a) ->decltype(a) { return a; }; }; int (*fp)(int) = L(8); Richard LGTM'd this patch: http://llvm-reviews.chandlerc.com/D1831 Thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193294 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
bef582b0159e8f0deb606c7700e3590a6f5a4ab2 |
|
23-Oct-2013 |
Faisal Vali <faisalv@yahoo.com> |
Refactor out the circular reference to LambdaExpr in CXXRecordDecl. A prior commit of this patch was reverted because it was within the blamelist's purview of a failing test. The failure of that test has been addressed here: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131021/091546.html. Therefore I am recommitting this patch (all tests pass on windows, except for the usual modules & index suspects that never pass on my box). Some background: Both Doug and Richard had asked me in Chicago to remove the circular reference in CXXRecordDecl to LambdaExpr by factoring out and storing the needed information from LambdaExpr directly into CXXRecordDecl. In addition, I have added an IsGenericLambda flag - this makes life a little easier when we implement capturing, and are Sema-analyzing the body of a lambda (and the calloperator hasn't been wired to the closure class yet). Any inner lambdas can have potential captures that could require walking up the scope chain and checking if any generic lambdas are capture-ready. This 'bit' makes some of that checking easier. No change in functionality. This patch was approved by Doug with minor modifications (comments were cleaned up, and all data members were converted from bool/enum to unsigned, as requested): http://llvm-reviews.chandlerc.com/D1856 Thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193246 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
80f2b2e693422f84ec3735f16a08614a527b0bc5 |
|
23-Oct-2013 |
Rafael Espindola <rafael.espindola@gmail.com> |
Revert r193223 and r193216. They were causing CodeGenCXX/mangle-exprs.cpp to fail. Revert "Remove the circular reference to LambdaExpr in CXXRecordDecl." Revert "Again: Teach TreeTransform and family how to transform generic lambdas nested within templates and themselves." git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193226 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
a4c91afe103063e983aa9bab535e442da8629636 |
|
23-Oct-2013 |
Faisal Vali <faisalv@yahoo.com> |
Remove the circular reference to LambdaExpr in CXXRecordDecl. Both Doug and Richard had asked me to remove the circular reference in CXXRecordDecl to LambdaExpr by factoring out and storing the needed information from LambdaExpr directly into CXXRecordDecl. No change in functionality. In addition, I have added an IsGenericLambda flag - this makes life a little easier when we implement capturing, and are Sema-analyzing the body of a lambda (and the calloperator hasn't been wired to the closure class yet). Any inner lambdas can have potential captures that could require walking up the scope chain and checking if any generic lambdas are capture-ready. This 'bit' makes some of that checking easier. This patch was approved by Doug with minor modifications (comments were cleaned up, and all data members were converted from bool/enum to unsigned, as requested): http://llvm-reviews.chandlerc.com/D1856 Thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193223 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
d6992ab33b7113e1bd7af51c0c52d17c23706c01 |
|
29-Sep-2013 |
Faisal Vali <faisalv@yahoo.com> |
Implement conversion to function pointer for generic lambdas without captures. The general strategy is to create template versions of the conversion function and static invoker and then during template argument deduction of the conversion function, create the corresponding call-operator and static invoker specializations, and when the conversion function is marked referenced generate the body of the conversion function using the corresponding static-invoker specialization. Similarly, Codegen does something similar - when asked to emit the IR for a specialized static invoker of a generic lambda, it forwards emission to the corresponding call operator. This patch has been reviewed in person both by Doug and Richard. Richard gave me the LGTM. A few minor changes: - per Richard's request i added a simple check to gracefully inform that captures (init, explicit or default) have not been added to generic lambdas just yet (instead of the assertion violation). - I removed a few lines of code that added the call operators instantiated parameters to the currentinstantiationscope. Not only did it not handle parameter packs, but it is more relevant in the patch for nested lambdas which will follow this one, and fix that problem more comprehensively. - Doug had commented that the original implementation strategy of using the TypeSourceInfo of the call operator to create the static-invoker was flawed and allowed const as a member qualifier to creep into the type of the static-invoker. I currently kludge around it - but after my initial discussion with Doug, with a follow up session with Richard, I have added a FIXME so that a more elegant solution that involves the use of TrivialTypeSourceInfo call followed by the correct wiring of the template parameters to the functionprototypeloc is forthcoming. Thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
9beaf20b882eb83082da27a74760277bb9fc0bdd |
|
28-Sep-2013 |
Richard Smith <richard-llvm@metafoo.co.uk> |
Add compat/extension warnings for init captures. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191609 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
39edfeb34b0b0b8033179e35cf13cd5d95d56fa8 |
|
28-Sep-2013 |
Richard Smith <richard-llvm@metafoo.co.uk> |
Switch from putting init capture VarDecls in the surrounding DeclContext to putting them in the call operator's DeclContext. This better matches the language wording and avoids some cases where code gets confused by them for namespace-scope lambdas and the like. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191606 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
04fa7a33279808dc3e5117c41b5f84c40eeb7362 |
|
28-Sep-2013 |
Richard Smith <richard-llvm@metafoo.co.uk> |
Per latest drafting, switch to implementing init-captures as if by declaring and capturing a variable declaration, and complete the implementation of them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
fad9e13f3cb85198f0ee5af620ba81cd78574faa |
|
26-Sep-2013 |
Faisal Vali <faisalv@yahoo.com> |
Implement a rudimentary form of generic lambdas. Specifically, the following features are not included in this commit: - any sort of capturing within generic lambdas - generic lambdas within template functions and nested within other generic lambdas - conversion operator for captureless lambdas - ensuring all visitors are generic lambda aware (Although I have gotten some useful feedback on my patches of the above and will be incorporating that as I submit those patches for commit) As an example of what compiles through this commit: template <class F1, class F2> struct overload : F1, F2 { using F1::operator(); using F2::operator(); overload(F1 f1, F2 f2) : F1(f1), F2(f2) { } }; auto Recursive = [](auto Self, auto h, auto ... rest) { return 1 + Self(Self, rest...); }; auto Base = [](auto Self, auto h) { return 1; }; overload<decltype(Base), decltype(Recursive)> O(Base, Recursive); int num_params = O(O, 5, 3, "abc", 3.14, 'a'); Please see attached tests for more examples. This patch has been reviewed by Doug and Richard. Minor changes (non-functionality affecting) have been made since both of them formally looked at it, but the changes involve removal of supernumerary return type deduction changes (since they are now redundant, with richard having committed a recent patch to address return type deduction for C++11 lambdas using C++14 semantics). Some implementation notes: - Add a new Declarator context => LambdaExprParameterContext to clang::Declarator to allow the use of 'auto' in declaring generic lambda parameters - Add various helpers to CXXRecordDecl to facilitate identifying and querying a closure class - LambdaScopeInfo (which maintains the current lambda's Sema state) was augmented to house the current depth of the template being parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth) so that SemaType.cpp::ConvertDeclSpecToType may use it to immediately generate a template-parameter-type when 'auto' is parsed in a generic lambda parameter context. (i.e we do NOT use AutoType deduced to a template parameter type - Richard seemed ok with this approach). We encode that this template type was generated from an auto by simply adding $auto to the name which can be used for better diagnostics if needed. - SemaLambda.h was added to hold some common lambda utility functions (this file is likely to grow ...) - Teach Sema::ActOnStartOfFunctionDef to check whether it is being called to instantiate a generic lambda's call operator, and if so, push an appropriately prepared LambdaScopeInfo object on the stack. - various tests were added - but much more will be needed. There is obviously more work to be done, and both Richard (weakly) and Doug (strongly) have requested that LambdaExpr be removed form the CXXRecordDecl LambdaDefinitionaData in a future patch which is forthcoming. A greatful thanks to all reviewers including Eli Friedman, James Dennett, and especially the two gracious wizards (Richard Smith and Doug Gregor) who spent hours providing feedback (in person in Chicago and on the mailing lists). And yet I am certain that I have allowed unidentified bugs to creep in; bugs, that I will do my best to slay, once identified! Thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
41d0958281627882fbe2049fb887d741eabd3fe3 |
|
25-Sep-2013 |
Richard Smith <richard-llvm@metafoo.co.uk> |
Refactor to use C++1y 'auto' semantics directly in lambdas with no specified return type in C++1y mode. No functionality change intended. Extracted and tweaked from a patch by Faisal Vali! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191354 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
942f9fe11d3a9583eef6bc4ca2549b1f0d1694da |
|
10-Sep-2013 |
Reid Kleckner <reid@kleckner.net> |
[ms-cxxabi] Implement guard variables for static initialization Static locals requiring initialization are not thread safe on Windows. Unfortunately, it's possible to create static locals that are actually externally visible with inline functions and templates. As a result, we have to implement an initialization guard scheme that is compatible with TUs built by MSVC, which makes thread safety prohibitively difficult. MSVC's scheme is that every function that requires a guard gets an i32 bitfield. Each static local is assigned a bit that indicates if it has been initialized, up to 32 bits, at which point a new bitfield is created. MSVC rejects inline functions with more than 32 static locals, and the externally visible mangling (?_B) only allows for one guard variable per function. On Eli's recommendation, I used MangleNumberingContext to track which bit each static corresponds to. Implements PR16888. Reviewers: rjmccall, eli.friedman Differential Revision: http://llvm-reviews.chandlerc.com/D1416 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190427 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
86164e8f51fa89a3ec904607c3848dc4a21b12cf |
|
05-Sep-2013 |
Eli Friedman <eli.friedman@gmail.com> |
Note when a decl is used in AST files. When an AST file is built based on another AST file, it can use a decl from the fist file, and therefore mark the "isUsed" bit. We need to note this in the AST file so that the bit is set correctly when the second AST file is loaded. This patch introduces the distinction between setIsUsed() and markUsed() so that we don't call into the ASTMutationListener callback when it wouldn't be appropriate. Fixes PR16635. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190016 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
ef072033876e295ec5d3402f8730a3ae358ad815 |
|
28-Aug-2013 |
Reid Kleckner <reid@kleckner.net> |
Delete CC_Default and use the target default CC everywhere Summary: Makes functions with implicit calling convention compatible with function types with a matching explicit calling convention. This fixes things like calls to qsort(), which has an explicit __cdecl attribute on the comparator in Windows headers. Clang will now infer the calling convention from the declarator. There are two cases when the CC must be adjusted during redeclaration: 1. When defining a non-inline static method. 2. When redeclaring a function with an implicit or mismatched convention. Fixes PR13457, and allows clang to compile CommandLine.cpp for the Microsoft C++ ABI. Excellent test cases provided by Alexander Zinenko! Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1231 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189412 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
152b4e4652baedfceba1cd8115515629225e713f |
|
22-Aug-2013 |
Manuel Klimek <klimek@google.com> |
Revert "Implement a rudimentary form of generic lambdas." This reverts commit 606f5d7a99b11957e057e4cd1f55f931f66a42c7. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
28cc16a64a3bbad9e48309eb8b4ee68893cd85d0 |
|
22-Aug-2013 |
Manuel Klimek <klimek@google.com> |
Revert "Remove some unused variables identified by Juergen Ributzka *I need to turn on this warning in Visual C++ - sorry!*" This reverts commit d01d0b63d87ac465f15ce1d6b56bf3faf4525769. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
ebf55350505523b1fe3e43aab8e1e88decb0ad09 |
|
22-Aug-2013 |
Faisal Vali <faisalv@yahoo.com> |
Remove some unused variables identified by Juergen Ributzka *I need to turn on this warning in Visual C++ - sorry!* git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188979 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
ecb5819a9e64fb654d46a3b270a286cc570c58ff |
|
22-Aug-2013 |
Faisal Vali <faisalv@yahoo.com> |
Implement a rudimentary form of generic lambdas. Specifically, the following features are not included in this commit: - any sort of capturing within generic lambdas - nested lambdas - conversion operator for captureless lambdas - ensuring all visitors are generic lambda aware As an example of what compiles: template <class F1, class F2> struct overload : F1, F2 { using F1::operator(); using F2::operator(); overload(F1 f1, F2 f2) : F1(f1), F2(f2) { } }; auto Recursive = [](auto Self, auto h, auto ... rest) { return 1 + Self(Self, rest...); }; auto Base = [](auto Self, auto h) { return 1; }; overload<decltype(Base), decltype(Recursive)> O(Base, Recursive); int num_params = O(O, 5, 3, "abc", 3.14, 'a'); Please see attached tests for more examples. Some implementation notes: - Add a new Declarator context => LambdaExprParameterContext to clang::Declarator to allow the use of 'auto' in declaring generic lambda parameters - Augment AutoType's constructor (similar to how variadic template-type-parameters ala TemplateTypeParmDecl are implemented) to accept an IsParameterPack to encode a generic lambda parameter pack. - Add various helpers to CXXRecordDecl to facilitate identifying and querying a closure class - LambdaScopeInfo (which maintains the current lambda's Sema state) was augmented to house the current depth of the template being parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth) so that Sema::ActOnLambdaAutoParameter may use it to create the appropriate list of corresponding TemplateTypeParmDecl for each auto parameter identified within the generic lambda (also stored within the current LambdaScopeInfo). Additionally, a TemplateParameterList data-member was added to hold the invented TemplateParameterList AST node which will be much more useful once we teach TreeTransform how to transform generic lambdas. - SemaLambda.h was added to hold some common lambda utility functions (this file is likely to grow ...) - Teach Sema::ActOnStartOfFunctionDef to check whether it is being called to instantiate a generic lambda's call operator, and if so, push an appropriately prepared LambdaScopeInfo object on the stack. - Teach Sema::ActOnStartOfLambdaDefinition to set the return type of a lambda without a trailing return type to 'auto' in C++1y mode, and teach the return type deduction machinery in SemaStmt.cpp to process either C++11 and C++14 lambda's correctly depending on the flag. - various tests were added - but much more will be needed. A greatful thanks to all reviewers including Eli Friedman, James Dennett and the ever illuminating Richard Smith. And yet I am certain that I have allowed unidentified bugs to creep in; bugs, that I will do my best to slay, once identified! Thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
f68af647dda5cca00b49be27d24f62b0a7fff986 |
|
10-Aug-2013 |
James Dennett <jdennett@google.com> |
Expose LambdaIntroducer::DefaultLoc in the AST's LambdaExpr. Summary: Source-centric tools need access to the location of a C++11 lambda expression's capture-default ('&' or '=') when it's present. It's possible for them to find it by re-lexing and re-implementing rules that Clang's parser has already applied, but the cost of storing the SourceLocation and making it available to them is 32 bits per LambdaExpr (a small delta, proportionally), and the simplification in client code is significant. Reviewers: rsmith Reviewed By: rsmith CC: cfe-commits, klimek, revane Differential Revision: http://llvm-reviews.chandlerc.com/D1192 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188121 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
5e867c8a07d82da0d3b0a43402ee4f1c6ba416e9 |
|
10-Jul-2013 |
Eli Friedman <eli.friedman@gmail.com> |
More local mangling fixes. Compute mangling numbers for externally visible local variables and tags. Change the mangler to consistently use discriminators where necessary. Tweak the scheme we use to number decls which are not externally visible to avoid unnecessary discriminators in common cases now that we request them more consistently. Fixes <rdar://problem/14204721>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185986 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
09d19efaa147762f84aed55efa7930bb3616a4e5 |
|
04-Jul-2013 |
Craig Topper <craig.topper@gmail.com> |
Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
ce9cd911c5b88d375ea1ff9f4719e4d63ce0fa7a |
|
02-Jul-2013 |
Andy Gibbs <andyg1001@hotmail.co.uk> |
Suppress "control reaches end of non-void function" warning when compiling with gcc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185439 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
07369dde9d72213bf8a48288cd8b29999af9a40c |
|
01-Jul-2013 |
Eli Friedman <eli.friedman@gmail.com> |
Fix mangling for block literals. Blocks, like lambdas, can be written in contexts which are required to be treated as the same under ODR. Unlike lambdas, it isn't possible to actually take the address of a block, so the mangling of the block itself doesn't matter. However, objects like static variables inside a block do need to be mangled in a consistent way. There are basically three components here. One, block literals need a consistent numbering. Two, objects/types inside a block literal need to be mangled using it. Three, objects/types inside a block literal need to have their linkage computed correctly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185372 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
ddb5a3926d715ab4354ca36117679e3f4d5d3e21 |
|
14-Jun-2013 |
Eli Friedman <eli.friedman@gmail.com> |
Unify return type checking for functions and ObjC methods. Move all the random checks for ObjC object return types to SemaType.cpp. Fixes issue with ObjC method type checking reported on cfe-dev. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
95099ef43aff8fb3d5d47bed0a583e7977f4b3f4 |
|
13-Jun-2013 |
Eli Friedman <eli.friedman@gmail.com> |
Followup to r183931 to fix the lambda conversion-to-block-pointer member. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183942 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
38fa961573efb0fb9ef53f3e8a9e730701bc9375 |
|
13-Jun-2013 |
Eli Friedman <eli.friedman@gmail.com> |
Fix a small bug in the linkage computation for the lambda conversion-to-function-pointer member. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
0567a79130a251bf464ce21ecf3f8b9fb5207900 |
|
10-Jun-2013 |
Reid Kleckner <reid@kleckner.net> |
Use FPT::getArgTypes() instead of manually building ArrayRefs Made significantly easier with git-clang-format. Differential Revision: http://llvm-reviews.chandlerc.com/D947 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
44ee0a710c59d8e6793189f903bae21c16814324 |
|
07-Jun-2013 |
Eli Friedman <eli.friedman@gmail.com> |
Re-commit r183466 with a fix to make the TypeLoc casting machinery work correctly in the presence of qualified types. (I had to change the unittest because it was trying to cast a QualifiedTypeLoc to TemplateSpecializationTypeLoc.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183563 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
20387efff0870da2c8b30bb62ae661239a903021 |
|
07-Jun-2013 |
Manuel Klimek <klimek@google.com> |
Reverts r183466: "Perform dynamic alignment computations..." This introduces bugs in TemplateSpecializationTypeLoc's angle bracket locations. Regression test follows in a subsequent commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183513 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
86875b11db3536858116effd80cbb06b6810303d |
|
07-Jun-2013 |
Eli Friedman <eli.friedman@gmail.com> |
Perform dynamic alignment computations so that the data in TypeLocs is correctly aligned. Not performing such computations led to misaligned loads, which crash on some platforms and are generally bad on other platforms. The implementation of TypeLocBuilder::pushImpl is rather messy; code using TypeLocBuilder accidentally assumes that partial TypeLocs are laid out like a complete TypeLoc. As a followup, I intend to work on fixing the TypeLocBuilder API to avoid exposing partial TypeLocs; this should substantially simplify the implemementation. Fixes PR16144. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
0d8e9646bc000bab521ce52ed294209a92298cef |
|
16-May-2013 |
Richard Smith <richard-llvm@metafoo.co.uk> |
First pass of semantic analysis for init-captures: check the initializer, build a FieldDecl from it, and propagate both into the closure type and the LambdaExpr. You can't do much useful with them yet -- you can't use them within the body of the lambda, because we don't have a representation for "the this of the lambda, not the this of the enclosing context". We also don't have support or a representation for a nested capture of an init-capture yet, which was intended to work despite not being allowed by the current standard wording. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
0a664b863255065d960342dd074a77d63c753d35 |
|
09-May-2013 |
Richard Smith <richard-llvm@metafoo.co.uk> |
C++1y n3648: parse and reject init-captures for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181553 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
70133b5b4ad863f7d73fabfaf799b2f4e30d98ec |
|
08-May-2013 |
John McCall <rjmccall@apple.com> |
In block enum-return inference, don't die on loads of enum lvalues. More of rdar://13200889. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181390 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
5543169296beeb183b9c9392debc774fcf493eeb |
|
05-May-2013 |
Dmitri Gribenko <gribozavr@gmail.com> |
Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef constructor from None Patch by Robert Wilhelm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
aeeacf725c9e0ddd64ea9764bd008e5b6873ce51 |
|
03-May-2013 |
John McCall <rjmccall@apple.com> |
Move parsing of identifiers in MS-style inline assembly into the actual parser and support arbitrary id-expressions. We're actually basically set up to do arbitrary expressions here if we wanted to. Assembly operands permit things like A::x to be written regardless of language mode, which forces us to embellish the evaluation context logic somewhat. The logic here under template instantiation is incorrect; we need to preserve the fact that an expression was unevaluated. Of course, template instantiation in general is fishy here because we have no way of delaying semantic analysis in the MC parser. It's all just fishy. I've also fixed the serialization of MS asm statements. This commit depends on an LLVM commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180976 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
6afcf8875d4e447645cd7bf3733dd8e2eb8455dc |
|
16-Apr-2013 |
Tareq A. Siraj <tareq.a.sriaj@intel.com> |
Sema for Captured Statements Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic analysis. Currently captures all variables by reference. TODO: templates Author: Ben Langmuir <ben.langmuir@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D433 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179618 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
d2615cc53b916e8aae45783ca7113b93de515ce3 |
|
03-Apr-2013 |
Rafael Espindola <rafael.espindola@gmail.com> |
Add 178663 back. http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178682 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41 |
|
03-Apr-2013 |
Rafael Espindola <rafael.espindola@gmail.com> |
Revert 178663. Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb Revert "Don't compute a patched/semantic storage class." This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178681 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
8f187f62cb0487d31bc4afdfcd47e11fe9a51d05 |
|
03-Apr-2013 |
Rafael Espindola <rafael.espindola@gmail.com> |
Don't compute a patched/semantic storage class. For variables and functions clang used to store two storage classes. The one "as written" in the code and a patched one, which, for example, propagates static to the following decls. This apparently is from the days clang lacked linkage computation. It is now redundant and this patch removes it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178663 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
41d016454b48f25c93d4b3fb84cfc7e426a9bd73 |
|
09-Mar-2013 |
John McCall <rjmccall@apple.com> |
Adjust the special non-C++ enum block return type inference so that it looks through certain syntactic forms and applies even if normal inference would have succeeded. There is potential for source incompatibility from this change, but overall we feel that it produces a much cleaner and more defensible result, and the block compatibility rules should curb a lot of the potential for annoyance. rdar://13200889 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176743 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
bea522ff43a3f11c7a2bc7949119dbb9fce19e39 |
|
08-Mar-2013 |
Jordan Rose <jordan_rose@apple.com> |
ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType. No (intended) functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176726 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
cfa88f893915ceb8ae4ce2f17c46c24a4d67502f |
|
12-Jan-2013 |
Dmitri Gribenko <gribozavr@gmail.com> |
Remove useless 'llvm::' qualifier from names like StringRef and others that are brought into 'clang' namespace by clang/Basic/LLVM.h git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
ad017fa7a4df7389d245d02a49b3c79ed70bedb9 |
|
20-Dec-2012 |
Bill Wendling <isanbard@gmail.com> |
Revert r170500. It over-zealously converted *ALL* things named Attributes, which is wrong here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
094dbf917127a1228147587076d59ca45b7c258d |
|
19-Dec-2012 |
Bill Wendling <isanbard@gmail.com> |
Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
3bc93e3124ad5e7191c4a12dc981c8ee53578193 |
|
19-Dec-2012 |
David Blaikie <dblaikie@gmail.com> |
Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as per review discussion in r170365 This does limit these typedefs to being sequences, but no current usage requires them to be contiguous (we could expand this to a more general iterator pair range concept at some point). Also, it'd be nice if SmallVector were constructible directly from an ArrayRef but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the inverse conversion. (& generalizing over all range-like things, while nice, would require some nontrivial SFINAE I haven't thought about yet) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170482 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
55fc873017f10f6f566b182b70f6fc22aefa3464 |
|
04-Dec-2012 |
Chandler Carruth <chandlerc@gmail.com> |
Sort all of Clang's files under 'lib', and fix up the broken headers uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
7c3c6bca2662704fbe038137d8ef2e4112359586 |
|
20-Sep-2012 |
Eli Friedman <eli.friedman@gmail.com> |
Handle lambdas where the lambda-declarator is an explicit "(void)". PR13854. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164274 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
8da8a660128180a31479216111ff9b19b11c95b4 |
|
19-Sep-2012 |
Eli Friedman <eli.friedman@gmail.com> |
Add the TypeSourceInfo for the lambda call operator to the lambda's definition info; it needs to be there because the mangler needs to access it before we're finished defining the lambda class. PR12808. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164186 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
9cd5b24315aea4bc58bac03cfb4874e076b013b8 |
|
18-Sep-2012 |
Eli Friedman <eli.friedman@gmail.com> |
Add an extra check for invalid decls in the lambda semantic analysis to avoid a crash. PR13860. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164168 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
3bc22262af7b09a459b400976cfce3d9318b8ea9 |
|
30-Aug-2012 |
Richard Smith <richard-llvm@metafoo.co.uk> |
PR13652: Don't assume the parameter array on a FunctionTypeLoc for a lambda will be filled in; they won't if the lambda's declarator has an invalid type. Instead take the parameters from the declarator directly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
4ef832ffc1147ce2f9777f9fad650cb3139a1d00 |
|
10-Aug-2012 |
David Blaikie <dblaikie@gmail.com> |
Provide isConst/Volatile on CXXMethodDecl. This also provides isConst/Volatile/Restrict on FunctionTypes to coalesce the implementation with other callers (& update those other callers). Patch contributed by Sam Panzer (panzer@google.com). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161647 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
612409ece080e814f79e06772c690d603f45fbd6 |
|
25-Jul-2012 |
Richard Smith <richard-llvm@metafoo.co.uk> |
PR12057: Allow variadic template pack expansions to cross lambda boundaries. Rather than adding a ContainsUnexpandedParameterPack bit to essentially every AST node, we tunnel the bit directly up to the surrounding lambda expression when we reach a context where an unexpanded pack can not normally appear. Thus any statement or declaration within a lambda can now potentially contain an unexpanded parameter pack. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
adb1d4c18ee83249d4cffc99ef902f98e846092a |
|
23-Jul-2012 |
Richard Smith <richard-llvm@metafoo.co.uk> |
PR12917: Remove incorrect assumption that lambda mangling information cannot change once it's been assigned. It can change in two ways: 1) In a template instantiation, the context declaration should be the instantiated declaration, not the declaration in the template. 2) If a lambda appears in the pattern of a variadic pack expansion, the mangling number will depend on the pack length. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
3a2d0fb726aca3096b5c1ea9be734417060f34d7 |
|
04-Jul-2012 |
Benjamin Kramer <benny.kra@googlemail.com> |
Split out the "empty" case for compound statement into a separate ctor. Move the ASTContext-dependent version out of line. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
7dd900ed308506f9cf1cb72c70db1652f94cab37 |
|
02-Jul-2012 |
Jordan Rose <jordan_rose@apple.com> |
In blocks, only pretend that enum constants have enum type if necessary. In C, enum constants have the type of the enum's underlying integer type, rather than the type of the enum. (This is not true in C++.) Thus, when a block's return type is inferred from an enum constant, it is incompatible with expressions that return the enum type. In r158899, I told block returns to pretend that enum constants have enum type, like in C++. Doug Gregor pointed out that this can break existing code. Now, we don't check the types of return statements until the end of the block. This lets us go back and add implicit casts in blocks with mixed enum constants and enum-typed expressions. <rdar://problem/11662489> (again) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159591 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
03f1eb031b84e93415b792c4b45d8da71c88e92d |
|
15-Jun-2012 |
Douglas Gregor <dgregor@apple.com> |
Check the parameter lists and return type of both blocks and lambdas for unexpanded parameter packs. Fixes the crash-on-invalid in PR13117. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158525 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
581deb3da481053c4993c7600f97acf7768caac5 |
|
06-Jun-2012 |
David Blaikie <dblaikie@gmail.com> |
Revert Decl's iterators back to pointer value_type rather than reference value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158104 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
44f5b1d95a3e4edf12c9b395d9f47767e75037b6 |
|
04-Jun-2012 |
Aaron Ballman <aaron@aaronballman.com> |
Removing the lambda extension warning concerning single return statements, as it no longer applies. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157943 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
262bc18e32500558af7cb0afa205b34bd37bafed |
|
30-Apr-2012 |
David Blaikie <dblaikie@gmail.com> |
Remove the ref/value inconsistency in filter_decl_iterator. filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
f54486acc1cadf2791c3916ece66fded1e57ba0b |
|
04-Apr-2012 |
Douglas Gregor <dgregor@apple.com> |
Move the computation of the lambda mangling information (mangling number + context) to the point where we initially start defining the lambda, so that the linkage won't change when that information is made available. Fixes the assertion in <rdar://problem/11182962>. Plus, actually mangle the context of lambdas properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154029 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
4e4d08403ca5cfd4d558fa2936215d3a4e5a528d |
|
11-Mar-2012 |
David Blaikie <dblaikie@gmail.com> |
Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
23f0267e2d56c0407f12e62df3561ecf75d74e6e |
|
01-Mar-2012 |
Eli Friedman <eli.friedman@gmail.com> |
Implement "optimization" for lambda-to-block conversion which inlines the generated block literal for lambdas which are immediately converted to block pointer type. This simplifies the AST, avoids an unnecessary copy of the lambda and makes it much easier to avoid copying the result onto the heap. Note that this transformation has a substantial semantic effect outside of ARC: it gives the converted lambda lifetime semantics similar to a block literal. With ARC, the effect is much less obvious because the lifetime of blocks is already managed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151797 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
ac1303eca6cbe3e623fb5ec6fe7ec184ef4b0dfa |
|
22-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Generate an AST for the conversion from a lambda closure type to a block pointer that returns a block literal which captures (by copy) the lambda closure itself. Some aspects of the block literal are left unspecified, namely the capture variable (which doesn't actually exist) and the body (which will be filled in by IRgen because it can't be written as an AST). Because we're switching to this model, this patch also eliminates tracking the copy-initialization expression for the block capture of the conversion function, since that information is now embedded in the synthesized block literal. -1 side tables FTW. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
b09ab8c293833c3dbcbf78f0db5e01fec46966bf |
|
21-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Only pop the expression evaluation context corresponding to a lambda expression after we've finished the function body of the corresponding function call operator. Otherwise, ActOnFinishFunctionBody() will see the (unfinished) evaluation context of the lambda expression itself. Fixes PR12031. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151082 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
f4b7de1cef3007cc0479775638198287384d9af1 |
|
21-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Improve our handling of lambda expressions that occur within default arguments. There are two aspects to this: - Make sure that when marking the declarations referenced in a default argument, we don't try to mark local variables, both because it's a waste of time and because the semantics are wrong: we're not in a place where we could capture these variables again even if it did make sense. - When a lambda expression occurs in a default argument of a function template, make sure that the corresponding closure type is considered dependent, so that it will get properly instantiated. The second bit is a bit of a hack; to fix it properly, we may have to rearchitect our handling of default arguments, parsing them only after creating the function definition. However, I'd like to separate that work from the lambdas work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151076 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
a7b07fd0e13d3bee1f33ad74c35e24681f85451e |
|
21-Feb-2012 |
Craig Topper <craig.topper@gmail.com> |
Remove comma from end of enum to silence build warning. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
5878cbcfaa90b8515550db86033fd5a0efab971d |
|
21-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Implement non-internal linkage for lambda closure types that need a 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151029 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
552e29985a710f4ced62b39d70557501bd31ca9b |
|
21-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Implement name mangling for lambda expressions that occur within the initializers of data members (both static and non-static). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
ccc1b5eebc6ca8a904c58c0468b9a71483b7c7cf |
|
21-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Implement name mangling for lambda expressions that occur within the default arguments of function parameters. This simple-sounding task is complicated greatly by two issues: (1) Default arguments aren't actually a real context, so we need to maintain extra state within lambda expressions to track when a lambda was actually in a default argument. (2) At the time that we parse a default argument, the FunctionDecl doesn't exist yet, so lambda closure types end up in the enclosing context. It's not clear that we ever want to change that, so instead we introduce the notion of the "effective" context of a declaration for the purposes of name mangling. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151011 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
fa07ab57eb565b4a00712adcefb29d96b445bfcd |
|
20-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Make sure that we set up the right declaration contexts when creating 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150987 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
9e8c92a9c9b949bbb0408fbbd9a58e34894b6efc |
|
20-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Basic support for name mangling of C++11 lambda expressions. Because 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150982 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
999713eea940f4e087cc3ac878689c5c5c7a7225 |
|
18-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Rewrite variable capture within lambda expressions and blocks, eliminating a bunch of redundant code and properly modeling how the captures of outside blocks/lambdas affect the types seen by inner captures. This new scheme makes two passes over the capturing scope stack. The first pass goes up the stack (from innermost to outermost), assessing whether the capture looks feasible and stopping when it either hits the scope where the variable is declared or when it finds an existing capture. The second pass then walks down the stack (from outermost to innermost), capturing the variable at each step and updating the captured type and the type that an expression referring to that captured variable would see. It also checks type-specific restrictions, such as the inability to capture an array within a block. Note that only the first odr-use of each variable needs to do the full walk; subsequent uses will find the capture immediately, so multiple walks need not occur. The same routine that builds the captures can also compute the type of the captures without signaling errors and without actually performing the capture. This functionality is used to determine the type of declaration references as well as implementing the weird decltype((x)) rule within lambda expressions. The capture code now explicitly takes sides in the debate over C++ core issue 1249, which concerns the type of captures within nested lambdas. We opt to use the more permissive, more useful definition implemented by GCC rather than the one implemented by EDG. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150875 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
27dd7d962bbf774988bc5e59d04a7743ed503514 |
|
17-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Rework the Sema/AST/IRgen dance for the lambda closure type's 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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150783 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
c2956e5681113bbcec5ff98833345166942a211b |
|
15-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Lambda closure types have a conversion function to a block pointer with the same parameter types and return type as the function call operator. This is the real answer to http://stackoverflow.com/questions/4148242/is-it-possible-to-convert-a-c0x-lambda-to-a-clang-block :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150620 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
c25d1c9821e576ae6e3d11f621ff0901aa4e7c69 |
|
15-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Factor the construction of the lambda-to-function-pointer conversion function declaration into a separate function. No functionality change git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150617 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
c6889e7ed16604c51994e1f11becf213fdc64eb3 |
|
14-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Implement C++ core issue 974, which permits default arguments for lambda expressions. Because these issue was pulled back from Ready status at the Kona meeting, we still emit an ExtWarn when using default arguments for lambda expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150519 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
53393f23d8b767f976427a6d45b310bf37dd91c4 |
|
14-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Check the return type of lambda expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
a73652465bcc4c0f6cb7d933ad84e002b527a643 |
|
14-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Implement support for lambda capture pack expansions, e.g., [&values...] { print(values...); } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150497 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
d5387e86ce3dfe1ae09e050ee11d86ca0d066d04 |
|
14-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Link together the call operator produced from transforming a lambda expression with the original call operator, so that we don't try to separately instantiate the call operator. Test and tweak a few more bits for template instantiation of lambda expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150440 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
dfca6f53ab97d28d43e3fa2564209df08f3d282c |
|
13-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Introduce support for template instantiation of lambda expressions. This is mostly a simple refact, splitting the main "start a lambda expression" function into smaller chunks that are driven either from the parser (Sema::ActOnLambdaExpr) or during AST transformation (TreeTransform::TransformLambdaExpr). A few minor interesting points: - Added new entry points for TreeTransform, so that we can explicitly establish the link between the lambda closure type in the template and the lambda closure type in the instantiation. - Added a bit into LambdaExpr specifying whether it had an explicit result type or not. We should have had this anyway. This code is 'lightly' tested. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150417 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
9daa7bfdff7256cef693d7bf10084881bcb9253c |
|
13-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Keep track of the set of array index variables we use when we synthesize a by-copy captured array in a lambda. This information will be needed by IR generation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150396 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
da8962a6198bc4bf09a38209db99551b2b0a41a0 |
|
13-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Move the storage of lambda captures and capture initializers from LambdaExpr over to the CXXRecordDecl. This allows us to eliminate the back-link from the closure type to the LambdaExpr, which will simplify and lazify AST deserialization. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150393 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
215e4e17d00e12c38687a95502506d8f2ca3e646 |
|
12-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Lambdas have a deleted default constructor and a deleted copy assignment operator, per C++ [expr.prim.lambda]p19. Make it so. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150345 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
3ac109cd17151bb8ad3a40b0cbb0e1923cd6c4a0 |
|
10-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Allow implicit capture of 'this' in a lambda even when the capture default is '=', and reword the warning about explicitly capturing 'this' in such lambdas to indicate that only explicit capture is banned. Introduce Fix-Its for this and other "save the programmer from themself" rules regarding what can be explicitly captured and what must be implicitly captured. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150256 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
b555971345750350c21d541afe135054c7402933 |
|
10-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Don't introduce a lambda's operator() into the class until after we have finished parsing the body, so that name lookup will never find anything within the closure type. Then, add this operator() and the conversion function (if available) before completing the class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150252 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
eefb3d5b49c844347f212073a7e975b8118fe8e9 |
|
10-Feb-2012 |
Richard Smith <richard-llvm@metafoo.co.uk> |
Track whether a function type has a trailing return type as type sugar. Use this to pretty-print such function types better, and to fix a case where we were not instantiating templates in lexical order. In passing, move the Variadic bit from Type's bitfields to FunctionProtoType to get the Type bitfields down to 32 bits. Also ensure that we always substitute the return type of a function when substituting explicitly-specified arguments, since that can cause us to bail out with a SFINAE error before we hit a hard error in parameter substitution. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150241 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
ef7d78bd5be466c369b04af742ed8268244d4fe7 |
|
10-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Implement the conversion to a function pointer for lambda expressions, per C++ [expr.prim.lambda]p6. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150236 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
4d8d22bfaed6e5d7da6b5556415b18c43b44e36c |
|
10-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Extend CXXRecordDecl with a function that determines the mapping from the variables captured by a lambda to the fields that store the captured values. To be used in IRgen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150235 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
54042f1bd78f1f1ea86be7d4af541462e127d2ed |
|
09-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Implement return type deduction for lambdas per C++11 [expr.prim.lambda]p4, including the current suggested resolution of core isue 975, which allows multiple return statements so long as the types match. ExtWarn when user code is actually making use of this extension. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150168 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
760b37bcae12f4bbc68bb6cabf6ed68d265b0826 |
|
09-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Restore the appropriate lexical declaration context for a lambda's function call operator (to the lambda class). This allows us to IRgen calls to simple (non-capturing) lambdas, e.g., [](int i, int j) -> int { return i + j; }(1, 2) Eli will be providing test cases as he brings up more IRgen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150166 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
b326ca8ffbea96f9cc8a457b0f57be880304a6f5 |
|
09-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Remove the "unsupported" error for lambda expressions. It's annoying, and rapidly becoming untrue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150165 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
e2c5913c48f66bfec9e58a8ad1d90e5eeffad586 |
|
09-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Implement C++ [expr.prim.lambda]p2, which bans lambda expressions in unevaluated operands. Be certain that we're marking everything referenced within a capture initializer as odr-used. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150163 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
5e058eb02875530f1aed10c3417a1011744239b1 |
|
09-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Don't complain about the lack of a constructor for a lambda expression. They are constructed in different ways git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
630d5fffdf342128bd73f817013ee91e030daac1 |
|
09-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Along the error path for lambdas, mark the lambda class as invalid and finalize it git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150130 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
503384f731b5abcbf870b0a5224eb920e631db0a |
|
09-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Various interrelated cleanups for lambdas: - Complete the lambda class when we finish the lambda expression (previously, it was left in the "being completed" state) - Actually return the LambdaExpr object and bind to the resulting temporary when needed. - Detect when cleanups are needed while capturing a variable into a lambda (e.g., due to default arguments in the copy constructor), and make sure those cleanups apply for the whole of the lambda expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150123 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|
e2a7ad001fe1dc4a0d5fef312e7f7189e1f29369 |
|
08-Feb-2012 |
Douglas Gregor <dgregor@apple.com> |
Factor C++11 lambda expressions implementation into a separate file. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150089 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaLambda.cpp
|