clang 17.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/// a file 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 /// The API to use for generating from the file at \p IgnoresFilePath.
48 ///
49 /// \returns an initialized APIIgnoresList or an Error.
50 static llvm::Expected<APIIgnoresList> create(llvm::StringRef IgnoresFilePath,
51 FileManager &FM);
52
53 APIIgnoresList() = default;
54
55 /// Check if \p SymbolName is specified in the APIIgnoresList and if it should
56 /// therefore be ignored.
57 bool shouldIgnore(llvm::StringRef SymbolName) const;
58
59private:
61
62 APIIgnoresList(SymbolNameList SymbolsToIgnore,
63 std::unique_ptr<llvm::MemoryBuffer> Buffer)
64 : SymbolsToIgnore(std::move(SymbolsToIgnore)), Buffer(std::move(Buffer)) {
65 }
66
67 SymbolNameList SymbolsToIgnore;
68 std::unique_ptr<llvm::MemoryBuffer> Buffer;
69};
70
71} // namespace extractapi
72} // namespace clang
73
74#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
YAML serialization mapping.
Definition: Dominators.h:30
Definition: Format.h:4608
A type that provides access to a new line separated list of symbol names to ignore when extracting AP...
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(llvm::StringRef IgnoresFilePath, FileManager &FM)
The API to use for generating from the file at IgnoresFilePath.
virtual std::error_code convertToErrorCode() const override
#define log(__x)
Definition: tgmath.h:460