| 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 | |
| 9 | #include "clang/Analysis/Scalable/Serialization/SerializationFormatRegistry.h" |
| 10 | #include <memory> |
| 11 | |
| 12 | using namespace clang; |
| 13 | using namespace ssaf; |
| 14 | |
| 15 | LLVM_INSTANTIATE_REGISTRY(SerializationFormatRegistry) |
| 16 | |
| 17 | bool 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 | |
| 24 | std::unique_ptr<SerializationFormat> |
| 25 | ssaf::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 | } |
| 32 |