Skip to content

Commit 1ded8b5

Browse files
committed
[🌲] Make local copies of LLVM headers used for RemoteInspection.
We don't want to directly include headers from the LLVM project, since they may change. Copy them locally and refer to them there instead. rdar://112982181
1 parent 58c00b1 commit 1ded8b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+16929
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*===-- include/llvm-c/DataTypes.h - Define fixed size types ------*- 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 contains definitions to figure out the size of _HOST_ data types.*|
11+
|* This file is important because different host OS's define different macros,*|
12+
|* which makes portability tough. This file exports the following *|
13+
|* definitions: *|
14+
|* *|
15+
|* [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
16+
|* [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. *|
17+
|* *|
18+
|* No library is required when using these functions. *|
19+
|* *|
20+
|*===----------------------------------------------------------------------===*/
21+
22+
/* Please leave this file C-compatible. */
23+
24+
#ifndef LLVM_C_DATATYPES_H
25+
#define LLVM_C_DATATYPES_H
26+
27+
#include <inttypes.h>
28+
#include <stdint.h>
29+
30+
#ifndef _MSC_VER
31+
32+
#if !defined(UINT32_MAX)
33+
# error "The standard header <cstdint> is not C++11 compliant. Must #define "\
34+
"__STDC_LIMIT_MACROS before #including llvm-c/DataTypes.h"
35+
#endif
36+
37+
#if !defined(UINT32_C)
38+
# error "The standard header <cstdint> is not C++11 compliant. Must #define "\
39+
"__STDC_CONSTANT_MACROS before #including llvm-c/DataTypes.h"
40+
#endif
41+
42+
/* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
43+
#include <sys/types.h>
44+
45+
#ifdef _AIX
46+
// GCC is strict about defining large constants: they must have LL modifier.
47+
#undef INT64_MAX
48+
#undef INT64_MIN
49+
#endif
50+
51+
#else /* _MSC_VER */
52+
#ifdef __cplusplus
53+
#include <cstddef>
54+
#include <cstdlib>
55+
#else
56+
#include <stddef.h>
57+
#include <stdlib.h>
58+
#endif
59+
#include <sys/types.h>
60+
61+
#if defined(_WIN64)
62+
typedef signed __int64 ssize_t;
63+
#else
64+
typedef signed int ssize_t;
65+
#endif /* _WIN64 */
66+
67+
#endif /* _MSC_VER */
68+
69+
/* Set defaults for constants which we cannot find. */
70+
#if !defined(INT64_MAX)
71+
# define INT64_MAX 9223372036854775807LL
72+
#endif
73+
#if !defined(INT64_MIN)
74+
# define INT64_MIN ((-INT64_MAX)-1)
75+
#endif
76+
#if !defined(UINT64_MAX)
77+
# define UINT64_MAX 0xffffffffffffffffULL
78+
#endif
79+
80+
#endif /* LLVM_C_DATATYPES_H */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*===------- llvm-c/Error.h - llvm::Error class C Interface -------*- 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 the C interface to LLVM's Error class. *|
11+
|* *|
12+
\*===----------------------------------------------------------------------===*/
13+
14+
#ifndef LLVM_C_ERROR_H
15+
#define LLVM_C_ERROR_H
16+
17+
#include "llvm-c/ExternC.h"
18+
19+
LLVM_C_EXTERN_C_BEGIN
20+
21+
/**
22+
* @defgroup LLVMCError Error Handling
23+
* @ingroup LLVMC
24+
*
25+
* @{
26+
*/
27+
28+
#define LLVMErrorSuccess 0
29+
30+
/**
31+
* Opaque reference to an error instance. Null serves as the 'success' value.
32+
*/
33+
typedef struct LLVMOpaqueError *LLVMErrorRef;
34+
35+
/**
36+
* Error type identifier.
37+
*/
38+
typedef const void *LLVMErrorTypeId;
39+
40+
/**
41+
* Returns the type id for the given error instance, which must be a failure
42+
* value (i.e. non-null).
43+
*/
44+
LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err);
45+
46+
/**
47+
* Dispose of the given error without handling it. This operation consumes the
48+
* error, and the given LLVMErrorRef value is not usable once this call returns.
49+
* Note: This method *only* needs to be called if the error is not being passed
50+
* to some other consuming operation, e.g. LLVMGetErrorMessage.
51+
*/
52+
void LLVMConsumeError(LLVMErrorRef Err);
53+
54+
/**
55+
* Returns the given string's error message. This operation consumes the error,
56+
* and the given LLVMErrorRef value is not usable once this call returns.
57+
* The caller is responsible for disposing of the string by calling
58+
* LLVMDisposeErrorMessage.
59+
*/
60+
char *LLVMGetErrorMessage(LLVMErrorRef Err);
61+
62+
/**
63+
* Dispose of the given error message.
64+
*/
65+
void LLVMDisposeErrorMessage(char *ErrMsg);
66+
67+
/**
68+
* Returns the type id for llvm StringError.
69+
*/
70+
LLVMErrorTypeId LLVMGetStringErrorTypeId(void);
71+
72+
/**
73+
* Create a StringError.
74+
*/
75+
LLVMErrorRef LLVMCreateStringError(const char *ErrMsg);
76+
77+
/**
78+
* @}
79+
*/
80+
81+
LLVM_C_EXTERN_C_END
82+
83+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*===- llvm-c/ExternC.h - Wrapper for 'extern "C"' ----------------*- 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 an 'extern "C"' wrapper *|
11+
|* *|
12+
\*===----------------------------------------------------------------------===*/
13+
14+
#ifndef LLVM_C_EXTERNC_H
15+
#define LLVM_C_EXTERNC_H
16+
17+
#ifdef __clang__
18+
#define LLVM_C_STRICT_PROTOTYPES_BEGIN \
19+
_Pragma("clang diagnostic push") \
20+
_Pragma("clang diagnostic error \"-Wstrict-prototypes\"")
21+
#define LLVM_C_STRICT_PROTOTYPES_END _Pragma("clang diagnostic pop")
22+
#else
23+
#define LLVM_C_STRICT_PROTOTYPES_BEGIN
24+
#define LLVM_C_STRICT_PROTOTYPES_END
25+
#endif
26+
27+
#ifdef __cplusplus
28+
#define LLVM_C_EXTERN_C_BEGIN \
29+
extern "C" { \
30+
LLVM_C_STRICT_PROTOTYPES_BEGIN
31+
#define LLVM_C_EXTERN_C_END \
32+
LLVM_C_STRICT_PROTOTYPES_END \
33+
}
34+
#else
35+
#define LLVM_C_EXTERN_C_BEGIN LLVM_C_STRICT_PROTOTYPES_BEGIN
36+
#define LLVM_C_EXTERN_C_END LLVM_C_STRICT_PROTOTYPES_END
37+
#endif
38+
39+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
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+
20+
LLVM_C_EXTERN_C_BEGIN
21+
22+
/**
23+
* @defgroup LLVMCSupportTypes Types and Enumerations
24+
*
25+
* @{
26+
*/
27+
28+
typedef 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+
*/
48+
typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef;
49+
50+
/**
51+
* The top-level container for all LLVM global data. See the LLVMContext class.
52+
*/
53+
typedef 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+
*/
61+
typedef struct LLVMOpaqueModule *LLVMModuleRef;
62+
63+
/**
64+
* Each value in the LLVM IR has a type, an LLVMTypeRef.
65+
*
66+
* @see llvm::Type
67+
*/
68+
typedef struct LLVMOpaqueType *LLVMTypeRef;
69+
70+
/**
71+
* Represents an individual value in LLVM IR.
72+
*
73+
* This models llvm::Value.
74+
*/
75+
typedef struct LLVMOpaqueValue *LLVMValueRef;
76+
77+
/**
78+
* Represents a basic block of instructions in LLVM IR.
79+
*
80+
* This models llvm::BasicBlock.
81+
*/
82+
typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
83+
84+
/**
85+
* Represents an LLVM Metadata.
86+
*
87+
* This models llvm::Metadata.
88+
*/
89+
typedef struct LLVMOpaqueMetadata *LLVMMetadataRef;
90+
91+
/**
92+
* Represents an LLVM Named Metadata Node.
93+
*
94+
* This models llvm::NamedMDNode.
95+
*/
96+
typedef 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+
*/
103+
typedef struct LLVMOpaqueValueMetadataEntry LLVMValueMetadataEntry;
104+
105+
/**
106+
* Represents an LLVM basic block builder.
107+
*
108+
* This models llvm::IRBuilder.
109+
*/
110+
typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
111+
112+
/**
113+
* Represents an LLVM debug info builder.
114+
*
115+
* This models llvm::DIBuilder.
116+
*/
117+
typedef 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+
*/
124+
typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
125+
126+
/** @see llvm::PassManagerBase */
127+
typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
128+
129+
/**
130+
* Used to get the users and usees of a Value.
131+
*
132+
* @see llvm::Use */
133+
typedef struct LLVMOpaqueUse *LLVMUseRef;
134+
135+
/**
136+
* Used to represent an attributes.
137+
*
138+
* @see llvm::Attribute
139+
*/
140+
typedef struct LLVMOpaqueAttributeRef *LLVMAttributeRef;
141+
142+
/**
143+
* @see llvm::DiagnosticInfo
144+
*/
145+
typedef struct LLVMOpaqueDiagnosticInfo *LLVMDiagnosticInfoRef;
146+
147+
/**
148+
* @see llvm::Comdat
149+
*/
150+
typedef struct LLVMComdat *LLVMComdatRef;
151+
152+
/**
153+
* @see llvm::Module::ModuleFlagEntry
154+
*/
155+
typedef struct LLVMOpaqueModuleFlagEntry LLVMModuleFlagEntry;
156+
157+
/**
158+
* @see llvm::JITEventListener
159+
*/
160+
typedef struct LLVMOpaqueJITEventListener *LLVMJITEventListenerRef;
161+
162+
/**
163+
* @see llvm::object::Binary
164+
*/
165+
typedef struct LLVMOpaqueBinary *LLVMBinaryRef;
166+
167+
/**
168+
* @}
169+
*/
170+
171+
LLVM_C_EXTERN_C_END
172+
173+
#endif

0 commit comments

Comments
 (0)