summaryrefslogtreecommitdiff
path: root/clang/test/AST/ast-dump-lambda.cpp
AgeCommit message (Collapse)Author
2024-05-15Reapply "[Clang][Sema] Earlier type checking for builtin unary operators ↵Krystian Stasiowski
(#90500)" (#92283) This patch reapplies #90500, addressing a bug which caused binary operators with dependent operands to be incorrectly rebuilt by `TreeTransform`.
2024-05-14Revert "[Clang][Sema] Earlier type checking for builtin unary operators ↵Krystian Stasiowski
(#90500)" (#92149) This reverts commit 8019cbbbbc94658d133583f7be6cd0023d30b0f3.
2024-05-14[Clang][Sema] Earlier type checking for builtin unary operators (#90500)Krystian Stasiowski
Currently, clang postpones all semantic analysis of unary operators with operands of pointer/pointer to member/array/function type until instantiation whenever that type is dependent (e.g. `T*` where `T` is a type template parameter). Consequently, the uninstantiated AST nodes all have the type `ASTContext::DependentTy` (which, for the purposes of #90152, is undesirable as that type may be the current instantiation! (e.g. `*this`)) This patch moves the point at which we perform semantic analysis for such expression to be prior to instantiation.
2023-10-26[AST] Only dump desugared type when visibly different (#65214)Jessica Clarke
These are an artifact of how types are structured but serve little purpose, merely showing that the type is sugared in some way. For example, ElaboratedType's existence means struct S gets printed as 'struct S':'struct S' in the AST, which is unnecessary visual clutter. Note that skipping the second print when the types have the same string matches what we do for diagnostics, where the aka will be skipped.
2023-08-18[clang][AST] TextNodeDumper learned to output ↵Timo Stripf
refers_to_enclosing_variable_or_capture flag for DeclRefExpr Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D158265
2023-02-23[Clang] Fix a crash when taking the address of a consteval lambdaCorentin Jabot
The `_invoke` function of lambdas was not respecting the constexpr/consteval specifier of the call operator, so it was possible to take its address in a non-immmediately invoked context, even if the call operator was itself consteval. In addition, we improve the diagnostic emmited in the lambda case not to show that `invoke` method. Fixes #57682 Reviewed By: aaron.ballman, #clang-language-wg Differential Revision: https://reviews.llvm.org/D144627
2022-07-21re-land [C++20][Modules] Update handling of implicit inlines [P1779R3]Iain Sandoe
re-land fixes an unwanted interaction with module-map modules, seen in Greendragon testing. This provides updates to [class.mfct]: Pre C++20 [class.mfct]p2: A member function may be defined (8.4) in its class definition, in which case it is an inline member function (7.1.2) Post C++20 [class.mfct]p1: If a member function is attached to the global module and is defined in its class definition, it is inline. and [class.friend]: Pre-C++20 [class.friend]p5 A function can be defined in a friend declaration of a class . . . . Such a function is implicitly inline. Post C++20 [class.friend]p7 Such a function is implicitly an inline function if it is attached to the global module. We add the output of implicit-inline to the TextNodeDumper, and amend a couple of existing tests to account for this, plus add tests for the cases covered above. Differential Revision: https://reviews.llvm.org/D129045
2022-07-11Revert "[C++20][Modules] Update handling of implicit inlines [P1779R3]"Jonas Devlieghere
This reverts commit ef0fa9f0ef3e as a follow up to b19d3ee7120b which reverted commit ac507102d258. See https://reviews.llvm.org/D126189 for more details.
2022-07-09[C++20][Modules] Update handling of implicit inlines [P1779R3]Iain Sandoe
This provides updates to [class.mfct]: Pre C++20 [class.mfct]p2: A member function may be defined (8.4) in its class definition, in which case it is an inline member function (7.1.2) Post C++20 [class.mfct]p1: If a member function is attached to the global module and is defined in its class definition, it is inline. and [class.friend]: Pre-C++20 [class.friend]p5 A function can be defined in a friend declaration of a class . . . . Such a function is implicitly inline. Post C++20 [class.friend]p7 Such a function is implicitly an inline function if it is attached to the global module. We add the output of implicit-inline to the TextNodeDumper, and amend a couple of existing tests to account for this, plus add tests for the cases covered above. Differential Revision: https://reviews.llvm.org/D129045
2022-02-14Implement WG14 N2764 the [[noreturn]] attributeAaron Ballman
This adds support for http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2764.pdf, which was adopted at the Feb 2022 WG14 meeting. That paper adds [[noreturn]] and [[_Noreturn]] to the list of supported attributes in C2x. These attributes have the same semantics as the [[noreturn]] attribute in C++. The [[_Noreturn]] attribute was added as a deprecated feature so that translation units which include <stdnoreturn.h> do not get an error on use of [[noreturn]] because the macro expands to _Noreturn. Users can use -Wno-deprecated-attributes to silence the diagnostic. Use of <stdnotreturn.h> or the noreturn macro were both deprecated. Users can define the _CLANG_DISABLE_CRT_DEPRECATION_WARNINGS macro to suppress the deprecation diagnostics coming from the header file.
2021-03-03Implement P2173 for attributes on lambdasAaron Ballman
https://wg21.link/P2173 is making its way through WG21 currently and has not been formally adopted yet. This feature provides very useful functionality in that you can specify attributes on the various function *declarations* generated by a lambda expression, where the current C++ grammar only allows attributes which apply to the various function *types* so generated. This patch implements P2173 on the assumption that it will be adopted by WG21 with this syntax for C++23.
2020-09-07Revert "[clang] Prevent that Decl::dump on a CXXRecordDecl deserialises ↵Raphael Isemann
further declarations." This reverts commit 0478720157f6413fad7595b8eff9c70d2d99b637. This probably doesn't work when forcing deserialising while dumping (which the ASTDumper optionally supports).
2020-09-07[clang] Prevent that Decl::dump on a CXXRecordDecl deserialises further ↵Raphael Isemann
declarations. Decl::dump is primarily used for debugging to visualise the current state of a declaration. Usually Decl::dump just displays the current state of the Decl and doesn't actually change any of its state, however since commit 457226e02a6e8533eaaa864a3fd7c8eeccd2bf58 the method actually started loading additional declarations from the ExternalASTSource. This causes that calling Decl::dump during a debugging session now actually does permanent changes to the AST and will cause the debugged program run to deviate from the original run. The change that caused this behaviour is the addition of `hasConstexprDestructor` (which is called from the TextNodeDumper) which performs a lookup into the current CXXRecordDecl to find the destructor. All other similar methods just return their respective bit in the DefinitionData (which obviously doesn't have such side effects). This just changes the node printer to emit "unknown_constexpr" in case a CXXRecordDecl is dumped that could potentially call into the ExternalASTSource instead of the usually empty string/"constexpr". For CXXRecordDecls that can safely be dumped the old behaviour is preserved Reviewed By: bruno Differential Revision: https://reviews.llvm.org/D80878
2020-07-03[clang][NFC] Add a missing /dev/null in test/AST/ast-dump-lambda.cppBruno Ricci
2020-06-21[clang][NFC] Regenerate test/AST/ast-dump-lambda.cpp with --match-full-lines.Bruno Ricci
2020-06-18More test cleanup for c36b03e32556a966e584386ac7dbb110bc7e4bc5.Richard Smith
2020-06-18[clang] Fix the serialization of LambdaExpr and the bogus mutation in ↵Bruno Ricci
LambdaExpr::getBody The body of LambdaExpr is currently not properly serialized. Instead LambdaExpr::getBody checks if the body has been already deserialized and if not mutates LambdaExpr. This can be observed with an AST dump test, where the body of the LambdaExpr will be null. The mutation in LambdaExpr::getBody was left because of another bug: it is not true that the body of a LambdaExpr is always a CompoundStmt; it can also be a CoroutineBodyStmt wrapping a CompoundStmt. This is fixed by returning a Stmt * from getBody and introducing a convenience function getCompoundStmtBody which always returns a CompoundStmt *. This function can be used by callers who do not care about the coroutine node. Happily all but one user of getBody treat it as a Stmt * and so this change is non-intrusive. Differential Revision: https://reviews.llvm.org/D81787 Reviewed By: aaron.ballman
2020-06-13[clang][NFC] Add an AST dump test for LambdaExprBruno Ricci
This test illustrate the bug fixed in D81787.