clang API Documentation
00001 //===--- ExceptionSpecificationType.h ---------------------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines the ExceptionSpecificationType enumeration and various 00011 // utility functions. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 #ifndef LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H 00015 #define LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H 00016 00017 namespace clang { 00018 00019 /// \brief The various types of exception specifications that exist in C++11. 00020 enum ExceptionSpecificationType { 00021 EST_None, ///< no exception specification 00022 EST_DynamicNone, ///< throw() 00023 EST_Dynamic, ///< throw(T1, T2) 00024 EST_MSAny, ///< Microsoft throw(...) extension 00025 EST_BasicNoexcept, ///< noexcept 00026 EST_ComputedNoexcept, ///< noexcept(expression) 00027 EST_Delayed, ///< not known yet 00028 EST_Uninstantiated ///< not instantiated yet 00029 }; 00030 00031 inline bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType) { 00032 return ESpecType >= EST_DynamicNone && ESpecType <= EST_MSAny; 00033 } 00034 00035 inline bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType) { 00036 return ESpecType == EST_BasicNoexcept || ESpecType == EST_ComputedNoexcept; 00037 } 00038 00039 /// \brief Possible results from evaluation of a noexcept expression. 00040 enum CanThrowResult { 00041 CT_Cannot, 00042 CT_Dependent, 00043 CT_Can 00044 }; 00045 00046 inline CanThrowResult mergeCanThrow(CanThrowResult CT1, CanThrowResult CT2) { 00047 // CanThrowResult constants are ordered so that the maximum is the correct 00048 // merge result. 00049 return CT1 > CT2 ? CT1 : CT2; 00050 } 00051 00052 } // end namespace clang 00053 00054 #endif // LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H