[compiler-rt] 34fccfb - [ORC-RT] Remove the '__' prefix from the ORC runtime's public API.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 21 18:37:24 PST 2023
Author: Lang Hames
Date: 2023-02-21T18:37:10-08:00
New Revision: 34fccfb23c47fe5b12bbd8bd970d3ad31d869d62
URL: https://github.com/llvm/llvm-project/commit/34fccfb23c47fe5b12bbd8bd970d3ad31d869d62
DIFF: https://github.com/llvm/llvm-project/commit/34fccfb23c47fe5b12bbd8bd970d3ad31d869d62.diff
LOG: [ORC-RT] Remove the '__' prefix from the ORC runtime's public API.
The '__' prefix should only be used for the parts of the ORC runtime that
implement compiler / loader runtime details (e.g. ORC-RT's __tlv_get_addr
implementations).
This patch only fixes the public API. Future changes will fix internal names.
Added:
Modified:
compiler-rt/include/orc_rt/c_api.h
compiler-rt/lib/orc/coff_platform.cpp
compiler-rt/lib/orc/common.h
compiler-rt/lib/orc/dlfcn_wrapper.cpp
compiler-rt/lib/orc/elfnix_platform.cpp
compiler-rt/lib/orc/macho_platform.cpp
compiler-rt/lib/orc/run_program_wrapper.cpp
compiler-rt/lib/orc/tests/unit/c_api_test.cpp
compiler-rt/lib/orc/tests/unit/wrapper_function_utils_test.cpp
compiler-rt/lib/orc/wrapper_function_utils.h
Removed:
################################################################################
diff --git a/compiler-rt/include/orc_rt/c_api.h b/compiler-rt/include/orc_rt/c_api.h
index 96d01df15e86c..628c5cd10676a 100644
--- a/compiler-rt/include/orc_rt/c_api.h
+++ b/compiler-rt/include/orc_rt/c_api.h
@@ -48,17 +48,17 @@ ORC_RT_C_EXTERN_C_BEGIN
typedef union {
char *ValuePtr;
char Value[sizeof(char *)];
-} __orc_rt_CWrapperFunctionResultDataUnion;
+} orc_rt_CWrapperFunctionResultDataUnion;
/**
- * __orc_rt_CWrapperFunctionResult is a kind of C-SmallVector with an
+ * orc_rt_CWrapperFunctionResult is a kind of C-SmallVector with an
* out-of-band error state.
*
* If Size == 0 and Data.ValuePtr is non-zero then the value is in the
* 'out-of-band error' state, and Data.ValuePtr points at a malloc-allocated,
* null-terminated string error message.
*
- * If Size <= sizeof(__orc_rt_CWrapperFunctionResultData) then the value is in
+ * If Size <= sizeof(orc_rt_CWrapperFunctionResultData) then the value is in
* the 'small' state and the content is held in the first Size bytes of
* Data.Value.
*
@@ -68,29 +68,29 @@ typedef union {
* malloc, and will be freed with free when this value is destroyed.
*/
typedef struct {
- __orc_rt_CWrapperFunctionResultDataUnion Data;
+ orc_rt_CWrapperFunctionResultDataUnion Data;
size_t Size;
-} __orc_rt_CWrapperFunctionResult;
+} orc_rt_CWrapperFunctionResult;
-typedef struct __orc_rt_CSharedOpaqueJITProcessControl
- *__orc_rt_SharedJITProcessControlRef;
+typedef struct orc_rt_CSharedOpaqueJITProcessControl
+ *orc_rt_SharedJITProcessControlRef;
/**
- * Zero-initialize an __orc_rt_CWrapperFunctionResult.
+ * Zero-initialize an orc_rt_CWrapperFunctionResult.
*/
static inline void
-__orc_rt_CWrapperFunctionResultInit(__orc_rt_CWrapperFunctionResult *R) {
+orc_rt_CWrapperFunctionResultInit(orc_rt_CWrapperFunctionResult *R) {
R->Size = 0;
R->Data.ValuePtr = 0;
}
/**
- * Create an __orc_rt_CWrapperFunctionResult with an uninitialized buffer of
+ * Create an orc_rt_CWrapperFunctionResult with an uninitialized buffer of
* size Size. The buffer is returned via the DataPtr argument.
*/
-static inline __orc_rt_CWrapperFunctionResult
-__orc_rt_CWrapperFunctionResultAllocate(size_t Size) {
- __orc_rt_CWrapperFunctionResult R;
+static inline orc_rt_CWrapperFunctionResult
+orc_rt_CWrapperFunctionResultAllocate(size_t Size) {
+ orc_rt_CWrapperFunctionResult R;
R.Size = Size;
// If Size is 0 ValuePtr must be 0 or it is considered an out-of-band error.
R.Data.ValuePtr = 0;
@@ -100,11 +100,11 @@ __orc_rt_CWrapperFunctionResultAllocate(size_t Size) {
}
/**
- * Create an __orc_rt_WrapperFunctionResult from the given data range.
+ * Create an orc_rt_WrapperFunctionResult from the given data range.
*/
-static inline __orc_rt_CWrapperFunctionResult
-__orc_rt_CreateCWrapperFunctionResultFromRange(const char *Data, size_t Size) {
- __orc_rt_CWrapperFunctionResult R;
+static inline orc_rt_CWrapperFunctionResult
+orc_rt_CreateCWrapperFunctionResultFromRange(const char *Data, size_t Size) {
+ orc_rt_CWrapperFunctionResult R;
R.Size = Size;
if (R.Size > sizeof(R.Data.Value)) {
char *Tmp = (char *)malloc(Size);
@@ -116,28 +116,28 @@ __orc_rt_CreateCWrapperFunctionResultFromRange(const char *Data, size_t Size) {
}
/**
- * Create an __orc_rt_CWrapperFunctionResult by copying the given string,
+ * Create an orc_rt_CWrapperFunctionResult by copying the given string,
* including the null-terminator.
*
* This function copies the input string. The client is responsible for freeing
* the ErrMsg arg.
*/
-static inline __orc_rt_CWrapperFunctionResult
-__orc_rt_CreateCWrapperFunctionResultFromString(const char *Source) {
- return __orc_rt_CreateCWrapperFunctionResultFromRange(Source,
- strlen(Source) + 1);
+static inline orc_rt_CWrapperFunctionResult
+orc_rt_CreateCWrapperFunctionResultFromString(const char *Source) {
+ return orc_rt_CreateCWrapperFunctionResultFromRange(Source,
+ strlen(Source) + 1);
}
/**
- * Create an __orc_rt_CWrapperFunctionResult representing an out-of-band
+ * Create an orc_rt_CWrapperFunctionResult representing an out-of-band
* error.
*
* This function copies the input string. The client is responsible for freeing
* the ErrMsg arg.
*/
-static inline __orc_rt_CWrapperFunctionResult
-__orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(const char *ErrMsg) {
- __orc_rt_CWrapperFunctionResult R;
+static inline orc_rt_CWrapperFunctionResult
+orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(const char *ErrMsg) {
+ orc_rt_CWrapperFunctionResult R;
R.Size = 0;
char *Tmp = (char *)malloc(strlen(ErrMsg) + 1);
strcpy(Tmp, ErrMsg);
@@ -146,11 +146,11 @@ __orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(const char *ErrMsg) {
}
/**
- * This should be called to destroy __orc_rt_CWrapperFunctionResult values
+ * This should be called to destroy orc_rt_CWrapperFunctionResult values
* regardless of their state.
*/
static inline void
-__orc_rt_DisposeCWrapperFunctionResult(__orc_rt_CWrapperFunctionResult *R) {
+orc_rt_DisposeCWrapperFunctionResult(orc_rt_CWrapperFunctionResult *R) {
if (R->Size > sizeof(R->Data.Value) ||
(R->Size == 0 && R->Data.ValuePtr))
free(R->Data.ValuePtr);
@@ -158,22 +158,22 @@ __orc_rt_DisposeCWrapperFunctionResult(__orc_rt_CWrapperFunctionResult *R) {
/**
* Get a pointer to the data contained in the given
- * __orc_rt_CWrapperFunctionResult.
+ * orc_rt_CWrapperFunctionResult.
*/
static inline char *
-__orc_rt_CWrapperFunctionResultData(__orc_rt_CWrapperFunctionResult *R) {
+orc_rt_CWrapperFunctionResultData(orc_rt_CWrapperFunctionResult *R) {
assert((R->Size != 0 || R->Data.ValuePtr == NULL) &&
"Cannot get data for out-of-band error value");
return R->Size > sizeof(R->Data.Value) ? R->Data.ValuePtr : R->Data.Value;
}
/**
- * Safely get the size of the given __orc_rt_CWrapperFunctionResult.
+ * Safely get the size of the given orc_rt_CWrapperFunctionResult.
*
* Asserts that we're not trying to access the size of an error value.
*/
static inline size_t
-__orc_rt_CWrapperFunctionResultSize(const __orc_rt_CWrapperFunctionResult *R) {
+orc_rt_CWrapperFunctionResultSize(const orc_rt_CWrapperFunctionResult *R) {
assert((R->Size != 0 || R->Data.ValuePtr == NULL) &&
"Cannot get size for out-of-band error value");
return R->Size;
@@ -181,22 +181,22 @@ __orc_rt_CWrapperFunctionResultSize(const __orc_rt_CWrapperFunctionResult *R) {
/**
* Returns 1 if this value is equivalent to a value just initialized by
- * __orc_rt_CWrapperFunctionResultInit, 0 otherwise.
+ * orc_rt_CWrapperFunctionResultInit, 0 otherwise.
*/
static inline size_t
-__orc_rt_CWrapperFunctionResultEmpty(const __orc_rt_CWrapperFunctionResult *R) {
+orc_rt_CWrapperFunctionResultEmpty(const orc_rt_CWrapperFunctionResult *R) {
return R->Size == 0 && R->Data.ValuePtr == 0;
}
/**
* Returns a pointer to the out-of-band error string for this
- * __orc_rt_CWrapperFunctionResult, or null if there is no error.
+ * orc_rt_CWrapperFunctionResult, or null if there is no error.
*
- * The __orc_rt_CWrapperFunctionResult retains ownership of the error
+ * The orc_rt_CWrapperFunctionResult retains ownership of the error
* string, so it should be copied if the caller wishes to preserve it.
*/
-static inline const char *__orc_rt_CWrapperFunctionResultGetOutOfBandError(
- const __orc_rt_CWrapperFunctionResult *R) {
+static inline const char *orc_rt_CWrapperFunctionResultGetOutOfBandError(
+ const orc_rt_CWrapperFunctionResult *R) {
return R->Size == 0 ? R->Data.ValuePtr : 0;
}
diff --git a/compiler-rt/lib/orc/coff_platform.cpp b/compiler-rt/lib/orc/coff_platform.cpp
index 83ce07b1bcf8f..78c86c855dcb2 100644
--- a/compiler-rt/lib/orc/coff_platform.cpp
+++ b/compiler-rt/lib/orc/coff_platform.cpp
@@ -595,19 +595,19 @@ void *COFFPlatformRuntimeState::findJITDylibBaseByPC(uint64_t PC) {
return Range.Header;
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_coff_platform_bootstrap(char *ArgData, size_t ArgSize) {
COFFPlatformRuntimeState::initialize();
return WrapperFunctionResult().release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_coff_platform_shutdown(char *ArgData, size_t ArgSize) {
COFFPlatformRuntimeState::destroy();
return WrapperFunctionResult().release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_coff_register_jitdylib(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSString, SPSExecutorAddr)>::handle(
ArgData, ArgSize,
@@ -618,7 +618,7 @@ __orc_rt_coff_register_jitdylib(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_coff_deregister_jitdylib(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSExecutorAddr)>::handle(
ArgData, ArgSize,
@@ -629,7 +629,7 @@ __orc_rt_coff_deregister_jitdylib(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_coff_register_object_sections(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSExecutorAddr, SPSCOFFObjectSectionsMap,
bool)>::
@@ -644,7 +644,7 @@ __orc_rt_coff_register_object_sections(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_coff_deregister_object_sections(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSExecutorAddr, SPSCOFFObjectSectionsMap)>::
handle(ArgData, ArgSize,
diff --git a/compiler-rt/lib/orc/common.h b/compiler-rt/lib/orc/common.h
index 5e01feee759be..73c5c4a2bd8d4 100644
--- a/compiler-rt/lib/orc/common.h
+++ b/compiler-rt/lib/orc/common.h
@@ -41,7 +41,7 @@ ORC_RT_IMPORT __orc_rt_Opaque __orc_rt_jit_dispatch_ctx ORC_RT_WEAK_IMPORT;
/// This is declared for use by the runtime, but should be implemented in the
/// executor or provided by a definition added to the JIT before the runtime
/// is loaded.
-ORC_RT_IMPORT __orc_rt_CWrapperFunctionResult
+ORC_RT_IMPORT orc_rt_CWrapperFunctionResult
__orc_rt_jit_dispatch(__orc_rt_Opaque *DispatchCtx, const void *FnTag,
const char *Data, size_t Size) ORC_RT_WEAK_IMPORT;
diff --git a/compiler-rt/lib/orc/dlfcn_wrapper.cpp b/compiler-rt/lib/orc/dlfcn_wrapper.cpp
index c513aae97bb39..ece63da2cb48e 100644
--- a/compiler-rt/lib/orc/dlfcn_wrapper.cpp
+++ b/compiler-rt/lib/orc/dlfcn_wrapper.cpp
@@ -22,7 +22,7 @@ extern "C" const char *__orc_rt_jit_dlerror();
extern "C" void *__orc_rt_jit_dlopen(const char *path, int mode);
extern "C" int __orc_rt_jit_dlclose(void *dso_handle);
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_jit_dlerror_wrapper(const char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSString()>::handle(
ArgData, ArgSize,
@@ -30,7 +30,7 @@ __orc_rt_jit_dlerror_wrapper(const char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_jit_dlopen_wrapper(const char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSExecutorAddr(SPSString, int32_t)>::handle(
ArgData, ArgSize,
@@ -41,7 +41,7 @@ __orc_rt_jit_dlopen_wrapper(const char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_jit_dlclose_wrapper(const char *ArgData, size_t ArgSize) {
return WrapperFunction<int32_t(SPSExecutorAddr)>::handle(
ArgData, ArgSize,
diff --git a/compiler-rt/lib/orc/elfnix_platform.cpp b/compiler-rt/lib/orc/elfnix_platform.cpp
index 771e21d72e2da..23184df7656ec 100644
--- a/compiler-rt/lib/orc/elfnix_platform.cpp
+++ b/compiler-rt/lib/orc/elfnix_platform.cpp
@@ -451,7 +451,7 @@ void destroyELFNixTLVMgr(void *ELFNixTLVMgr) {
// JIT entry points
//------------------------------------------------------------------------------
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_elfnix_platform_bootstrap(char *ArgData, size_t ArgSize) {
return WrapperFunction<void(uint64_t)>::handle(
ArgData, ArgSize,
@@ -462,14 +462,14 @@ __orc_rt_elfnix_platform_bootstrap(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_elfnix_platform_shutdown(char *ArgData, size_t ArgSize) {
ELFNixPlatformRuntimeState::destroy();
return WrapperFunctionResult().release();
}
/// Wrapper function for registering metadata on a per-object basis.
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_elfnix_register_object_sections(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSELFNixPerObjectSectionsToRegister)>::
handle(ArgData, ArgSize,
@@ -481,7 +481,7 @@ __orc_rt_elfnix_register_object_sections(char *ArgData, size_t ArgSize) {
}
/// Wrapper for releasing per-object metadat.
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_elfnix_deregister_object_sections(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSELFNixPerObjectSectionsToRegister)>::
handle(ArgData, ArgSize,
@@ -517,7 +517,7 @@ ORC_RT_INTERFACE ptr
diff _t ___orc_rt_elfnix_tlsdesc_resolver_impl(
return TLVPtr - ThreadPointer;
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_elfnix_create_pthread_key(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSExpected<uint64_t>(void)>::handle(
ArgData, ArgSize,
diff --git a/compiler-rt/lib/orc/macho_platform.cpp b/compiler-rt/lib/orc/macho_platform.cpp
index fcbb7264b61d9..2c0248a891905 100644
--- a/compiler-rt/lib/orc/macho_platform.cpp
+++ b/compiler-rt/lib/orc/macho_platform.cpp
@@ -1280,7 +1280,7 @@ Error runWrapperFunctionCalls(std::vector<WrapperFunctionCall> WFCs) {
// JIT entry points
//------------------------------------------------------------------------------
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_platform_bootstrap(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError()>::handle(
ArgData, ArgSize,
@@ -1288,7 +1288,7 @@ __orc_rt_macho_platform_bootstrap(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_platform_shutdown(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError()>::handle(
ArgData, ArgSize,
@@ -1296,7 +1296,7 @@ __orc_rt_macho_platform_shutdown(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_register_jitdylib(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSString, SPSExecutorAddr)>::handle(
ArgData, ArgSize,
@@ -1307,7 +1307,7 @@ __orc_rt_macho_register_jitdylib(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_deregister_jitdylib(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSExecutorAddr)>::handle(
ArgData, ArgSize,
@@ -1318,7 +1318,7 @@ __orc_rt_macho_deregister_jitdylib(char *ArgData, size_t ArgSize) {
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_register_object_platform_sections(char *ArgData,
size_t ArgSize) {
return WrapperFunction<SPSError(SPSExecutorAddr,
@@ -1335,7 +1335,7 @@ __orc_rt_macho_register_object_platform_sections(char *ArgData,
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_deregister_object_platform_sections(char *ArgData,
size_t ArgSize) {
return WrapperFunction<SPSError(SPSExecutorAddr,
@@ -1352,7 +1352,7 @@ __orc_rt_macho_deregister_object_platform_sections(char *ArgData,
.release();
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_run_wrapper_function_calls(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSError(SPSSequence<SPSWrapperFunctionCall>)>::handle(
ArgData, ArgSize, runWrapperFunctionCalls)
@@ -1378,7 +1378,7 @@ ORC_RT_INTERFACE void *__orc_rt_macho_tlv_get_addr_impl(TLVDescriptor *D) {
reinterpret_cast<char *>(static_cast<uintptr_t>(D->DataAddress)));
}
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_macho_create_pthread_key(char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSExpected<uint64_t>(void)>::handle(
ArgData, ArgSize,
diff --git a/compiler-rt/lib/orc/run_program_wrapper.cpp b/compiler-rt/lib/orc/run_program_wrapper.cpp
index bb4edc56655e9..24a7b4fc3cbe0 100644
--- a/compiler-rt/lib/orc/run_program_wrapper.cpp
+++ b/compiler-rt/lib/orc/run_program_wrapper.cpp
@@ -22,7 +22,7 @@ extern "C" int64_t __orc_rt_run_program(const char *JITDylibName,
const char *EntrySymbolName, int argc,
char *argv[]);
-ORC_RT_INTERFACE __orc_rt_CWrapperFunctionResult
+ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_run_program_wrapper(const char *ArgData, size_t ArgSize) {
return WrapperFunction<int64_t(SPSString, SPSString,
SPSSequence<SPSString>)>::
diff --git a/compiler-rt/lib/orc/tests/unit/c_api_test.cpp b/compiler-rt/lib/orc/tests/unit/c_api_test.cpp
index ad3f055b8253c..497cb937e2afc 100644
--- a/compiler-rt/lib/orc/tests/unit/c_api_test.cpp
+++ b/compiler-rt/lib/orc/tests/unit/c_api_test.cpp
@@ -14,24 +14,24 @@
#include "gtest/gtest.h"
TEST(CAPITest, CWrapperFunctionResultInit) {
- __orc_rt_CWrapperFunctionResult R;
- __orc_rt_CWrapperFunctionResultInit(&R);
+ orc_rt_CWrapperFunctionResult R;
+ orc_rt_CWrapperFunctionResultInit(&R);
EXPECT_EQ(R.Size, 0U);
EXPECT_EQ(R.Data.ValuePtr, nullptr);
// Check that this value isn't treated as an out-of-band error.
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultAllocSmall) {
constexpr size_t SmallAllocSize = sizeof(const char *);
- auto R = __orc_rt_CWrapperFunctionResultAllocate(SmallAllocSize);
- char *DataPtr = __orc_rt_CWrapperFunctionResultData(&R);
+ auto R = orc_rt_CWrapperFunctionResultAllocate(SmallAllocSize);
+ char *DataPtr = orc_rt_CWrapperFunctionResultData(&R);
for (size_t I = 0; I != SmallAllocSize; ++I)
DataPtr[I] = 0x55 + I;
@@ -44,24 +44,24 @@ TEST(CAPITest, CWrapperFunctionResultAllocSmall) {
<< "Unexpected value at index " << I;
// Check that this value isn't treated as an out-of-band error.
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
- // Check that __orc_rt_CWrapperFunctionResult(Data|Result|Size) and
- // __orc_rt_CWrapperFunctionResultGetOutOfBandError behave as expected.
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultData(&R), R.Data.Value);
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultSize(&R), SmallAllocSize);
- EXPECT_FALSE(__orc_rt_CWrapperFunctionResultEmpty(&R));
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
+ // Check that orc_rt_CWrapperFunctionResult(Data|Result|Size) and
+ // orc_rt_CWrapperFunctionResultGetOutOfBandError behave as expected.
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultData(&R), R.Data.Value);
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultSize(&R), SmallAllocSize);
+ EXPECT_FALSE(orc_rt_CWrapperFunctionResultEmpty(&R));
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultAllocLarge) {
constexpr size_t LargeAllocSize = sizeof(const char *) + 1;
- auto R = __orc_rt_CWrapperFunctionResultAllocate(LargeAllocSize);
- char *DataPtr = __orc_rt_CWrapperFunctionResultData(&R);
+ auto R = orc_rt_CWrapperFunctionResultAllocate(LargeAllocSize);
+ char *DataPtr = orc_rt_CWrapperFunctionResultData(&R);
for (size_t I = 0; I != LargeAllocSize; ++I)
DataPtr[I] = 0x55 + I;
@@ -75,17 +75,17 @@ TEST(CAPITest, CWrapperFunctionResultAllocLarge) {
<< "Unexpected value at index " << I;
// Check that this value isn't treated as an out-of-band error.
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
- // Check that __orc_rt_CWrapperFunctionResult(Data|Result|Size) and
- // __orc_rt_CWrapperFunctionResultGetOutOfBandError behave as expected.
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultData(&R), R.Data.ValuePtr);
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultSize(&R), LargeAllocSize);
- EXPECT_FALSE(__orc_rt_CWrapperFunctionResultEmpty(&R));
- EXPECT_EQ(__orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
+ // Check that orc_rt_CWrapperFunctionResult(Data|Result|Size) and
+ // orc_rt_CWrapperFunctionResultGetOutOfBandError behave as expected.
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultData(&R), R.Data.ValuePtr);
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultSize(&R), LargeAllocSize);
+ EXPECT_FALSE(orc_rt_CWrapperFunctionResultEmpty(&R));
+ EXPECT_EQ(orc_rt_CWrapperFunctionResultGetOutOfBandError(&R), nullptr);
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultFromRangeSmall) {
@@ -95,8 +95,8 @@ TEST(CAPITest, CWrapperFunctionResultFromRangeSmall) {
for (size_t I = 0; I != SmallAllocSize; ++I)
Source[I] = 0x55 + I;
- __orc_rt_CWrapperFunctionResult R =
- __orc_rt_CreateCWrapperFunctionResultFromRange(Source, SmallAllocSize);
+ orc_rt_CWrapperFunctionResult R =
+ orc_rt_CreateCWrapperFunctionResultFromRange(Source, SmallAllocSize);
// Check that the inline storage in R.Data.Value contains the expected
// sequence.
@@ -106,7 +106,7 @@ TEST(CAPITest, CWrapperFunctionResultFromRangeSmall) {
<< "Unexpected value at index " << I;
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultFromRangeLarge) {
@@ -116,8 +116,8 @@ TEST(CAPITest, CWrapperFunctionResultFromRangeLarge) {
for (size_t I = 0; I != LargeAllocSize; ++I)
Source[I] = 0x55 + I;
- __orc_rt_CWrapperFunctionResult R =
- __orc_rt_CreateCWrapperFunctionResultFromRange(Source, LargeAllocSize);
+ orc_rt_CWrapperFunctionResult R =
+ orc_rt_CreateCWrapperFunctionResultFromRange(Source, LargeAllocSize);
// Check that the inline storage in R.Data.Value contains the expected
// sequence.
@@ -127,7 +127,7 @@ TEST(CAPITest, CWrapperFunctionResultFromRangeLarge) {
<< "Unexpected value at index " << I;
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultFromStringSmall) {
@@ -138,8 +138,8 @@ TEST(CAPITest, CWrapperFunctionResultFromStringSmall) {
Source[I] = 'a' + I;
Source[SmallAllocSize - 1] = '\0';
- __orc_rt_CWrapperFunctionResult R =
- __orc_rt_CreateCWrapperFunctionResultFromString(Source);
+ orc_rt_CWrapperFunctionResult R =
+ orc_rt_CreateCWrapperFunctionResultFromString(Source);
// Check that the inline storage in R.Data.Value contains the expected
// sequence.
@@ -151,7 +151,7 @@ TEST(CAPITest, CWrapperFunctionResultFromStringSmall) {
<< "Unexpected value at index " << (SmallAllocSize - 1);
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultFromStringLarge) {
@@ -162,8 +162,8 @@ TEST(CAPITest, CWrapperFunctionResultFromStringLarge) {
Source[I] = 'a' + I;
Source[LargeAllocSize - 1] = '\0';
- __orc_rt_CWrapperFunctionResult R =
- __orc_rt_CreateCWrapperFunctionResultFromString(Source);
+ orc_rt_CWrapperFunctionResult R =
+ orc_rt_CreateCWrapperFunctionResultFromString(Source);
// Check that the inline storage in R.Data.Value contains the expected
// sequence.
@@ -175,26 +175,26 @@ TEST(CAPITest, CWrapperFunctionResultFromStringLarge) {
<< "Unexpected value at index " << (LargeAllocSize - 1);
// Check that we can dispose of the value.
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
TEST(CAPITest, CWrapperFunctionResultFromOutOfBandError) {
constexpr const char *ErrMsg = "test error message";
- __orc_rt_CWrapperFunctionResult R =
- __orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(ErrMsg);
+ orc_rt_CWrapperFunctionResult R =
+ orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(ErrMsg);
#ifndef NDEBUG
- EXPECT_DEATH({ __orc_rt_CWrapperFunctionResultData(&R); },
+ EXPECT_DEATH({ orc_rt_CWrapperFunctionResultData(&R); },
"Cannot get data for out-of-band error value");
- EXPECT_DEATH({ __orc_rt_CWrapperFunctionResultSize(&R); },
+ EXPECT_DEATH({ orc_rt_CWrapperFunctionResultSize(&R); },
"Cannot get size for out-of-band error value");
#endif
- EXPECT_FALSE(__orc_rt_CWrapperFunctionResultEmpty(&R));
- const char *OOBErrMsg = __orc_rt_CWrapperFunctionResultGetOutOfBandError(&R);
+ EXPECT_FALSE(orc_rt_CWrapperFunctionResultEmpty(&R));
+ const char *OOBErrMsg = orc_rt_CWrapperFunctionResultGetOutOfBandError(&R);
EXPECT_NE(OOBErrMsg, nullptr);
EXPECT_NE(OOBErrMsg, ErrMsg);
EXPECT_TRUE(strcmp(OOBErrMsg, ErrMsg) == 0);
- __orc_rt_DisposeCWrapperFunctionResult(&R);
+ orc_rt_DisposeCWrapperFunctionResult(&R);
}
diff --git a/compiler-rt/lib/orc/tests/unit/wrapper_function_utils_test.cpp b/compiler-rt/lib/orc/tests/unit/wrapper_function_utils_test.cpp
index 8d4b9b3cba2b7..f10c5093046de 100644
--- a/compiler-rt/lib/orc/tests/unit/wrapper_function_utils_test.cpp
+++ b/compiler-rt/lib/orc/tests/unit/wrapper_function_utils_test.cpp
@@ -27,8 +27,8 @@ TEST(WrapperFunctionUtilsTest, DefaultWrapperFunctionResult) {
}
TEST(WrapperFunctionUtilsTest, WrapperFunctionResultFromCStruct) {
- __orc_rt_CWrapperFunctionResult CR =
- __orc_rt_CreateCWrapperFunctionResultFromString(TestString);
+ orc_rt_CWrapperFunctionResult CR =
+ orc_rt_CreateCWrapperFunctionResultFromString(TestString);
WrapperFunctionResult R(CR);
EXPECT_EQ(R.size(), strlen(TestString) + 1);
EXPECT_TRUE(strcmp(R.data(), TestString) == 0);
@@ -72,13 +72,13 @@ TEST(WrapperFunctionUtilsTest, WrapperFunctionCCallCreateEmpty) {
static void voidNoop() {}
-static __orc_rt_CWrapperFunctionResult voidNoopWrapper(const char *ArgData,
- size_t ArgSize) {
+static orc_rt_CWrapperFunctionResult voidNoopWrapper(const char *ArgData,
+ size_t ArgSize) {
return WrapperFunction<void()>::handle(ArgData, ArgSize, voidNoop).release();
}
-static __orc_rt_CWrapperFunctionResult addWrapper(const char *ArgData,
- size_t ArgSize) {
+static orc_rt_CWrapperFunctionResult addWrapper(const char *ArgData,
+ size_t ArgSize) {
return WrapperFunction<int32_t(int32_t, int32_t)>::handle(
ArgData, ArgSize,
[](int32_t X, int32_t Y) -> int32_t { return X + Y; })
@@ -87,11 +87,11 @@ static __orc_rt_CWrapperFunctionResult addWrapper(const char *ArgData,
extern "C" __orc_rt_Opaque __orc_rt_jit_dispatch_ctx{};
-extern "C" __orc_rt_CWrapperFunctionResult
+extern "C" orc_rt_CWrapperFunctionResult
__orc_rt_jit_dispatch(__orc_rt_Opaque *Ctx, const void *FnTag,
const char *ArgData, size_t ArgSize) {
using WrapperFunctionType =
- __orc_rt_CWrapperFunctionResult (*)(const char *, size_t);
+ orc_rt_CWrapperFunctionResult (*)(const char *, size_t);
return reinterpret_cast<WrapperFunctionType>(const_cast<void *>(FnTag))(
ArgData, ArgSize);
@@ -117,8 +117,8 @@ class AddClass {
int32_t X;
};
-static __orc_rt_CWrapperFunctionResult addMethodWrapper(const char *ArgData,
- size_t ArgSize) {
+static orc_rt_CWrapperFunctionResult addMethodWrapper(const char *ArgData,
+ size_t ArgSize) {
return WrapperFunction<int32_t(SPSExecutorAddr, int32_t)>::handle(
ArgData, ArgSize, makeMethodWrapperHandler(&AddClass::addMethod))
.release();
@@ -132,8 +132,8 @@ TEST(WrapperFunctionUtilsTest, WrapperFunctionMethodCallAndHandleRet) {
EXPECT_EQ(Result, (int32_t)3);
}
-static __orc_rt_CWrapperFunctionResult sumArrayWrapper(const char *ArgData,
- size_t ArgSize) {
+static orc_rt_CWrapperFunctionResult sumArrayWrapper(const char *ArgData,
+ size_t ArgSize) {
return WrapperFunction<int8_t(SPSExecutorAddrRange)>::handle(
ArgData, ArgSize,
[](ExecutorAddrRange R) {
diff --git a/compiler-rt/lib/orc/wrapper_function_utils.h b/compiler-rt/lib/orc/wrapper_function_utils.h
index b48891b3b750f..dcb6d0e6addbc 100644
--- a/compiler-rt/lib/orc/wrapper_function_utils.h
+++ b/compiler-rt/lib/orc/wrapper_function_utils.h
@@ -27,66 +27,66 @@ namespace __orc_rt {
class WrapperFunctionResult {
public:
/// Create a default WrapperFunctionResult.
- WrapperFunctionResult() { __orc_rt_CWrapperFunctionResultInit(&R); }
+ WrapperFunctionResult() { orc_rt_CWrapperFunctionResultInit(&R); }
/// Create a WrapperFunctionResult from a CWrapperFunctionResult. This
/// instance takes ownership of the result object and will automatically
/// call dispose on the result upon destruction.
- WrapperFunctionResult(__orc_rt_CWrapperFunctionResult R) : R(R) {}
+ WrapperFunctionResult(orc_rt_CWrapperFunctionResult R) : R(R) {}
WrapperFunctionResult(const WrapperFunctionResult &) = delete;
WrapperFunctionResult &operator=(const WrapperFunctionResult &) = delete;
WrapperFunctionResult(WrapperFunctionResult &&Other) {
- __orc_rt_CWrapperFunctionResultInit(&R);
+ orc_rt_CWrapperFunctionResultInit(&R);
std::swap(R, Other.R);
}
WrapperFunctionResult &operator=(WrapperFunctionResult &&Other) {
- __orc_rt_CWrapperFunctionResult Tmp;
- __orc_rt_CWrapperFunctionResultInit(&Tmp);
+ orc_rt_CWrapperFunctionResult Tmp;
+ orc_rt_CWrapperFunctionResultInit(&Tmp);
std::swap(Tmp, Other.R);
std::swap(R, Tmp);
return *this;
}
- ~WrapperFunctionResult() { __orc_rt_DisposeCWrapperFunctionResult(&R); }
+ ~WrapperFunctionResult() { orc_rt_DisposeCWrapperFunctionResult(&R); }
/// Relinquish ownership of and return the
- /// __orc_rt_CWrapperFunctionResult.
- __orc_rt_CWrapperFunctionResult release() {
- __orc_rt_CWrapperFunctionResult Tmp;
- __orc_rt_CWrapperFunctionResultInit(&Tmp);
+ /// orc_rt_CWrapperFunctionResult.
+ orc_rt_CWrapperFunctionResult release() {
+ orc_rt_CWrapperFunctionResult Tmp;
+ orc_rt_CWrapperFunctionResultInit(&Tmp);
std::swap(R, Tmp);
return Tmp;
}
/// Get a pointer to the data contained in this instance.
- char *data() { return __orc_rt_CWrapperFunctionResultData(&R); }
+ char *data() { return orc_rt_CWrapperFunctionResultData(&R); }
/// Returns the size of the data contained in this instance.
- size_t size() const { return __orc_rt_CWrapperFunctionResultSize(&R); }
+ size_t size() const { return orc_rt_CWrapperFunctionResultSize(&R); }
/// Returns true if this value is equivalent to a default-constructed
/// WrapperFunctionResult.
- bool empty() const { return __orc_rt_CWrapperFunctionResultEmpty(&R); }
+ bool empty() const { return orc_rt_CWrapperFunctionResultEmpty(&R); }
/// Create a WrapperFunctionResult with the given size and return a pointer
/// to the underlying memory.
static WrapperFunctionResult allocate(size_t Size) {
WrapperFunctionResult R;
- R.R = __orc_rt_CWrapperFunctionResultAllocate(Size);
+ R.R = orc_rt_CWrapperFunctionResultAllocate(Size);
return R;
}
/// Copy from the given char range.
static WrapperFunctionResult copyFrom(const char *Source, size_t Size) {
- return __orc_rt_CreateCWrapperFunctionResultFromRange(Source, Size);
+ return orc_rt_CreateCWrapperFunctionResultFromRange(Source, Size);
}
/// Copy from the given null-terminated string (includes the null-terminator).
static WrapperFunctionResult copyFrom(const char *Source) {
- return __orc_rt_CreateCWrapperFunctionResultFromString(Source);
+ return orc_rt_CreateCWrapperFunctionResultFromString(Source);
}
/// Copy from the given std::string (includes the null terminator).
@@ -96,7 +96,7 @@ class WrapperFunctionResult {
/// Create an out-of-band error by copying the given string.
static WrapperFunctionResult createOutOfBandError(const char *Msg) {
- return __orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(Msg);
+ return orc_rt_CreateCWrapperFunctionResultFromOutOfBandError(Msg);
}
/// Create an out-of-band error by copying the given string.
@@ -117,11 +117,11 @@ class WrapperFunctionResult {
/// If this value is an out-of-band error then this returns the error message,
/// otherwise returns nullptr.
const char *getOutOfBandError() const {
- return __orc_rt_CWrapperFunctionResultGetOutOfBandError(&R);
+ return orc_rt_CWrapperFunctionResultGetOutOfBandError(&R);
}
private:
- __orc_rt_CWrapperFunctionResult R;
+ orc_rt_CWrapperFunctionResult R;
};
namespace detail {
@@ -434,7 +434,7 @@ class WrapperFunctionCall {
/// Run call returning raw WrapperFunctionResult.
WrapperFunctionResult run() const {
using FnTy =
- __orc_rt_CWrapperFunctionResult(const char *ArgData, size_t ArgSize);
+ orc_rt_CWrapperFunctionResult(const char *ArgData, size_t ArgSize);
return WrapperFunctionResult(
FnAddr.toPtr<FnTy *>()(ArgData.data(), ArgData.size()));
}
More information about the llvm-commits
mailing list