File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 22-Wl,--export=_ZN4llvm11raw_ostream16SetBufferAndModeEPcmNS0_10BufferKindE
33-Wl,--export=_ZN4llvm11raw_ostream5writeEPKcm
44-Wl,--export=_ZN4llvm11raw_ostreamD2Ev
5+ -Wl,--export=_ZN4llvm11raw_ostreamlsEm
56-Wl,--export=_ZN4llvm15SmallVectorBaseIjE8grow_podEPvmm
67-Wl,--export=_ZN4llvm15allocate_bufferEmm
78-Wl,--export=_ZN4llvm21logAllUnhandledErrorsENS_5ErrorERNS_11raw_ostreamENS_5TwineE
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ if(EMSCRIPTEN)
4343 # --preload-file ${SYSROOT_PATH}/include@/include:
4444 # Preloads the system include directory into the Emscripten virtual filesystem to make headers accessible at runtime.
4545 target_link_options (CppInterOpTests
46+ PUBLIC "SHELL: -fexceptions"
4647 PUBLIC "SHELL: -s MAIN_MODULE=1"
4748 PUBLIC "SHELL: -s WASM_BIGINT"
4849 PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
Original file line number Diff line number Diff line change @@ -104,6 +104,33 @@ TEST(InterpreterTest, Process) {
104104 clang_Interpreter_dispose (CXI);
105105}
106106
107+ TEST (InterpreterTest, EmscriptenExceptionHandling) {
108+ #ifndef EMSCRIPTEN
109+ GTEST_SKIP () << " This test is intended to check exception handling for Emscripten builds." ;
110+ #endif
111+
112+ std::vector<const char *> Args = {
113+ " -std=c++20" ,
114+ " -v" ,
115+ " -fexceptions" ,
116+ " -fcxx-exceptions" ,
117+ " -mllvm" , " -enable-emscripten-cxx-exceptions" ,
118+ " -mllvm" , " -enable-emscripten-sjlj"
119+ };
120+
121+ Cpp::CreateInterpreter (Args);
122+
123+ const char * tryCatchCode = R"(
124+ try {
125+ throw 1;
126+ } catch (...) {
127+ 0;
128+ }
129+ )" ;
130+
131+ EXPECT_TRUE (Cpp::Process (tryCatchCode) == 0 );
132+ }
133+
107134TEST (InterpreterTest, CreateInterpreter) {
108135 auto * I = Cpp::CreateInterpreter ();
109136 EXPECT_TRUE (I);
You can’t perform that action at this time.
0 commit comments