llvm.org GIT mirror llvm / 7c00d18
[Modules] Fix a layering issue that is actually impacting the modules selfhost. The 'Core.h' C-API header is part of the IR LLVM library. (One might even argue it should be called IR.h, but that's a separate point.) We can't include it into a Support header without violating the layering, and in a way that breaks modules. MemoryBuffer's opaque C type was being defined in the Core.h C-API header despite being in the Support library, and thus we ended up with this weird issue. It turns out that there were other constructs from the Support library in the Core.h header. This patch lifts all of them into Support.h and then includes that into Core.h. The only possible fallout is if someone was including Support.h and relying on Core.h to be visible for their own uses. Considering the narrow interface actually provided by the C-API for the Support library, this seems a very, very unlikely mistake. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203071 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 5 years ago
3 changed file(s) with 22 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
1313 #ifndef LLVM_SUPPORT_MEMORYBUFFER_H
1414 #define LLVM_SUPPORT_MEMORYBUFFER_H
1515
16 #include "llvm-c/Core.h"
16 #include "llvm-c/Support.h"
1717 #include "llvm/ADT/Twine.h"
1818 #include "llvm/Support/CBindingWrapping.h"
1919 #include "llvm/Support/Compiler.h"
1414 #ifndef LLVM_C_CORE_H
1515 #define LLVM_C_CORE_H
1616
17 #include "llvm/Support/DataTypes.h"
17 #include "llvm-c/Support.h"
1818
1919 #ifdef __cplusplus
2020 extern "C" {
6161 * @{
6262 */
6363
64 typedef int LLVMBool;
65
6664 /* Opaque types. */
6765
6866 /**
112110 * different type to keep binary compatibility.
113111 */
114112 typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
115
116 /**
117 * Used to provide a module to JIT or interpreter.
118 *
119 * @see llvm::MemoryBuffer
120 */
121 typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef;
122113
123114 /** @see llvm::PassManagerBase */
124115 typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
1313 #ifndef LLVM_C_SUPPORT_H
1414 #define LLVM_C_SUPPORT_H
1515
16 #include "llvm-c/Core.h"
16 #include "llvm/Support/DataTypes.h"
1717
1818 #ifdef __cplusplus
1919 extern "C" {
2020 #endif
21
22 /**
23 * @defgroup LLVMCSupportTypes Types and Enumerations
24 *
25 * @{
26 */
27
28 typedef int LLVMBool;
29
30 /**
31 * Used to pass regions of memory through LLVM interfaces.
32 *
33 * @see llvm::MemoryBuffer
34 */
35 typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef;
36
37 /**
38 * @}
39 */
2140
2241 /**
2342 * This function permanently loads the dynamic library at the given path.