[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / llvm / include / llvm-c / Types.h
blob4e02498a234846fb34808ca0b9c6723c0a51cc5e
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 \*===----------------------------------------------------------------------===*/
14 #ifndef LLVM_C_TYPES_H
15 #define LLVM_C_TYPES_H
17 #include "llvm-c/DataTypes.h"
18 #include "llvm-c/ExternC.h"
20 LLVM_C_EXTERN_C_BEGIN
22 /**
23 * @defgroup LLVMCSupportTypes Types and Enumerations
25 * @{
28 typedef int LLVMBool;
30 /* Opaque types. */
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).
43 /**
44 * Used to pass regions of memory through LLVM interfaces.
46 * @see llvm::MemoryBuffer
48 typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef;
50 /**
51 * The top-level container for all LLVM global data. See the LLVMContext class.
53 typedef struct LLVMOpaqueContext *LLVMContextRef;
55 /**
56 * The top-level container for all other LLVM Intermediate Representation (IR)
57 * objects.
59 * @see llvm::Module
61 typedef struct LLVMOpaqueModule *LLVMModuleRef;
63 /**
64 * Each value in the LLVM IR has a type, an LLVMTypeRef.
66 * @see llvm::Type
68 typedef struct LLVMOpaqueType *LLVMTypeRef;
70 /**
71 * Represents an individual value in LLVM IR.
73 * This models llvm::Value.
75 typedef struct LLVMOpaqueValue *LLVMValueRef;
77 /**
78 * Represents a basic block of instructions in LLVM IR.
80 * This models llvm::BasicBlock.
82 typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
84 /**
85 * Represents an LLVM Metadata.
87 * This models llvm::Metadata.
89 typedef struct LLVMOpaqueMetadata *LLVMMetadataRef;
91 /**
92 * Represents an LLVM Named Metadata Node.
94 * This models llvm::NamedMDNode.
96 typedef struct LLVMOpaqueNamedMDNode *LLVMNamedMDNodeRef;
98 /**
99 * Represents an entry in a Global Object's metadata attachments.
101 * This models std::pair<unsigned, MDNode *>
103 typedef struct LLVMOpaqueValueMetadataEntry LLVMValueMetadataEntry;
106 * Represents an LLVM basic block builder.
108 * This models llvm::IRBuilder.
110 typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
113 * Represents an LLVM debug info builder.
115 * This models llvm::DIBuilder.
117 typedef struct LLVMOpaqueDIBuilder *LLVMDIBuilderRef;
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.
124 typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
126 /** @see llvm::PassManagerBase */
127 typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
129 /** @see llvm::PassRegistry */
130 typedef struct LLVMOpaquePassRegistry *LLVMPassRegistryRef;
133 * Used to get the users and usees of a Value.
135 * @see llvm::Use */
136 typedef struct LLVMOpaqueUse *LLVMUseRef;
139 * Used to represent an attributes.
141 * @see llvm::Attribute
143 typedef struct LLVMOpaqueAttributeRef *LLVMAttributeRef;
146 * @see llvm::DiagnosticInfo
148 typedef struct LLVMOpaqueDiagnosticInfo *LLVMDiagnosticInfoRef;
151 * @see llvm::Comdat
153 typedef struct LLVMComdat *LLVMComdatRef;
156 * @see llvm::Module::ModuleFlagEntry
158 typedef struct LLVMOpaqueModuleFlagEntry LLVMModuleFlagEntry;
161 * @see llvm::JITEventListener
163 typedef struct LLVMOpaqueJITEventListener *LLVMJITEventListenerRef;
166 * @see llvm::object::Binary
168 typedef struct LLVMOpaqueBinary *LLVMBinaryRef;
171 * @}
174 LLVM_C_EXTERN_C_END
176 #endif