aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis/Scalable/Serialization/SerializationFormatRegistry.cpp
blob: 7cfa4370aa9ed6c207899cb73240ae0ffafd816f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//===- SerializationFormatRegistry.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/Serialization/SerializationFormatRegistry.h"
#include <memory>

using namespace clang;
using namespace ssaf;

LLVM_INSTANTIATE_REGISTRY(SerializationFormatRegistry)

bool ssaf::isFormatRegistered(llvm::StringRef FormatName) {
  for (const auto &Entry : SerializationFormatRegistry::entries())
    if (Entry.getName() == FormatName)
      return true;
  return false;
}

std::unique_ptr<SerializationFormat>
ssaf::makeFormat(llvm::StringRef FormatName) {
  for (const auto &Entry : SerializationFormatRegistry::entries())
    if (Entry.getName() == FormatName)
      return Entry.instantiate();
  assert(false && "Unknown SerializationFormat name");
  return nullptr;
}