Coverage Report

Created: 2019-03-22 08:08

/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
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
///
9
/// \file
10
/// 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
/// 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_DependentNoexcept,///< noexcept(expression), value-dependent
27
  EST_NoexceptFalse,    ///< noexcept(expression), evals to 'false'
28
  EST_NoexceptTrue,     ///< noexcept(expression), evals to 'true'
29
  EST_Unevaluated,      ///< not evaluated yet, for special member function
30
  EST_Uninstantiated,   ///< not instantiated yet
31
  EST_Unparsed          ///< not parsed yet
32
};
33
34
19.1k
inline bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType) {
35
19.1k
  return ESpecType >= EST_DynamicNone && 
ESpecType <= EST_MSAny1.44k
;
36
19.1k
}
37
38
117M
inline bool isComputedNoexcept(ExceptionSpecificationType ESpecType) {
39
117M
  return ESpecType >= EST_DependentNoexcept &&
40
117M
         
ESpecType <= EST_NoexceptTrue8.41M
;
41
117M
}
42
43
211k
inline bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType) {
44
211k
  return ESpecType == EST_BasicNoexcept || 
isComputedNoexcept(ESpecType)140k
;
45
211k
}
46
47
14.9M
inline bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType) {
48
14.9M
  return ESpecType == EST_Unevaluated || 
ESpecType == EST_Uninstantiated14.3M
;
49
14.9M
}
50
51
/// Possible results from evaluation of a noexcept expression.
52
enum CanThrowResult {
53
  CT_Cannot,
54
  CT_Dependent,
55
  CT_Can
56
};
57
58
185k
inline CanThrowResult mergeCanThrow(CanThrowResult CT1, CanThrowResult CT2) {
59
185k
  // CanThrowResult constants are ordered so that the maximum is the correct
60
185k
  // merge result.
61
185k
  return CT1 > CT2 ? 
CT128.8k
:
CT2156k
;
62
185k
}
63
64
} // end namespace clang
65
66
#endif // LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H