xref: /llvm-project/clang/include/clang/ExtractAPI/ExtractAPIActionBase.h (revision e05c1b46d0d3739cc48ad912dbe6e9affce05927)
1 //===- ExtractAPI/ExtractAPIActionBase.h -----------------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// This file defines the ExtractAPIActionBase class.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_EXTRACTAPI_ACTION_BASE_H
16 #define LLVM_CLANG_EXTRACTAPI_ACTION_BASE_H
17 
18 #include "clang/ExtractAPI/API.h"
19 #include "clang/ExtractAPI/APIIgnoresList.h"
20 #include "clang/Frontend/CompilerInstance.h"
21 #include "llvm/Support/raw_ostream.h"
22 
23 namespace clang {
24 
25 /// Base class to be used by front end actions to generate ExtarctAPI info
26 ///
27 /// Deriving from this class equips an action with all the necessary tools to
28 /// generate ExractAPI information in form of symbol-graphs
29 class ExtractAPIActionBase {
30 protected:
31   /// A representation of the APIs this action extracts.
32   std::unique_ptr<extractapi::APISet> API;
33 
34   /// A stream to the main output file of this action.
35   std::unique_ptr<llvm::raw_pwrite_stream> OS;
36 
37   /// The product this action is extracting API information for.
38   std::string ProductName;
39 
40   /// The synthesized input buffer that contains all the provided input header
41   /// files.
42   std::unique_ptr<llvm::MemoryBuffer> Buffer;
43 
44   /// The list of symbols to ignore during serialization
45   extractapi::APIIgnoresList IgnoresList;
46 
47   /// Implements EndSourceFileAction for Symbol-Graph generation
48   ///
49   /// Use the serializer to generate output symbol graph files from
50   /// the information gathered during the execution of Action.
51   void ImplEndSourceFileAction(CompilerInstance &CI);
52 };
53 
54 } // namespace clang
55 
56 #endif // LLVM_CLANG_EXTRACTAPI_ACTION_BASE_H
57