aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/clang16/include/clang/ExtractAPI/Serialization/SerializerBase.h
blob: 7ac5aba75487d9b1f2d02c068bf1938ea7b24fde (plain) (blame)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif

//===- ExtractAPI/Serialization/SerializerBase.h ----------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file defines the ExtractAPI APISerializer interface.
///
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_EXTRACTAPI_SERIALIZATION_SERIALIZERBASE_H
#define LLVM_CLANG_EXTRACTAPI_SERIALIZATION_SERIALIZERBASE_H

#include "clang/ExtractAPI/API.h"
#include "clang/ExtractAPI/APIIgnoresList.h"
#include "llvm/Support/raw_ostream.h"

namespace clang {
namespace extractapi {

/// Common options to customize the serializer output.
struct APISerializerOption {
  /// Do not include unnecessary whitespaces to save space.
  bool Compact;
};

/// The base interface of serializers for API information.
class APISerializer {
public:
  /// Serialize the API information to \p os.
  virtual void serialize(raw_ostream &os) = 0;

protected:
  const APISet &API;

  /// The list of symbols to ignore.
  ///
  /// Note: This should be consulted before emitting a symbol.
  const APIIgnoresList &IgnoresList;

  APISerializerOption Options;

public:
  APISerializer() = delete;
  APISerializer(const APISerializer &) = delete;
  APISerializer(APISerializer &&) = delete;
  APISerializer &operator=(const APISerializer &) = delete;
  APISerializer &operator=(APISerializer &&) = delete;

protected:
  APISerializer(const APISet &API, const APIIgnoresList &IgnoresList,
                APISerializerOption Options = {})
      : API(API), IgnoresList(IgnoresList), Options(Options) {}

  virtual ~APISerializer() = default;
};

} // namespace extractapi
} // namespace clang

#endif // LLVM_CLANG_EXTRACTAPI_SERIALIZATION_SERIALIZERBASE_H

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif