Skip to content

ast_matcher capturesVar assertion failed in debug mode #76425

@qqiangwu

Description

@qqiangwu

AST_MATCHER_P(LambdaCapture, capturesVar, internal::Matcher<ValueDecl>,

AST_MATCHER_P(LambdaCapture, capturesVar, internal::Matcher<ValueDecl>,
              InnerMatcher) {
  auto *capturedVar = Node.getCapturedVar();
  return capturedVar && InnerMatcher.matches(*capturedVar, Finder, Builder);
}
  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()

Metadata

Metadata

Assignees

Labels

clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions