[clang] 65c9265 - [clang-repl] Disable exectuion unitests on unsupported platform by lljit instance test.
Sunho Kim via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 29 15:18:13 PDT 2022
Author: Sunho Kim
Date: 2022-07-30T07:18:04+09:00
New Revision: 65c9265f4158512e8dc85558ef8e73c0714e90c3
URL: https://github.com/llvm/llvm-project/commit/65c9265f4158512e8dc85558ef8e73c0714e90c3
DIFF: https://github.com/llvm/llvm-project/commit/65c9265f4158512e8dc85558ef8e73c0714e90c3.diff
LOG: [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.
Added:
Modified:
clang/unittests/Interpreter/InterpreterTest.cpp
Removed:
################################################################################
diff --git a/clang/unittests/Interpreter/InterpreterTest.cpp b/clang/unittests/Interpreter/InterpreterTest.cpp
index d266dd0c0c76..a8fdff0d7e3b 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.
More information about the cfe-commits
mailing list