summaryrefslogtreecommitdiffstats
path: root/source/core/slang-signal.cpp
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-10-29 14:49:26 +0800
committerGitHub <noreply@github.com>2024-10-29 14:49:26 +0800
commitf65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch)
treeea1d61342cd29368e19135000ec2948813096205 /source/core/slang-signal.cpp
parenta729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff)
format
* format * Minor test fixes * enable checking cpp format in ci
Diffstat (limited to 'source/core/slang-signal.cpp')
-rw-r--r--source/core/slang-signal.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/source/core/slang-signal.cpp b/source/core/slang-signal.cpp
index 5f53cba93..1600183e7 100644
--- a/source/core/slang-signal.cpp
+++ b/source/core/slang-signal.cpp
@@ -1,7 +1,6 @@
#include "slang-signal.h"
#include "slang-exception.h"
-
#include "stdio.h"
namespace Slang
@@ -11,13 +10,13 @@ static const char* _getSignalTypeAsText(SignalType type)
{
switch (type)
{
- case SignalType::AssertFailure: return "assert failure";
- case SignalType::Unimplemented: return "unimplemented";
- case SignalType::Unreachable: return "hit unreachable code";
- case SignalType::Unexpected: return "unexpected";
- case SignalType::InvalidOperation: return "invalid operation";
- case SignalType::AbortCompilation: return "abort compilation";
- default: return "unhandled";
+ case SignalType::AssertFailure: return "assert failure";
+ case SignalType::Unimplemented: return "unimplemented";
+ case SignalType::Unreachable: return "hit unreachable code";
+ case SignalType::Unexpected: return "unexpected";
+ case SignalType::InvalidOperation: return "invalid operation";
+ case SignalType::AbortCompilation: return "abort compilation";
+ default: return "unhandled";
}
}
@@ -30,7 +29,7 @@ String _getMessage(SignalType type, char const* message)
{
buf << ": " << message;
}
-
+
return buf.produceString();
}
@@ -39,7 +38,7 @@ String _getMessage(SignalType type, char const* message)
[[noreturn]] void handleSignal(SignalType type, char const* message)
{
StringBuilder buf;
- const char*const typeText = _getSignalTypeAsText(type);
+ const char* const typeText = _getSignalTypeAsText(type);
buf << typeText << ": " << message;
// Can be useful to enable during debug when problem is on CI
@@ -51,14 +50,14 @@ String _getMessage(SignalType type, char const* message)
#if SLANG_HAS_EXCEPTIONS
switch (type)
{
- case SignalType::InvalidOperation: throw InvalidOperationException(_getMessage(type, message));
- case SignalType::AbortCompilation: throw AbortCompilationException(_getMessage(type, message));
- default: throw InternalError(_getMessage(type, message));
+ case SignalType::InvalidOperation: throw InvalidOperationException(_getMessage(type, message));
+ case SignalType::AbortCompilation: throw AbortCompilationException(_getMessage(type, message));
+ default: throw InternalError(_getMessage(type, message));
}
#else
- // Attempt to drop out into the debugger. If a debugger isn't attached this will likely crash - which is probably the best
- // we can do.
-
+ // Attempt to drop out into the debugger. If a debugger isn't attached this will likely crash -
+ // which is probably the best we can do.
+
SLANG_BREAKPOINT(0);
// 'panic'. Exit with an error code as we can't throw or catch.
@@ -66,4 +65,4 @@ String _getMessage(SignalType type, char const* message)
#endif
}
-}
+} // namespace Slang