[clang] [llvm] Enable running ClangReplInterpreterTests in an Emscripten environment (PR #150977)

Anutosh Bhat via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 13 23:29:50 PDT 2025


================
@@ -38,8 +38,10 @@ class InterpreterTestBase : public ::testing::Test {
   }
 
   void SetUp() override {
+#ifndef __EMSCRIPTEN__
     if (!HostSupportsJIT())
       GTEST_SKIP();
+#endif
----------------
anutosh491 wrote:

So trying to understand this better, HostSupportsJIT() would mean to check if the platform can run LLJIT 

And Emscripten/wasm can't support LLJIT (no native executable memory as we know) , a better way than always guarding the SetUp function (also done in CodeCompletion test I suppose) would be to do it like this 

1)  On line 19 (Updating the platform macro)
```
-#if defined(_AIX) || defined(__MVS__)
+#if defined(_AIX) || defined(__MVS__) || defined(__EMSCRIPTEN__)
 #define CLANG_INTERPRETER_PLATFORM_CANNOT_CREATE_LLJIT
 #endif
```
or 

2) On line 28 (Extending the helper)
```
 static bool HostSupportsJIT() {
-#ifdef CLANG_INTERPRETER_PLATFORM_CANNOT_CREATE_LLJIT
+#if defined(CLANG_INTERPRETER_PLATFORM_CANNOT_CREATE_LLJIT) || defined(__EMSCRIPTEN__)
   return false;
```
So that HostSupportsJIT() itself return false on Emscripten.


https://github.com/llvm/llvm-project/pull/150977


More information about the cfe-commits mailing list