clang 23.0.0git
SummaryDataBuilderRegistry.cpp
Go to the documentation of this file.
1//===- SummaryDataBuilderRegistry.cpp -------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
11using namespace clang;
12using namespace ssaf;
13
14using RegistryT = llvm::Registry<SummaryDataBuilderBase>;
15LLVM_INSTANTIATE_REGISTRY(RegistryT)
16
17namespace {
18const RegistryT::entry *findEntry(llvm::StringRef Name) {
19 for (const auto &Entry : RegistryT::entries()) {
20 if (Entry.getName() == Name) {
21 return &Entry;
22 }
23 }
24 return nullptr;
25}
26} // namespace
27
28bool SummaryDataBuilderRegistry::contains(llvm::StringRef Name) {
29 return findEntry(Name) != nullptr;
30}
31
32std::unique_ptr<SummaryDataBuilderBase>
34 const auto *Entry = findEntry(Name);
35 return Entry ? Entry->instantiate() : nullptr;
36}
llvm::Registry< SummaryDataBuilderBase > RegistryT
static bool contains(llvm::StringRef Name)
Returns true if a builder is registered under Name.
static std::unique_ptr< SummaryDataBuilderBase > instantiate(llvm::StringRef Name)
Instantiates the builder registered under Name, or returns nullptr if no such builder is registered.
The JSON file list parser is used to communicate input to InstallAPI.