Coverage Report

Created: 2018-09-25 23:22

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/Basic/ExceptionSpecificationType.h
Line
Count
Source
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
/// \file
11
/// Defines the ExceptionSpecificationType enumeration and various
12
/// utility functions.
13
///
14
//===----------------------------------------------------------------------===//
15
#ifndef LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H
16
#define LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H
17
18
namespace clang {
19
20
/// The various types of exception specifications that exist in C++11.
21
enum ExceptionSpecificationType {
22
  EST_None,             ///< no exception specification
23
  EST_DynamicNone,      ///< throw()
24
  EST_Dynamic,          ///< throw(T1, T2)
25
  EST_MSAny,            ///< Microsoft throw(...) extension
26
  EST_BasicNoexcept,    ///< noexcept
27
  EST_DependentNoexcept,///< noexcept(expression), value-dependent
28
  EST_NoexceptFalse,    ///< noexcept(expression), evals to 'false'
29
  EST_NoexceptTrue,     ///< noexcept(expression), evals to 'true'
30
  EST_Unevaluated,      ///< not evaluated yet, for special member function
31
  EST_Uninstantiated,   ///< not instantiated yet
32
  EST_Unparsed          ///< not parsed yet
33
};
34
35
18.4k
inline bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType) {
36
18.4k
  return ESpecType >= EST_DynamicNone && 
ESpecType <= EST_MSAny1.20k
;
37
18.4k
}
38
39
113M
inline bool isComputedNoexcept(ExceptionSpecificationType ESpecType) {
40
113M
  return ESpecType >= EST_DependentNoexcept &&
41
113M
         
ESpecType <= EST_NoexceptTrue7.82M
;
42
113M
}
43
44
209k
inline bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType) {
45
209k
  return ESpecType == EST_BasicNoexcept || 
isComputedNoexcept(ESpecType)139k
;
46
209k
}
47
48
14.2M
inline bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType) {
49
14.2M
  return ESpecType == EST_Unevaluated || 
ESpecType == EST_Uninstantiated13.6M
;
50
14.2M
}
51
52
/// Possible results from evaluation of a noexcept expression.
53
enum CanThrowResult {
54
  CT_Cannot,
55
  CT_Dependent,
56
  CT_Can
57
};
58
59
174k
inline CanThrowResult mergeCanThrow(CanThrowResult CT1, CanThrowResult CT2) {
60
174k
  // CanThrowResult constants are ordered so that the maximum is the correct
61
174k
  // merge result.
62
174k
  return CT1 > CT2 ? 
CT129.0k
:
CT2145k
;
63
174k
}
64
65
} // end namespace clang
66
67
#endif // LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H