clang 19.0.0git
APIIgnoresList.h
Go to the documentation of this file.
1//===- ExtractAPI/APIIgnoresList.h ---------------*- 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/// \file This file defines APIIgnoresList which is a type that allows querying
10/// files containing symbols to ignore when extracting API information.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_API_IGNORES_LIST_H
15#define LLVM_CLANG_API_IGNORES_LIST_H
16
18#include "llvm/ADT/SmallVector.h"
19#include "llvm/ADT/StringRef.h"
20#include "llvm/Support/Error.h"
21#include "llvm/Support/raw_ostream.h"
22
23#include <memory>
24#include <system_error>
25
26namespace llvm {
27class MemoryBuffer;
28} // namespace llvm
29
30namespace clang {
31namespace extractapi {
32
33struct IgnoresFileNotFound : public llvm::ErrorInfo<IgnoresFileNotFound> {
34 std::string Path;
35 static char ID;
36
37 explicit IgnoresFileNotFound(StringRef Path) : Path(Path) {}
38
39 virtual void log(llvm::raw_ostream &os) const override;
40
41 virtual std::error_code convertToErrorCode() const override;
42};
43
44/// A type that provides access to a new line separated list of symbol names to
45/// ignore when extracting API information.
47 using FilePathList = std::vector<std::string>;
48
49 /// The API to use for generating from the files at \p IgnoresFilePathList.
50 ///
51 /// \returns an initialized APIIgnoresList or an Error.
53 create(const FilePathList &IgnoresFilePathList, FileManager &FM);
54
55 APIIgnoresList() = default;
56
57 /// Check if \p SymbolName is specified in the APIIgnoresList and if it should
58 /// therefore be ignored.
59 bool shouldIgnore(llvm::StringRef SymbolName) const;
60
61private:
64
65 APIIgnoresList(SymbolNameList SymbolsToIgnore, BufferList Buffers)
66 : SymbolsToIgnore(std::move(SymbolsToIgnore)),
67 Buffers(std::move(Buffers)) {}
68
69 SymbolNameList SymbolsToIgnore;
70 BufferList Buffers;
71};
72
73} // namespace extractapi
74} // namespace clang
75
76#endif // LLVM_CLANG_API_IGNORES_LIST_H
Defines the clang::FileManager interface and associated types.
Implements support for file system lookup, file system caching, and directory search management.
Definition: FileManager.h:53
The JSON file list parser is used to communicate input to InstallAPI.
YAML serialization mapping.
Definition: Dominators.h:30
Definition: Format.h:5304
A type that provides access to a new line separated list of symbol names to ignore when extracting AP...
std::vector< std::string > FilePathList
bool shouldIgnore(llvm::StringRef SymbolName) const
Check if SymbolName is specified in the APIIgnoresList and if it should therefore be ignored.
static llvm::Expected< APIIgnoresList > create(const FilePathList &IgnoresFilePathList, FileManager &FM)
The API to use for generating from the files at IgnoresFilePathList.
virtual std::error_code convertToErrorCode() const override
#define log(__x)
Definition: tgmath.h:460