[all-commits] [llvm/llvm-project] 0a75f1: [libclang]Visit lambda init-capture as VarDeclarat...

Serafean via All-commits all-commits at lists.llvm.org
Mon Jul 27 06:38:24 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0a75f1f77fe54e9e366e48f78c9865aee8839809
      https://github.com/llvm/llvm-project/commit/0a75f1f77fe54e9e366e48f78c9865aee8839809
  Author: Serafean <martin at serafean.cz>
  Date:   2026-07-27 (Mon, 27 Jul 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.md
    M clang/test/Index/cxx14-lambdas.cpp
    M clang/tools/libclang/CIndex.cpp

  Log Message:
  -----------
  [libclang]Visit lambda init-capture as VarDeclaration (#174116)

```
int foo(){
    int i = 42;
    int j = 43;

    auto l1 = [x = i, &j ](){};
}
```

in the lambda capture:
- `x` is visited as VariableRef (referencing an unvisited VarDecl at the
same location)
- `i` is visited as DelcRefExpr (fair enough, same as in an assignment)
- `j` is visited as VariableRef

Visit `x` as a `VarDecl`, and stop visiting it as a `VariableRef`, as it
makes no sense (referencing itself at an unvisited cursor).

---------

Co-authored-by: Serafean <Serafean at users.noreply.github.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list