================ @@ -0,0 +1,343 @@ +//===- unittests/Analysis/Scalable/ASTEntityMappingTest.cpp --------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "clang/Analysis/Scalable/ASTEntityMapping.h" +#include "clang/AST/ASTContext.h" +#include "clang/AST/Decl.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" +#include "clang/Tooling/Tooling.h" +#include "gtest/gtest.h" + +using namespace clang::ast_matchers; + +namespace clang { +namespace ssaf { +namespace { + +// Helper function to find a declaration by name +template <typename DeclType> +const DeclType *findDecl(ASTContext &Ctx, StringRef Name) { + auto Matcher = namedDecl(hasName(Name)).bind("decl"); + auto Matches = match(Matcher, Ctx); + if (Matches.empty()) + return nullptr; + return Matches[0].getNodeAs<DeclType>("decl"); ---------------- steakhal wrote:
Shall we express the expectation that there should be no more than a single match? https://github.com/llvm/llvm-project/pull/169131 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
