clang 23.0.0git
SerializationFormatRegistry.cpp
Go to the documentation of this file.
1//===- SerializationFormatRegistry.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#include <memory>
11
12using namespace clang;
13using namespace ssaf;
14
15LLVM_INSTANTIATE_REGISTRY(SerializationFormatRegistry)
16
17bool ssaf::isFormatRegistered(llvm::StringRef FormatName) {
18 for (const auto &Entry : SerializationFormatRegistry::entries())
19 if (Entry.getName() == FormatName)
20 return true;
21 return false;
22}
23
24std::unique_ptr<SerializationFormat>
25ssaf::makeFormat(llvm::StringRef FormatName) {
26 for (const auto &Entry : SerializationFormatRegistry::entries())
27 if (Entry.getName() == FormatName)
28 return Entry.instantiate();
29 assert(false && "Unknown SerializationFormat name");
30 return nullptr;
31}
std::unique_ptr< SerializationFormat > makeFormat(llvm::StringRef FormatName)
Try to instantiate a SerializationFormat with a given name.
llvm::Registry< SerializationFormat > SerializationFormatRegistry
bool isFormatRegistered(llvm::StringRef FormatName)
Check if a SerializationFormat was registered with a given name.
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30