aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Interpreter/InterpreterTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Interpreter/InterpreterTest.cpp')
-rw-r--r--clang/unittests/Interpreter/InterpreterTest.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/clang/unittests/Interpreter/InterpreterTest.cpp b/clang/unittests/Interpreter/InterpreterTest.cpp
index d266dd0..a8fdff0 100644
--- a/clang/unittests/Interpreter/InterpreterTest.cpp
+++ b/clang/unittests/Interpreter/InterpreterTest.cpp
@@ -20,6 +20,7 @@
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Sema.h"
+#include "llvm/ExecutionEngine/Orc/LLJIT.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/TargetSelect.h"
@@ -28,9 +29,7 @@
using namespace clang;
-#if defined(_AIX) || defined(__hexagon__) || \
- (defined(_WIN32) && \
- (defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__)))
+#if defined(_AIX)
#define CLANG_INTERPRETER_NO_SUPPORT_EXEC
#endif
@@ -189,6 +188,14 @@ static std::string MangleName(NamedDecl *ND) {
return RawStr.str();
}
+static bool HostSupportsJit() {
+ auto J = llvm::orc::LLJITBuilder().create();
+ if (J)
+ return true;
+ LLVMConsumeError(llvm::wrap(J.takeError()));
+ return false;
+}
+
struct LLVMInitRAII {
LLVMInitRAII() {
llvm::InitializeNativeTarget();
@@ -209,6 +216,11 @@ TEST(IncrementalProcessing, FindMangledNameSymbol) {
EXPECT_EQ(1U, DeclsSize(PTU.TUPart));
auto R1DeclRange = PTU.TUPart->decls();
+ // We cannot execute on the platform.
+ if (!HostSupportsJit()) {
+ return;
+ }
+
NamedDecl *FD = cast<FunctionDecl>(*R1DeclRange.begin());
// Lower the PTU
if (llvm::Error Err = Interp->Execute(PTU)) {
@@ -281,6 +293,11 @@ TEST(IncrementalProcessing, InstantiateTemplate) {
auto PTUDeclRange = PTU.TUPart->decls();
EXPECT_EQ(1, std::distance(PTUDeclRange.begin(), PTUDeclRange.end()));
+ // We cannot execute on the platform.
+ if (!HostSupportsJit()) {
+ return;
+ }
+
// Lower the PTU
if (llvm::Error Err = Interp->Execute(PTU)) {
// We cannot execute on the platform.