summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-signal.cpp9
-rw-r--r--source/core/slang-signal.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/source/core/slang-signal.cpp b/source/core/slang-signal.cpp
index 4ae75eb0e..8a7690351 100644
--- a/source/core/slang-signal.cpp
+++ b/source/core/slang-signal.cpp
@@ -6,6 +6,8 @@
namespace Slang
{
+thread_local String g_lastSignalMessage;
+
static const char* _getSignalTypeAsText(SignalType type)
{
switch (type)
@@ -54,6 +56,8 @@ String _getMessage(SignalType type, char const* message)
printf("%s\n", _getMessage(type, message).getBuffer());
}
+ g_lastSignalMessage = _getMessage(type, message);
+
#if SLANG_HAS_EXCEPTIONS
switch (type)
{
@@ -75,4 +79,9 @@ String _getMessage(SignalType type, char const* message)
#endif
}
+const char* getLastSignalMessage()
+{
+ return g_lastSignalMessage.getBuffer();
+}
+
} // namespace Slang
diff --git a/source/core/slang-signal.h b/source/core/slang-signal.h
index 356ae42f6..b71b27581 100644
--- a/source/core/slang-signal.h
+++ b/source/core/slang-signal.h
@@ -35,6 +35,8 @@ enum class SignalType
::Slang::handleSignal(::Slang::SignalType::AbortCompilation, msg)
+const char* getLastSignalMessage();
+
} // namespace Slang
#endif