]> CyberLeo.Net >> Repos - FreeBSD/releng/9.1.git/blob - contrib/llvm/tools/clang/include/clang/Basic/ExceptionSpecificationType.h
Copy stable/9 to releng/9.1 as part of the 9.1-RELEASE release process.
[FreeBSD/releng/9.1.git] / contrib / llvm / tools / clang / include / clang / Basic / ExceptionSpecificationType.h
1 //===--- ExceptionSpecificationType.h ---------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the ExceptionSpecificationType enumeration and various
11 // utility functions.
12 //
13 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H
15 #define LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H
16
17 namespace clang {
18
19 /// \brief The various types of exception specifications that exist in C++11.
20 enum ExceptionSpecificationType {
21   EST_None,             ///< no exception specification
22   EST_DynamicNone,      ///< throw()
23   EST_Dynamic,          ///< throw(T1, T2)
24   EST_MSAny,            ///< Microsoft throw(...) extension
25   EST_BasicNoexcept,    ///< noexcept
26   EST_ComputedNoexcept, ///< noexcept(expression)
27   EST_Delayed,          ///< not known yet
28   EST_Uninstantiated    ///< not instantiated yet
29 };
30
31 inline bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType) {
32   return ESpecType >= EST_DynamicNone && ESpecType <= EST_MSAny;
33 }
34
35 inline bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType) {
36   return ESpecType == EST_BasicNoexcept || ESpecType == EST_ComputedNoexcept;
37 }
38
39 /// \brief Possible results from evaluation of a noexcept expression.
40 enum CanThrowResult {
41   CT_Cannot,
42   CT_Dependent,
43   CT_Can
44 };
45
46 inline CanThrowResult mergeCanThrow(CanThrowResult CT1, CanThrowResult CT2) {
47   // CanThrowResult constants are ordered so that the maximum is the correct
48   // merge result.
49   return CT1 > CT2 ? CT1 : CT2;
50 }
51
52 } // end namespace clang
53
54 #endif // LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H