summaryrefslogtreecommitdiff
path: root/clang-r353983/include/clang/Basic/ExceptionSpecificationType.h
diff options
context:
space:
mode:
authorRalf Luther <luther.ralf@gmail.com>2019-03-27 20:23:17 +0000
committerGerrit Code Review <gerrit2@aicp-server-3>2019-03-27 20:23:17 +0000
commit1ce3a9d272e564b22a1333a1e36a3d3ab7cfab01 (patch)
tree391382eadd4fec5bb480f2e8934fa352770221d1 /clang-r353983/include/clang/Basic/ExceptionSpecificationType.h
parentd1d48b140bafaa8a50107292f5fce95562575765 (diff)
parent4f56932d3416ac03f646bc1a611b3135fec2fe08 (diff)
Merge "Update prebuilt Clang to r353983." into p9.0HEADp9.0-backupp9.0
Diffstat (limited to 'clang-r353983/include/clang/Basic/ExceptionSpecificationType.h')
-rw-r--r--clang-r353983/include/clang/Basic/ExceptionSpecificationType.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/clang-r353983/include/clang/Basic/ExceptionSpecificationType.h b/clang-r353983/include/clang/Basic/ExceptionSpecificationType.h
new file mode 100644
index 00000000..2f65efe7
--- /dev/null
+++ b/clang-r353983/include/clang/Basic/ExceptionSpecificationType.h
@@ -0,0 +1,66 @@
+//===--- ExceptionSpecificationType.h ---------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Defines the ExceptionSpecificationType enumeration and various
+/// utility functions.
+///
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H
+#define LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H
+
+namespace clang {
+
+/// The various types of exception specifications that exist in C++11.
+enum ExceptionSpecificationType {
+ EST_None, ///< no exception specification
+ EST_DynamicNone, ///< throw()
+ EST_Dynamic, ///< throw(T1, T2)
+ EST_MSAny, ///< Microsoft throw(...) extension
+ EST_BasicNoexcept, ///< noexcept
+ EST_DependentNoexcept,///< noexcept(expression), value-dependent
+ EST_NoexceptFalse, ///< noexcept(expression), evals to 'false'
+ EST_NoexceptTrue, ///< noexcept(expression), evals to 'true'
+ EST_Unevaluated, ///< not evaluated yet, for special member function
+ EST_Uninstantiated, ///< not instantiated yet
+ EST_Unparsed ///< not parsed yet
+};
+
+inline bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType) {
+ return ESpecType >= EST_DynamicNone && ESpecType <= EST_MSAny;
+}
+
+inline bool isComputedNoexcept(ExceptionSpecificationType ESpecType) {
+ return ESpecType >= EST_DependentNoexcept &&
+ ESpecType <= EST_NoexceptTrue;
+}
+
+inline bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType) {
+ return ESpecType == EST_BasicNoexcept || isComputedNoexcept(ESpecType);
+}
+
+inline bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType) {
+ return ESpecType == EST_Unevaluated || ESpecType == EST_Uninstantiated;
+}
+
+/// Possible results from evaluation of a noexcept expression.
+enum CanThrowResult {
+ CT_Cannot,
+ CT_Dependent,
+ CT_Can
+};
+
+inline CanThrowResult mergeCanThrow(CanThrowResult CT1, CanThrowResult CT2) {
+ // CanThrowResult constants are ordered so that the maximum is the correct
+ // merge result.
+ return CT1 > CT2 ? CT1 : CT2;
+}
+
+} // end namespace clang
+
+#endif // LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H