clang 23.0.0git
TransformationRegistry.cpp
Go to the documentation of this file.
1//===- TransformationRegistry.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
15namespace clang::ssaf {
16// NOLINTNEXTLINE(misc-use-internal-linkage)
18} // namespace clang::ssaf
19
20LLVM_DEFINE_REGISTRY(clang::ssaf::TransformationRegistry)
21
22bool ssaf::isTransformationRegistered(llvm::StringRef Name) {
23 for (const auto &Entry : TransformationRegistry::entries())
24 if (Entry.getName() == Name)
25 return true;
26 return false;
27}
28
29std::unique_ptr<Transformation>
30ssaf::makeTransformation(llvm::StringRef Name, const WPASuite &Suite,
31 SourceEditEmitter &Edits,
33 for (const auto &Entry : TransformationRegistry::entries())
34 if (Entry.getName() == Name)
35 return Entry.instantiate(Suite, Edits, Report);
36 assert(false && "Unknown Transformation name");
37 return nullptr;
38}
39
40void ssaf::printAvailableTransformations(llvm::raw_ostream &OS) {
41 OS << "OVERVIEW: Available SSAF source transformations:\n\n";
42 for (const auto &Entry : TransformationRegistry::entries())
43 OS << " " << Entry.getName() << " - " << Entry.getDesc() << "\n";
44}
Bundles the EntityIdTable (moved from the LUSummary) and the analysis results produced by one Analysi...
Definition WPASuite.h:37
void printAvailableTransformations(llvm::raw_ostream &OS)
Print the list of available Transformations.
llvm::Registry< Transformation, const WPASuite &, SourceEditEmitter &, TransformationReportEmitter & > TransformationRegistry
std::unique_ptr< Transformation > makeTransformation(llvm::StringRef Name, const WPASuite &Suite, SourceEditEmitter &Edits, TransformationReportEmitter &Report)
Try to instantiate a Transformation with a given name.
bool isTransformationRegistered(llvm::StringRef Name)
Check if a Transformation was registered with a given name.
volatile int SSAFSourceTransformationAnchorSource
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30