1/*===-- llvm-c/Support.h - C Interface Types declarations ---------*- C -*-===*\
2|*                                                                            *|
3|* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
4|* 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|* This file defines types used by the C interface to LLVM.                   *|
11|*                                                                            *|
12\*===----------------------------------------------------------------------===*/
13
14#ifndef LLVM_C_TYPES_H
15#define LLVM_C_TYPES_H
16
17#include "llvm-c/DataTypes.h"
18#include "llvm-c/ExternC.h"
19
20LLVM_C_EXTERN_C_BEGIN
21
22/**
23 * @defgroup LLVMCSupportTypes Types and Enumerations
24 *
25 * @{
26 */
27
28typedef int LLVMBool;
29
30/* Opaque types. */
31
32/**
33 * LLVM uses a polymorphic type hierarchy which C cannot represent, therefore
34 * parameters must be passed as base types. Despite the declared types, most
35 * of the functions provided operate only on branches of the type hierarchy.
36 * The declared parameter names are descriptive and specify which type is
37 * required. Additionally, each type hierarchy is documented along with the
38 * functions that operate upon it. For more detail, refer to LLVM's C++ code.
39 * If in doubt, refer to Core.cpp, which performs parameter downcasts in the
40 * form unwrap<RequiredType>(Param).
41 */
42
43/**
44 * Used to pass regions of memory through LLVM interfaces.
45 *
46 * @see llvm::MemoryBuffer
47 */
48typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef;
49
50/**
51 * The top-level container for all LLVM global data. See the LLVMContext class.
52 */
53typedef struct LLVMOpaqueContext *LLVMContextRef;
54
55/**
56 * The top-level container for all other LLVM Intermediate Representation (IR)
57 * objects.
58 *
59 * @see llvm::Module
60 */
61typedef struct LLVMOpaqueModule *LLVMModuleRef;
62
63/**
64 * Each value in the LLVM IR has a type, an LLVMTypeRef.
65 *
66 * @see llvm::Type
67 */
68typedef struct LLVMOpaqueType *LLVMTypeRef;
69
70/**
71 * Represents an individual value in LLVM IR.
72 *
73 * This models llvm::Value.
74 */
75typedef struct LLVMOpaqueValue *LLVMValueRef;
76
77/**
78 * Represents a basic block of instructions in LLVM IR.
79 *
80 * This models llvm::BasicBlock.
81 */
82typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
83
84/**
85 * Represents an LLVM Metadata.
86 *
87 * This models llvm::Metadata.
88 */
89typedef struct LLVMOpaqueMetadata *LLVMMetadataRef;
90
91/**
92 * Represents an LLVM Named Metadata Node.
93 *
94 * This models llvm::NamedMDNode.
95 */
96typedef struct LLVMOpaqueNamedMDNode *LLVMNamedMDNodeRef;
97
98/**
99 * Represents an entry in a Global Object's metadata attachments.
100 *
101 * This models std::pair<unsigned, MDNode *>
102 */
103typedef struct LLVMOpaqueValueMetadataEntry LLVMValueMetadataEntry;
104
105/**
106 * Represents an LLVM basic block builder.
107 *
108 * This models llvm::IRBuilder.
109 */
110typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
111
112/**
113 * Represents an LLVM debug info builder.
114 *
115 * This models llvm::DIBuilder.
116 */
117typedef struct LLVMOpaqueDIBuilder *LLVMDIBuilderRef;
118
119/**
120 * Interface used to provide a module to JIT or interpreter.
121 * This is now just a synonym for llvm::Module, but we have to keep using the
122 * different type to keep binary compatibility.
123 */
124typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
125
126/** @see llvm::PassManagerBase */
127typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
128
129/** @see llvm::PassRegistry */
130typedef struct LLVMOpaquePassRegistry *LLVMPassRegistryRef;
131
132/**
133 * Used to get the users and usees of a Value.
134 *
135 * @see llvm::Use */
136typedef struct LLVMOpaqueUse *LLVMUseRef;
137
138/**
139 * Used to represent an attributes.
140 *
141 * @see llvm::Attribute
142 */
143typedef struct LLVMOpaqueAttributeRef *LLVMAttributeRef;
144
145/**
146 * @see llvm::DiagnosticInfo
147 */
148typedef struct LLVMOpaqueDiagnosticInfo *LLVMDiagnosticInfoRef;
149
150/**
151 * @see llvm::Comdat
152 */
153typedef struct LLVMComdat *LLVMComdatRef;
154
155/**
156 * @see llvm::Module::ModuleFlagEntry
157 */
158typedef struct LLVMOpaqueModuleFlagEntry LLVMModuleFlagEntry;
159
160/**
161 * @see llvm::JITEventListener
162 */
163typedef struct LLVMOpaqueJITEventListener *LLVMJITEventListenerRef;
164
165/**
166 * @see llvm::object::Binary
167 */
168typedef struct LLVMOpaqueBinary *LLVMBinaryRef;
169
170/**
171 * @}
172 */
173
174LLVM_C_EXTERN_C_END
175
176#endif
177