From 97bb82ebcdf8f1391b9d93b5a8d7b1dfc4e88e52 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 4 Oct 2021 14:15:51 -0400 Subject: Removing exceptions from core/compiler-core (#1953) * #include an absolute path didn't work - because paths were taken to always be relative. * Refactor Stream. Working on all tests. * Split out CharEncode. * Make method names lower camel. m_prefix in Writer/Reader * Tidy up around CharEncode interface. * Small improvements around encode/decode. * Better use of types. * Remove readLine from TextReader. * Remove exceptions from Stream/Text handling. * Fix some typos. * Fix tabbing. * Fix missing override. * Remove remaining exception throw/catch via using signal mechanism. * Remove exceptions that are not used anymore. * Document the Stream interface. * Remove index for decoding 'get byte' function. * Fix CharReader -> ByteReader. --- source/core/slang-exception.h | 87 ++++--------------------------------------- 1 file changed, 8 insertions(+), 79 deletions(-) (limited to 'source/core/slang-exception.h') diff --git a/source/core/slang-exception.h b/source/core/slang-exception.h index 91139e298..3c5621d7f 100644 --- a/source/core/slang-exception.h +++ b/source/core/slang-exception.h @@ -6,6 +6,13 @@ namespace Slang { + // NOTE! + // Exceptions should not generally be used in core/compiler-core, use the 'signal' mechanism + // ideally using the macros in the slang-signal.h such as `SLANG_UNEXPECTED` + // + // If core/compiler-core libraries are compiled with SLANG_DISABLE_EXCEPTIONS, + // these classes will *never* be thrown. + class Exception { public: @@ -21,18 +28,6 @@ namespace Slang {} }; - class IndexOutofRangeException : public Exception - { - public: - IndexOutofRangeException() - {} - IndexOutofRangeException(const String & message) - : Exception(message) - { - } - - }; - class InvalidOperationException : public Exception { public: @@ -44,73 +39,7 @@ namespace Slang } }; - - class ArgumentException : public Exception - { - public: - ArgumentException() - {} - ArgumentException(const String & message) - : Exception(message) - { - } - - }; - - class KeyNotFoundException : public Exception - { - public: - KeyNotFoundException() - {} - KeyNotFoundException(const String & message) - : Exception(message) - { - } - }; - class KeyExistsException : public Exception - { - public: - KeyExistsException() - {} - KeyExistsException(const String & message) - : Exception(message) - { - } - }; - - class NotSupportedException : public Exception - { - public: - NotSupportedException() - {} - NotSupportedException(const String & message) - : Exception(message) - { - } - }; - - class NotImplementedException : public Exception - { - public: - NotImplementedException() - {} - NotImplementedException(const String & message) - : Exception(message) - { - } - }; - - class InvalidProgramException : public Exception - { - public: - InvalidProgramException() - {} - InvalidProgramException(const String & message) - : Exception(message) - { - } - }; - + class InternalError : public Exception { public: -- cgit v1.2.3