dc8186cb83
By default, C functions compiled to bitcode by clang have the nounwind attribute. If such functions throws an exception, the behaviour is undefined. Our interop machinery can process foreign exceptions on call sites (terminate or wrap them in Kotlin exceptions). But if the interop bridges have the nounwind attribute, LLVM optimizations (particularly inlining) may lead to the situation when a foreign exception is ignored by our foreign exception handler. This patch fixes the issue by compiling bridges with -fexceptions flag. This flag makes clang to not set the nounwind attribute, so exceptions can be thrown through C frames.
5 lines
131 B
C++
5 lines
131 B
C++
#include <stdexcept>
|
|
|
|
extern "C" __attribute__((always_inline)) void throwCppException() {
|
|
throw std::runtime_error("Error");
|
|
} |