clang 24.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_DEFINE_REGISTRY_EX(CLANG_ABI_EXPORT, 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>
33SummaryDataBuilderRegistry::instantiate(llvm::StringRef Name) {
34 const auto *Entry = findEntry(Name);
35 return Entry ? Entry->instantiate() : nullptr;
36}
LLVM_DEFINE_REGISTRY_EX(CLANG_ABI_EXPORT, llvm::Registry< JSONFormat::FormatInfo >) LLVM_DEFINE_REGISTRY_EX(CLANG_ABI_EXPORT
llvm::Registry< SummaryDataBuilderBase > RegistryT
The JSON file list parser is used to communicate input to InstallAPI.