diff options
| author | Willem Kaufmann <willem.kaufmann@gmail.com> | 2025-11-21 07:37:05 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-21 07:37:05 -0500 |
| commit | 41a9df2389b6db45b5159073c52232dd867c7f25 (patch) | |
| tree | 7f5cd663fa4a33842b9479f477fde39737c1ef8f /lldb/test/Shell/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test | |
| parent | 764c1d40ce89a2ece97d32240e5e943afdb2c9c9 (diff) | |
[Clang] Fix handling of explicit parameters in `SemaLambda` (#168558)
Previously, the presence of an explicit parameter list was detected by
querying `getNumTypeObjects()` from the `Declarator` block of the lambda
definition. This breaks for lambdas which do not have a parameter list
but _do_ have a trailing return type; that is, both of
```
[]() -> int { return 0; };
[] -> int { return 0; };
```
would return `true` when inspecting
`LambdaExpr::hasExplicitParameters()`.
Fix this by instead querying the `LParenLoc()` from the `Declarator`'s
`FunctionTypeInfo`. If `isValid() == true`, then an explicit parameter
list must be present, and if it is `false`, then it is not.
This commit also adds `hasExplicitParameters` as an attribute to a
`LambdaExpr`'s JSON AST dump. A new test (`ast-dump-lambda-json.cpp`) is
also added to validate the fix and presence of the new attribute in the
output. `ast-dump-expr-json.cpp` is also updated to validate the new
attribute.
Fixes https://github.com/llvm/llvm-project/issues/168452.
Diffstat (limited to 'lldb/test/Shell/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test')
0 files changed, 0 insertions, 0 deletions
