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 2
2
-Wl,--export=_ZN4llvm11raw_ostream16SetBufferAndModeEPcmNS0_10BufferKindE
3
3
-Wl,--export=_ZN4llvm11raw_ostream5writeEPKcm
4
4
-Wl,--export=_ZN4llvm11raw_ostreamD2Ev
5
+ -Wl,--export=_ZN4llvm11raw_ostreamlsEm
5
6
-Wl,--export=_ZN4llvm15SmallVectorBaseIjE8grow_podEPvmm
6
7
-Wl,--export=_ZN4llvm15allocate_bufferEmm
7
8
-Wl,--export=_ZN4llvm21logAllUnhandledErrorsENS_5ErrorERNS_11raw_ostreamENS_5TwineE
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ if(EMSCRIPTEN)
43
43
# --preload-file ${SYSROOT_PATH}/include@/include:
44
44
# Preloads the system include directory into the Emscripten virtual filesystem to make headers accessible at runtime.
45
45
target_link_options (CppInterOpTests
46
+ PUBLIC "SHELL: -fexceptions"
46
47
PUBLIC "SHELL: -s MAIN_MODULE=1"
47
48
PUBLIC "SHELL: -s WASM_BIGINT"
48
49
PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
Original file line number Diff line number Diff line change @@ -104,6 +104,33 @@ TEST(InterpreterTest, Process) {
104
104
clang_Interpreter_dispose (CXI);
105
105
}
106
106
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
+
107
134
TEST (InterpreterTest, CreateInterpreter) {
108
135
auto * I = Cpp::CreateInterpreter ();
109
136
EXPECT_TRUE (I);
You can’t perform that action at this time.
0 commit comments