aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Interpreter/InterpreterTest.cpp
diff options
context:
space:
mode:
authorSunho Kim <ksunhokim123@gmail.com>2022-07-30 07:17:05 +0900
committerSunho Kim <ksunhokim123@gmail.com>2022-07-30 07:18:04 +0900
commit65c9265f4158512e8dc85558ef8e73c0714e90c3 (patch)
tree60a464fd3226fbe4d40316662bc1e911ecd3cb92 /clang/unittests/Interpreter/InterpreterTest.cpp
parent383bc7210e5a48e86adc1f3a6bf4d27f95a6287a (diff)
downloadllvm-65c9265f4158512e8dc85558ef8e73c0714e90c3.zip
llvm-65c9265f4158512e8dc85558ef8e73c0714e90c3.tar.gz
llvm-65c9265f4158512e8dc85558ef8e73c0714e90c3.tar.bz2
[clang-repl] Disable exectuion unitests on unsupported platform by lljit instance test.
The method used in 4191d661c74622c6fa72c1643e4567f45e6c9e1b was fragile because it didn't consider cross-platform builds and rely on enlisting unsupported targets. Uses the host-supports-jit mechanism to make an escape path. This should fix buildbot failures happening in upstream as well as out-of-tree.
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.