[clang-tools-extra] Improve attribute range handling for attributed function types in sel… (PR #163926)
Quan Zhuo via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 1 00:10:02 PDT 2025
=?utf-8?b?5YWo5Y2T?= <quanzhuo at kylinos.cn>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/163926 at github.com>
quanzhuo wrote:
Hi @HighCommander4
Thanks for the review! I've added the test for selecting `AttributedTypeLoc`, when the cursor is on the attribute. However, I'm having trouble with the second test case I added. It's failing with a range mismatch:
```
D:\repos\llvm-project\clang-tools-extra\clangd\unittests\SelectionTests.cpp:635
Expected equality of these values:
nodeRange(T.commonAncestor(), AST)
Which is: 0:17-0:57
Test.range()
Which is: 0:17-0:60
struct X { const [[int* Foo() const <:[clang::life^timebound]:>]] {return nullptr;}; };
TranslationUnitDecl
CXXRecordDecl struct X {}
CXXMethodDecl const int *Foo() const
.AttributedTypeLoc const int *() const [[clang::lifetimebound]]
```
The issue appears to be that the test annotation parser stops at the `]` in `]:>`, which truncates the expected range marker.
Thanks for your guidance!
https://github.com/llvm/llvm-project/pull/163926
More information about the cfe-commits
mailing list