clang 24.0.0git
FormatProviders.h
Go to the documentation of this file.
1//===- FormatProviders.h - llvm::formatv support for SSAF types -*- C++ -*-===//
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// This file provides llvm::format_provider specialisations for SSAF model
10// types, enabling them to be used directly with llvm::formatv and ErrorBuilder.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_SUPPORT_FORMATPROVIDERS_H
15#define LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_SUPPORT_FORMATPROVIDERS_H
16
23#include "llvm/Support/FormatProviders.h"
24#include "llvm/Support/raw_ostream.h"
25#include "llvm/TargetParser/Triple.h"
26
27namespace llvm {
28
29template <> struct format_provider<clang::ssaf::EntityId> {
30 static void format(const clang::ssaf::EntityId &Val, raw_ostream &OS,
31 StringRef Style) {
32 OS << Val;
33 }
34};
35
36template <> struct format_provider<clang::ssaf::EntityLinkageType> {
37 static void format(clang::ssaf::EntityLinkageType Val, raw_ostream &OS,
38 StringRef Style) {
39 OS << Val;
40 }
41};
42
43template <> struct format_provider<clang::ssaf::EntityLinkage> {
44 static void format(clang::ssaf::EntityLinkage Val, raw_ostream &OS,
45 StringRef Style) {
46 OS << Val;
47 }
48};
49
50template <> struct format_provider<clang::ssaf::BuildNamespaceKind> {
51 static void format(clang::ssaf::BuildNamespaceKind Val, raw_ostream &OS,
52 StringRef Style) {
53 OS << Val;
54 }
55};
56
57template <> struct format_provider<clang::ssaf::BuildNamespace> {
58 static void format(const clang::ssaf::BuildNamespace &Val, raw_ostream &OS,
59 StringRef Style) {
60 OS << Val;
61 }
62};
63
64template <> struct format_provider<clang::ssaf::NestedBuildNamespace> {
66 raw_ostream &OS, StringRef Style) {
67 OS << Val;
68 }
69};
70
71template <> struct format_provider<clang::ssaf::EntityName> {
72 static void format(const clang::ssaf::EntityName &Val, raw_ostream &OS,
73 StringRef Style) {
74 OS << Val;
75 }
76};
77
78template <> struct format_provider<clang::ssaf::SummaryName> {
79 static void format(const clang::ssaf::SummaryName &Val, raw_ostream &OS,
80 StringRef Style) {
81 OS << Val;
82 }
83};
84
85template <> struct format_provider<clang::ssaf::AnalysisName> {
86 static void format(const clang::ssaf::AnalysisName &Val, raw_ostream &OS,
87 StringRef Style) {
88 OS << Val;
89 }
90};
91
92template <> struct format_provider<llvm::Triple> {
93 static void format(const llvm::Triple &Val, raw_ostream &OS,
94 StringRef Style) {
95 OS << llvm::Triple::normalize(Val.str());
96 }
97};
98
99} // namespace llvm
100
101#endif // LLVM_CLANG_SCALABLESTATICANALYSIS_CORE_SUPPORT_FORMATPROVIDERS_H
Uniquely identifies a whole-program analysis and the AnalysisResult it produces.
Represents a single namespace in the build process.
Lightweight opaque handle representing an entity in an EntityIdTable.
Definition EntityId.h:31
Represents the linkage properties of an entity in the program model.
Uniquely identifies an entity in a program.
Definition EntityName.h:28
Represents a hierarchical sequence of build namespaces.
Uniquely identifies an analysis summary.
Definition SummaryName.h:22
Top level wrappers for InstallAPI frontend operations.
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30
static void format(const clang::ssaf::AnalysisName &Val, raw_ostream &OS, StringRef Style)
static void format(clang::ssaf::BuildNamespaceKind Val, raw_ostream &OS, StringRef Style)
static void format(const clang::ssaf::BuildNamespace &Val, raw_ostream &OS, StringRef Style)
static void format(const clang::ssaf::EntityId &Val, raw_ostream &OS, StringRef Style)
static void format(clang::ssaf::EntityLinkageType Val, raw_ostream &OS, StringRef Style)
static void format(clang::ssaf::EntityLinkage Val, raw_ostream &OS, StringRef Style)
static void format(const clang::ssaf::EntityName &Val, raw_ostream &OS, StringRef Style)
static void format(const clang::ssaf::NestedBuildNamespace &Val, raw_ostream &OS, StringRef Style)
static void format(const clang::ssaf::SummaryName &Val, raw_ostream &OS, StringRef Style)
static void format(const llvm::Triple &Val, raw_ostream &OS, StringRef Style)