clang API Documentation

ExceptionSpecificationType.h
Go to the documentation of this file.
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 /// \file
00011 /// \brief Defines the ExceptionSpecificationType enumeration and various
00012 /// utility functions.
00013 ///
00014 //===----------------------------------------------------------------------===//
00015 #ifndef LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H
00016 #define LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H
00017 
00018 namespace clang {
00019 
00020 /// \brief The various types of exception specifications that exist in C++11.
00021 enum ExceptionSpecificationType {
00022   EST_None,             ///< no exception specification
00023   EST_DynamicNone,      ///< throw()
00024   EST_Dynamic,          ///< throw(T1, T2)
00025   EST_MSAny,            ///< Microsoft throw(...) extension
00026   EST_BasicNoexcept,    ///< noexcept
00027   EST_ComputedNoexcept, ///< noexcept(expression)
00028   EST_Unevaluated,      ///< not evaluated yet, for special member function
00029   EST_Uninstantiated,   ///< not instantiated yet
00030   EST_Unparsed          ///< not parsed yet
00031 };
00032 
00033 inline bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType) {
00034   return ESpecType >= EST_DynamicNone && ESpecType <= EST_MSAny;
00035 }
00036 
00037 inline bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType) {
00038   return ESpecType == EST_BasicNoexcept || ESpecType == EST_ComputedNoexcept;
00039 }
00040 
00041 inline bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType) {
00042   return ESpecType == EST_Unevaluated || ESpecType == EST_Uninstantiated;
00043 }
00044 
00045 /// \brief Possible results from evaluation of a noexcept expression.
00046 enum CanThrowResult {
00047   CT_Cannot,
00048   CT_Dependent,
00049   CT_Can
00050 };
00051 
00052 inline CanThrowResult mergeCanThrow(CanThrowResult CT1, CanThrowResult CT2) {
00053   // CanThrowResult constants are ordered so that the maximum is the correct
00054   // merge result.
00055   return CT1 > CT2 ? CT1 : CT2;
00056 }
00057 
00058 } // end namespace clang
00059 
00060 #endif // LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H