| Issue |
76425
|
| Summary |
ast_matcher capturesVar assertion failed in debug mode
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
qqiangwu
|
https://github.com/llvm/llvm-project/blob/2476e2a91140b57ca3ad0792597be4f4d20ddb1a/clang/include/clang/ASTMatchers/ASTMatchers.h#L4818
```C++
AST_MATCHER_P(LambdaCapture, capturesVar, internal::Matcher<ValueDecl>,
InnerMatcher) {
auto *capturedVar = Node.getCapturedVar();
return capturedVar && InnerMatcher.matches(*capturedVar, Finder, Builder);
}
```
```C++
ValueDecl *getCapturedVar() const {
assert(capturesVariable() && "No variable available for capture");
return static_cast<ValueDecl *>(DeclAndBits.getPointer());
}
```
The matcher relies on getCapturedVar returns nullptr if not captured, but the implementation asserts `capturesVariable()`
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs