Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions unittests/CppInterOp/EnumReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,6 @@ TYPED_TEST(CPPINTEROP_TEST_MODE, EnumReflection_GetEnumConstantValue) {
}

TYPED_TEST(CPPINTEROP_TEST_MODE, EnumReflection_GetEnums) {
// Skip under OOP+sanitizer: upstream LLVM ORC asserts on
// `Resolving symbol with incorrect flags`
// (`llvm/lib/ExecutionEngine/Orc/Core.cpp:2800`) when
// sanitizer-instrumented common symbols cross the EPC boundary --
// the host's JITSymbolFlags don't match what the executor reports.
#if (defined(__has_feature) && \
(__has_feature(address_sanitizer) || \
__has_feature(memory_sanitizer) || \
__has_feature(thread_sanitizer))) || \
defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_THREAD__)
if (this->IsOutOfProcess())
GTEST_SKIP() << "OOP+sanitizer trips LLVM ORC symbol-flag assertion";
#endif

std::string code = R"(
enum Color {
Red,
Expand Down
14 changes: 0 additions & 14 deletions unittests/CppInterOp/FunctionReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,20 +702,6 @@ TYPED_TEST(CPPINTEROP_TEST_MODE, FunctionReflection_ExistsFunctionTemplate) {

TYPED_TEST(CPPINTEROP_TEST_MODE,
FunctionReflection_InstantiateTemplateFunctionFromString) {
// Skip under OOP+sanitizer: same upstream LLVM ORC
// `Resolving symbol with incorrect flags` issue as
// EnumReflection_GetEnums (Core.cpp:2800) -- sanitizer-instrumented
// common symbols cross the EPC boundary with mismatched
// JITSymbolFlags.
#if (defined(__has_feature) && \
(__has_feature(address_sanitizer) || \
__has_feature(memory_sanitizer) || \
__has_feature(thread_sanitizer))) || \
defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_THREAD__)
if (this->IsOutOfProcess())
GTEST_SKIP() << "OOP+sanitizer trips LLVM ORC symbol-flag assertion";
#endif

std::vector<const char*> interpreter_args = { "-include", "new" };
TestFixture::CreateInterpreter(interpreter_args);
std::string code = R"(#include <memory>)";
Expand Down
32 changes: 30 additions & 2 deletions unittests/CppInterOp/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,40 @@ CXScope make_scope(const clang::Decl* D, const CXInterpreter I);

bool IsTargetX86();

// OOP-JIT is incompatible with two configurations and is excluded
// from the typed-test matrix wholesale (rather than per-test) when
// either applies:
// * Any sanitizer (ASan/MSan/TSan): upstream LLVM ORC trips
// `Resolving symbol with incorrect flags`
// (`llvm/lib/ExecutionEngine/Orc/Core.cpp`, the JITSymbolFlags
// compare under `OL_notifyResolved`) because
// sanitizer-instrumented common symbols carry flags the host
// process didn't declare; the EPC boundary surfaces the
// mismatch. In-process JIT is unaffected.
// * Emscripten: the OOP path requires fork/exec + a separate
// executor binary, which the wasm runtime doesn't provide.
#if defined(__has_feature)
# if __has_feature(address_sanitizer) || \
__has_feature(memory_sanitizer) || \
__has_feature(thread_sanitizer)
# define CPPINTEROP_OOP_DISABLED 1
# endif
#endif
#if defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_THREAD__)
# define CPPINTEROP_OOP_DISABLED 1
#endif
#if defined(__EMSCRIPTEN__)
# define CPPINTEROP_OOP_DISABLED 1
#endif

// Define type tags for each configuration
struct InProcessJITConfig {
static constexpr bool isOutOfProcess = false;
static constexpr const char* name = "InProcessJIT";
};

#if LLVM_VERSION_MAJOR > 21 && !defined(_WIN32)
#if LLVM_VERSION_MAJOR > 21 && !defined(_WIN32) && \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "LLVM_VERSION_MAJOR" is directly included [misc-include-cleaner]

unittests/CppInterOp/Utils.h:3:

- #include "../../lib/CppInterOp/Compatibility.h"
+ #include <llvm/Config/llvm-config.h>
+ #include "../../lib/CppInterOp/Compatibility.h"

!defined(CPPINTEROP_OOP_DISABLED)
struct OutOfProcessJITConfig {
static constexpr bool isOutOfProcess = true;
static constexpr const char* name = "OutOfProcessJIT";
Expand Down Expand Up @@ -97,7 +124,8 @@ struct JITConfigNameGenerator {
}
};

#if LLVM_VERSION_MAJOR > 21 && !defined(_WIN32)
#if LLVM_VERSION_MAJOR > 21 && !defined(_WIN32) && \
!defined(CPPINTEROP_OOP_DISABLED)
using CppInterOpTestTypes = ::testing::Types<InProcessJITConfig, OutOfProcessJITConfig>;
#else
using CppInterOpTestTypes = ::testing::Types<InProcessJITConfig>;
Expand Down
Loading