Coverage Report

Created: 2019-03-24 22:13

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/ADT/BitmaskEnum.h
Line
Count
Source
1
//===-- llvm/ADT/BitmaskEnum.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
#ifndef LLVM_ADT_BITMASKENUM_H
10
#define LLVM_ADT_BITMASKENUM_H
11
12
#include <cassert>
13
#include <type_traits>
14
#include <utility>
15
16
#include "llvm/Support/MathExtras.h"
17
18
/// LLVM_MARK_AS_BITMASK_ENUM lets you opt in an individual enum type so you can
19
/// perform bitwise operations on it without putting static_cast everywhere.
20
///
21
/// \code
22
///   enum MyEnum {
23
///     E1 = 1, E2 = 2, E3 = 4, E4 = 8,
24
///     LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ E4)
25
///   };
26
///
27
///   void Foo() {
28
///     MyEnum A = (E1 | E2) & E3 ^ ~E4; // Look, ma: No static_cast!
29
///   }
30
/// \endcode
31
///
32
/// Normally when you do a bitwise operation on an enum value, you get back an
33
/// instance of the underlying type (e.g. int).  But using this macro, bitwise
34
/// ops on your enum will return you back instances of the enum.  This is
35
/// particularly useful for enums which represent a combination of flags.
36
///
37
/// The parameter to LLVM_MARK_AS_BITMASK_ENUM should be the largest individual
38
/// value in your enum.
39
///
40
/// All of the enum's values must be non-negative.
41
#define LLVM_MARK_AS_BITMASK_ENUM(LargestValue)                                \
42
  LLVM_BITMASK_LARGEST_ENUMERATOR = LargestValue
43
44
/// LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE() pulls the operator overloads used
45
/// by LLVM_MARK_AS_BITMASK_ENUM into the current namespace.
46
///
47
/// Suppose you have an enum foo::bar::MyEnum.  Before using
48
/// LLVM_MARK_AS_BITMASK_ENUM on MyEnum, you must put
49
/// LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE() somewhere inside namespace foo or
50
/// namespace foo::bar.  This allows the relevant operator overloads to be found
51
/// by ADL.
52
///
53
/// You don't need to use this macro in namespace llvm; it's done at the bottom
54
/// of this file.
55
#define LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE()                               \
56
  using ::llvm::BitmaskEnumDetail::operator~;                                  \
57
  using ::llvm::BitmaskEnumDetail::operator|;                                  \
58
  using ::llvm::BitmaskEnumDetail::operator&;                                  \
59
  using ::llvm::BitmaskEnumDetail::operator^;                                  \
60
  using ::llvm::BitmaskEnumDetail::operator|=;                                 \
61
  using ::llvm::BitmaskEnumDetail::operator&=;                                 \
62
  /* Force a semicolon at the end of this macro. */                            \
63
  using ::llvm::BitmaskEnumDetail::operator^=
64
65
namespace llvm {
66
67
/// Traits class to determine whether an enum has a
68
/// LLVM_BITMASK_LARGEST_ENUMERATOR enumerator.
69
template <typename E, typename Enable = void>
70
struct is_bitmask_enum : std::false_type {};
71
72
template <typename E>
73
struct is_bitmask_enum<
74
    E, typename std::enable_if<sizeof(E::LLVM_BITMASK_LARGEST_ENUMERATOR) >=
75
                               0>::type> : std::true_type {};
76
namespace BitmaskEnumDetail {
77
78
/// Get a bitmask with 1s in all places up to the high-order bit of E's largest
79
/// value.
80
155k
template <typename E> typename std::underlying_type<E>::type Mask() {
81
155k
  // On overflow, NextPowerOf2 returns zero with the type uint64_t, so
82
155k
  // subtracting 1 gives us the mask with all bits set, like we want.
83
155k
  return NextPowerOf2(static_cast<typename std::underlying_type<E>::type>(
84
155k
             E::LLVM_BITMASK_LARGEST_ENUMERATOR)) -
85
155k
         1;
86
155k
}
std::__1::underlying_type<llvm::MachineMemOperand::Flags>::type llvm::BitmaskEnumDetail::Mask<llvm::MachineMemOperand::Flags>()
Line
Count
Source
80
14.1k
template <typename E> typename std::underlying_type<E>::type Mask() {
81
14.1k
  // On overflow, NextPowerOf2 returns zero with the type uint64_t, so
82
14.1k
  // subtracting 1 gives us the mask with all bits set, like we want.
83
14.1k
  return NextPowerOf2(static_cast<typename std::underlying_type<E>::type>(
84
14.1k
             E::LLVM_BITMASK_LARGEST_ENUMERATOR)) -
85
14.1k
         1;
86
14.1k
}
std::__1::underlying_type<llvm::DINode::DIFlags>::type llvm::BitmaskEnumDetail::Mask<llvm::DINode::DIFlags>()
Line
Count
Source
80
10.8k
template <typename E> typename std::underlying_type<E>::type Mask() {
81
10.8k
  // On overflow, NextPowerOf2 returns zero with the type uint64_t, so
82
10.8k
  // subtracting 1 gives us the mask with all bits set, like we want.
83
10.8k
  return NextPowerOf2(static_cast<typename std::underlying_type<E>::type>(
84
10.8k
             E::LLVM_BITMASK_LARGEST_ENUMERATOR)) -
85
10.8k
         1;
86
10.8k
}
std::__1::underlying_type<llvm::DISubprogram::DISPFlags>::type llvm::BitmaskEnumDetail::Mask<llvm::DISubprogram::DISPFlags>()
Line
Count
Source
80
5.58k
template <typename E> typename std::underlying_type<E>::type Mask() {
81
5.58k
  // On overflow, NextPowerOf2 returns zero with the type uint64_t, so
82
5.58k
  // subtracting 1 gives us the mask with all bits set, like we want.
83
5.58k
  return NextPowerOf2(static_cast<typename std::underlying_type<E>::type>(
84
5.58k
             E::LLVM_BITMASK_LARGEST_ENUMERATOR)) -
85
5.58k
         1;
86
5.58k
}
CGOpenMPRuntime.cpp:std::__1::underlying_type<(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags>::type llvm::BitmaskEnumDetail::Mask<(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags>()
Line
Count
Source
80
870
template <typename E> typename std::underlying_type<E>::type Mask() {
81
870
  // On overflow, NextPowerOf2 returns zero with the type uint64_t, so
82
870
  // subtracting 1 gives us the mask with all bits set, like we want.
83
870
  return NextPowerOf2(static_cast<typename std::underlying_type<E>::type>(
84
870
             E::LLVM_BITMASK_LARGEST_ENUMERATOR)) -
85
870
         1;
86
870
}
CGOpenMPRuntimeNVPTX.cpp:std::__1::underlying_type<(anonymous namespace)::ModeFlagsTy>::type llvm::BitmaskEnumDetail::Mask<(anonymous namespace)::ModeFlagsTy>()
Line
Count
Source
80
61.6k
template <typename E> typename std::underlying_type<E>::type Mask() {
81
61.6k
  // On overflow, NextPowerOf2 returns zero with the type uint64_t, so
82
61.6k
  // subtracting 1 gives us the mask with all bits set, like we want.
83
61.6k
  return NextPowerOf2(static_cast<typename std::underlying_type<E>::type>(
84
61.6k
             E::LLVM_BITMASK_LARGEST_ENUMERATOR)) -
85
61.6k
         1;
86
61.6k
}
std::__1::underlying_type<clang::Parser::ParsedStmtContext>::type llvm::BitmaskEnumDetail::Mask<clang::Parser::ParsedStmtContext>()
Line
Count
Source
80
62.2k
template <typename E> typename std::underlying_type<E>::type Mask() {
81
62.2k
  // On overflow, NextPowerOf2 returns zero with the type uint64_t, so
82
62.2k
  // subtracting 1 gives us the mask with all bits set, like we want.
83
62.2k
  return NextPowerOf2(static_cast<typename std::underlying_type<E>::type>(
84
62.2k
             E::LLVM_BITMASK_LARGEST_ENUMERATOR)) -
85
62.2k
         1;
86
62.2k
}
87
88
/// Check that Val is in range for E, and return Val cast to E's underlying
89
/// type.
90
356M
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
91
356M
  auto U = static_cast<typename std::underlying_type<E>::type>(Val);
92
356M
  assert(U >= 0 && "Negative enum values are not allowed.");
93
356M
  assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
94
356M
  return U;
95
356M
}
std::__1::underlying_type<llvm::MachineMemOperand::Flags>::type llvm::BitmaskEnumDetail::Underlying<llvm::MachineMemOperand::Flags>(llvm::MachineMemOperand::Flags)
Line
Count
Source
90
331M
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
91
331M
  auto U = static_cast<typename std::underlying_type<E>::type>(Val);
92
331M
  assert(U >= 0 && "Negative enum values are not allowed.");
93
331M
  assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
94
331M
  return U;
95
331M
}
std::__1::underlying_type<llvm::BinaryStreamFlags>::type llvm::BitmaskEnumDetail::Underlying<llvm::BinaryStreamFlags>(llvm::BinaryStreamFlags)
Line
Count
Source
90
509k
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
91
509k
  auto U = static_cast<typename std::underlying_type<E>::type>(Val);
92
509k
  assert(U >= 0 && "Negative enum values are not allowed.");
93
509k
  assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
94
509k
  return U;
95
509k
}
std::__1::underlying_type<llvm::DINode::DIFlags>::type llvm::BitmaskEnumDetail::Underlying<llvm::DINode::DIFlags>(llvm::DINode::DIFlags)
Line
Count
Source
90
5.78M
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
91
5.78M
  auto U = static_cast<typename std::underlying_type<E>::type>(Val);
92
5.78M
  assert(U >= 0 && "Negative enum values are not allowed.");
93
5.78M
  assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
94
5.78M
  return U;
95
5.78M
}
std::__1::underlying_type<llvm::DISubprogram::DISPFlags>::type llvm::BitmaskEnumDetail::Underlying<llvm::DISubprogram::DISPFlags>(llvm::DISubprogram::DISPFlags)
Line
Count
Source
90
1.81M
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
91
1.81M
  auto U = static_cast<typename std::underlying_type<E>::type>(Val);
92
1.81M
  assert(U >= 0 && "Negative enum values are not allowed.");
93
1.81M
  assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
94
1.81M
  return U;
95
1.81M
}
SIMemoryLegalizer.cpp:std::__1::underlying_type<(anonymous namespace)::SIAtomicAddrSpace>::type llvm::BitmaskEnumDetail::Underlying<(anonymous namespace)::SIAtomicAddrSpace>((anonymous namespace)::SIAtomicAddrSpace)
Line
Count
Source
90
163k
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
91
163k
  auto U = static_cast<typename std::underlying_type<E>::type>(Val);
92
163k
  assert(U >= 0 && "Negative enum values are not allowed.");
93
163k
  assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
94
163k
  return U;
95
163k
}
SIMemoryLegalizer.cpp:std::__1::underlying_type<(anonymous namespace)::SIMemOp>::type llvm::BitmaskEnumDetail::Underlying<(anonymous namespace)::SIMemOp>((anonymous namespace)::SIMemOp)
Line
Count
Source
90
4.34k
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
91
4.34k
  auto U = static_cast<typename std::underlying_type<E>::type>(Val);
92
4.34k
  assert(U >= 0 && "Negative enum values are not allowed.");
93
4.34k
  assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
94
4.34k
  return U;
95
4.34k
}
CGOpenMPRuntime.cpp:std::__1::underlying_type<(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags>::type llvm::BitmaskEnumDetail::Underlying<(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags>((anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags)
Line
Count
Source
90
92.6k
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
91
92.6k
  auto U = static_cast<typename std::underlying_type<E>::type>(Val);
92
92.6k
  assert(U >= 0 && "Negative enum values are not allowed.");
93
92.6k
  assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
94
92.6k
  return U;
95
92.6k
}
CGOpenMPRuntimeNVPTX.cpp:std::__1::underlying_type<(anonymous namespace)::ModeFlagsTy>::type llvm::BitmaskEnumDetail::Underlying<(anonymous namespace)::ModeFlagsTy>((anonymous namespace)::ModeFlagsTy)
Line
Count
Source
90
185k
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
91
185k
  auto U = static_cast<typename std::underlying_type<E>::type>(Val);
92
185k
  assert(U >= 0 && "Negative enum values are not allowed.");
93
185k
  assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
94
185k
  return U;
95
185k
}
std::__1::underlying_type<clang::Parser::ParsedStmtContext>::type llvm::BitmaskEnumDetail::Underlying<clang::Parser::ParsedStmtContext>(clang::Parser::ParsedStmtContext)
Line
Count
Source
90
15.5M
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
91
15.5M
  auto U = static_cast<typename std::underlying_type<E>::type>(Val);
92
15.5M
  assert(U >= 0 && "Negative enum values are not allowed.");
93
15.5M
  assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
94
15.5M
  return U;
95
15.5M
}
std::__1::underlying_type<clang::Parser::AngleBracketTracker::Priority>::type llvm::BitmaskEnumDetail::Underlying<clang::Parser::AngleBracketTracker::Priority>(clang::Parser::AngleBracketTracker::Priority)
Line
Count
Source
90
449k
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
91
449k
  auto U = static_cast<typename std::underlying_type<E>::type>(Val);
92
449k
  assert(U >= 0 && "Negative enum values are not allowed.");
93
449k
  assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
94
449k
  return U;
95
449k
}
std::__1::underlying_type<llvm::pdb::PdbSymbolIdField>::type llvm::BitmaskEnumDetail::Underlying<llvm::pdb::PdbSymbolIdField>(llvm::pdb::PdbSymbolIdField)
Line
Count
Source
90
2.68k
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
91
2.68k
  auto U = static_cast<typename std::underlying_type<E>::type>(Val);
92
2.68k
  assert(U >= 0 && "Negative enum values are not allowed.");
93
2.68k
  assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
94
2.68k
  return U;
95
2.68k
}
std::__1::underlying_type<llvm::pdb::PdbRaw_Features>::type llvm::BitmaskEnumDetail::Underlying<llvm::pdb::PdbRaw_Features>(llvm::pdb::PdbRaw_Features)
Line
Count
Source
90
412
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) {
91
412
  auto U = static_cast<typename std::underlying_type<E>::type>(Val);
92
412
  assert(U >= 0 && "Negative enum values are not allowed.");
93
412
  assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
94
412
  return U;
95
412
}
96
97
template <typename E,
98
          typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
99
155k
E operator~(E Val) {
100
155k
  return static_cast<E>(~Underlying(Val) & Mask<E>());
101
155k
}
llvm::MachineMemOperand::Flags llvm::BitmaskEnumDetail::operator~<llvm::MachineMemOperand::Flags, void>(llvm::MachineMemOperand::Flags)
Line
Count
Source
99
14.1k
E operator~(E Val) {
100
14.1k
  return static_cast<E>(~Underlying(Val) & Mask<E>());
101
14.1k
}
llvm::DINode::DIFlags llvm::BitmaskEnumDetail::operator~<llvm::DINode::DIFlags, void>(llvm::DINode::DIFlags)
Line
Count
Source
99
10.8k
E operator~(E Val) {
100
10.8k
  return static_cast<E>(~Underlying(Val) & Mask<E>());
101
10.8k
}
llvm::DISubprogram::DISPFlags llvm::BitmaskEnumDetail::operator~<llvm::DISubprogram::DISPFlags, void>(llvm::DISubprogram::DISPFlags)
Line
Count
Source
99
5.58k
E operator~(E Val) {
100
5.58k
  return static_cast<E>(~Underlying(Val) & Mask<E>());
101
5.58k
}
CGOpenMPRuntime.cpp:(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags llvm::BitmaskEnumDetail::operator~<(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags, void>((anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags)
Line
Count
Source
99
870
E operator~(E Val) {
100
870
  return static_cast<E>(~Underlying(Val) & Mask<E>());
101
870
}
CGOpenMPRuntimeNVPTX.cpp:(anonymous namespace)::ModeFlagsTy llvm::BitmaskEnumDetail::operator~<(anonymous namespace)::ModeFlagsTy, void>((anonymous namespace)::ModeFlagsTy)
Line
Count
Source
99
61.6k
E operator~(E Val) {
100
61.6k
  return static_cast<E>(~Underlying(Val) & Mask<E>());
101
61.6k
}
clang::Parser::ParsedStmtContext llvm::BitmaskEnumDetail::operator~<clang::Parser::ParsedStmtContext, void>(clang::Parser::ParsedStmtContext)
Line
Count
Source
99
62.2k
E operator~(E Val) {
100
62.2k
  return static_cast<E>(~Underlying(Val) & Mask<E>());
101
62.2k
}
102
103
template <typename E,
104
          typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
105
10.8M
E operator|(E LHS, E RHS) {
106
10.8M
  return static_cast<E>(Underlying(LHS) | Underlying(RHS));
107
10.8M
}
llvm::MachineMemOperand::Flags llvm::BitmaskEnumDetail::operator|<llvm::MachineMemOperand::Flags, void>(llvm::MachineMemOperand::Flags, llvm::MachineMemOperand::Flags)
Line
Count
Source
105
6.25M
E operator|(E LHS, E RHS) {
106
6.25M
  return static_cast<E>(Underlying(LHS) | Underlying(RHS));
107
6.25M
}
llvm::BinaryStreamFlags llvm::BitmaskEnumDetail::operator|<llvm::BinaryStreamFlags, void>(llvm::BinaryStreamFlags, llvm::BinaryStreamFlags)
Line
Count
Source
105
36.7k
E operator|(E LHS, E RHS) {
106
36.7k
  return static_cast<E>(Underlying(LHS) | Underlying(RHS));
107
36.7k
}
SIMemoryLegalizer.cpp:(anonymous namespace)::SIAtomicAddrSpace llvm::BitmaskEnumDetail::operator|<(anonymous namespace)::SIAtomicAddrSpace, void>((anonymous namespace)::SIAtomicAddrSpace, (anonymous namespace)::SIAtomicAddrSpace)
Line
Count
Source
105
62.9k
E operator|(E LHS, E RHS) {
106
62.9k
  return static_cast<E>(Underlying(LHS) | Underlying(RHS));
107
62.9k
}
SIMemoryLegalizer.cpp:(anonymous namespace)::SIMemOp llvm::BitmaskEnumDetail::operator|<(anonymous namespace)::SIMemOp, void>((anonymous namespace)::SIMemOp, (anonymous namespace)::SIMemOp)
Line
Count
Source
105
2.17k
E operator|(E LHS, E RHS) {
106
2.17k
  return static_cast<E>(Underlying(LHS) | Underlying(RHS));
107
2.17k
}
llvm::DISubprogram::DISPFlags llvm::BitmaskEnumDetail::operator|<llvm::DISubprogram::DISPFlags, void>(llvm::DISubprogram::DISPFlags, llvm::DISubprogram::DISPFlags)
Line
Count
Source
105
228k
E operator|(E LHS, E RHS) {
106
228k
  return static_cast<E>(Underlying(LHS) | Underlying(RHS));
107
228k
}
llvm::DINode::DIFlags llvm::BitmaskEnumDetail::operator|<llvm::DINode::DIFlags, void>(llvm::DINode::DIFlags, llvm::DINode::DIFlags)
Line
Count
Source
105
237k
E operator|(E LHS, E RHS) {
106
237k
  return static_cast<E>(Underlying(LHS) | Underlying(RHS));
107
237k
}
CGOpenMPRuntime.cpp:(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags llvm::BitmaskEnumDetail::operator|<(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags, void>((anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags, (anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags)
Line
Count
Source
105
44.3k
E operator|(E LHS, E RHS) {
106
44.3k
  return static_cast<E>(Underlying(LHS) | Underlying(RHS));
107
44.3k
}
CGOpenMPRuntimeNVPTX.cpp:(anonymous namespace)::ModeFlagsTy llvm::BitmaskEnumDetail::operator|<(anonymous namespace)::ModeFlagsTy, void>((anonymous namespace)::ModeFlagsTy, (anonymous namespace)::ModeFlagsTy)
Line
Count
Source
105
538
E operator|(E LHS, E RHS) {
106
538
  return static_cast<E>(Underlying(LHS) | Underlying(RHS));
107
538
}
clang::Parser::ParsedStmtContext llvm::BitmaskEnumDetail::operator|<clang::Parser::ParsedStmtContext, void>(clang::Parser::ParsedStmtContext, clang::Parser::ParsedStmtContext)
Line
Count
Source
105
3.76M
E operator|(E LHS, E RHS) {
106
3.76M
  return static_cast<E>(Underlying(LHS) | Underlying(RHS));
107
3.76M
}
clang::Parser::AngleBracketTracker::Priority llvm::BitmaskEnumDetail::operator|<clang::Parser::AngleBracketTracker::Priority, void>(clang::Parser::AngleBracketTracker::Priority, clang::Parser::AngleBracketTracker::Priority)
Line
Count
Source
105
224k
E operator|(E LHS, E RHS) {
106
224k
  return static_cast<E>(Underlying(LHS) | Underlying(RHS));
107
224k
}
llvm::pdb::PdbRaw_Features llvm::BitmaskEnumDetail::operator|<llvm::pdb::PdbRaw_Features, void>(llvm::pdb::PdbRaw_Features, llvm::pdb::PdbRaw_Features)
Line
Count
Source
105
83
E operator|(E LHS, E RHS) {
106
83
  return static_cast<E>(Underlying(LHS) | Underlying(RHS));
107
83
}
108
109
template <typename E,
110
          typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
111
167M
E operator&(E LHS, E RHS) {
112
167M
  return static_cast<E>(Underlying(LHS) & Underlying(RHS));
113
167M
}
llvm::MachineMemOperand::Flags llvm::BitmaskEnumDetail::operator&<llvm::MachineMemOperand::Flags, void>(llvm::MachineMemOperand::Flags, llvm::MachineMemOperand::Flags)
Line
Count
Source
111
159M
E operator&(E LHS, E RHS) {
112
159M
  return static_cast<E>(Underlying(LHS) & Underlying(RHS));
113
159M
}
llvm::BinaryStreamFlags llvm::BitmaskEnumDetail::operator&<llvm::BinaryStreamFlags, void>(llvm::BinaryStreamFlags, llvm::BinaryStreamFlags)
Line
Count
Source
111
218k
E operator&(E LHS, E RHS) {
112
218k
  return static_cast<E>(Underlying(LHS) & Underlying(RHS));
113
218k
}
llvm::DINode::DIFlags llvm::BitmaskEnumDetail::operator&<llvm::DINode::DIFlags, void>(llvm::DINode::DIFlags, llvm::DINode::DIFlags)
Line
Count
Source
111
2.65M
E operator&(E LHS, E RHS) {
112
2.65M
  return static_cast<E>(Underlying(LHS) & Underlying(RHS));
113
2.65M
}
llvm::DISubprogram::DISPFlags llvm::BitmaskEnumDetail::operator&<llvm::DISubprogram::DISPFlags, void>(llvm::DISubprogram::DISPFlags, llvm::DISubprogram::DISPFlags)
Line
Count
Source
111
676k
E operator&(E LHS, E RHS) {
112
676k
  return static_cast<E>(Underlying(LHS) & Underlying(RHS));
113
676k
}
SIMemoryLegalizer.cpp:(anonymous namespace)::SIAtomicAddrSpace llvm::BitmaskEnumDetail::operator&<(anonymous namespace)::SIAtomicAddrSpace, void>((anonymous namespace)::SIAtomicAddrSpace, (anonymous namespace)::SIAtomicAddrSpace)
Line
Count
Source
111
18.8k
E operator&(E LHS, E RHS) {
112
18.8k
  return static_cast<E>(Underlying(LHS) & Underlying(RHS));
113
18.8k
}
CGOpenMPRuntime.cpp:(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags llvm::BitmaskEnumDetail::operator&<(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags, void>((anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags, (anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags)
Line
Count
Source
111
1.50k
E operator&(E LHS, E RHS) {
112
1.50k
  return static_cast<E>(Underlying(LHS) & Underlying(RHS));
113
1.50k
}
CGOpenMPRuntimeNVPTX.cpp:(anonymous namespace)::ModeFlagsTy llvm::BitmaskEnumDetail::operator&<(anonymous namespace)::ModeFlagsTy, void>((anonymous namespace)::ModeFlagsTy, (anonymous namespace)::ModeFlagsTy)
Line
Count
Source
111
61.4k
E operator&(E LHS, E RHS) {
112
61.4k
  return static_cast<E>(Underlying(LHS) & Underlying(RHS));
113
61.4k
}
clang::Parser::ParsedStmtContext llvm::BitmaskEnumDetail::operator&<clang::Parser::ParsedStmtContext, void>(clang::Parser::ParsedStmtContext, clang::Parser::ParsedStmtContext)
Line
Count
Source
111
3.97M
E operator&(E LHS, E RHS) {
112
3.97M
  return static_cast<E>(Underlying(LHS) & Underlying(RHS));
113
3.97M
}
llvm::pdb::PdbSymbolIdField llvm::BitmaskEnumDetail::operator&<llvm::pdb::PdbSymbolIdField, void>(llvm::pdb::PdbSymbolIdField, llvm::pdb::PdbSymbolIdField)
Line
Count
Source
111
1.33k
E operator&(E LHS, E RHS) {
112
1.33k
  return static_cast<E>(Underlying(LHS) & Underlying(RHS));
113
1.33k
}
llvm::pdb::PdbRaw_Features llvm::BitmaskEnumDetail::operator&<llvm::pdb::PdbRaw_Features, void>(llvm::pdb::PdbRaw_Features, llvm::pdb::PdbRaw_Features)
Line
Count
Source
111
123
E operator&(E LHS, E RHS) {
112
123
  return static_cast<E>(Underlying(LHS) & Underlying(RHS));
113
123
}
114
115
template <typename E,
116
          typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
117
E operator^(E LHS, E RHS) {
118
  return static_cast<E>(Underlying(LHS) ^ Underlying(RHS));
119
}
120
121
// |=, &=, and ^= return a reference to LHS, to match the behavior of the
122
// operators on builtin types.
123
124
template <typename E,
125
          typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
126
6.35M
E &operator|=(E &LHS, E RHS) {
127
6.35M
  LHS = LHS | RHS;
128
6.35M
  return LHS;
129
6.35M
}
llvm::MachineMemOperand::Flags& llvm::BitmaskEnumDetail::operator|=<llvm::MachineMemOperand::Flags, void>(llvm::MachineMemOperand::Flags&, llvm::MachineMemOperand::Flags)
Line
Count
Source
126
6.03M
E &operator|=(E &LHS, E RHS) {
127
6.03M
  LHS = LHS | RHS;
128
6.03M
  return LHS;
129
6.03M
}
SIMemoryLegalizer.cpp:(anonymous namespace)::SIAtomicAddrSpace& llvm::BitmaskEnumDetail::operator|=<(anonymous namespace)::SIAtomicAddrSpace, void>((anonymous namespace)::SIAtomicAddrSpace&, (anonymous namespace)::SIAtomicAddrSpace)
Line
Count
Source
126
62.9k
E &operator|=(E &LHS, E RHS) {
127
62.9k
  LHS = LHS | RHS;
128
62.9k
  return LHS;
129
62.9k
}
llvm::DINode::DIFlags& llvm::BitmaskEnumDetail::operator|=<llvm::DINode::DIFlags, void>(llvm::DINode::DIFlags&, llvm::DINode::DIFlags)
Line
Count
Source
126
123k
E &operator|=(E &LHS, E RHS) {
127
123k
  LHS = LHS | RHS;
128
123k
  return LHS;
129
123k
}
llvm::DISubprogram::DISPFlags& llvm::BitmaskEnumDetail::operator|=<llvm::DISubprogram::DISPFlags, void>(llvm::DISubprogram::DISPFlags&, llvm::DISubprogram::DISPFlags)
Line
Count
Source
126
117k
E &operator|=(E &LHS, E RHS) {
127
117k
  LHS = LHS | RHS;
128
117k
  return LHS;
129
117k
}
CGOpenMPRuntime.cpp:(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags& llvm::BitmaskEnumDetail::operator|=<(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags, void>((anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags&, (anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags)
Line
Count
Source
126
15.4k
E &operator|=(E &LHS, E RHS) {
127
15.4k
  LHS = LHS | RHS;
128
15.4k
  return LHS;
129
15.4k
}
llvm::pdb::PdbRaw_Features& llvm::BitmaskEnumDetail::operator|=<llvm::pdb::PdbRaw_Features, void>(llvm::pdb::PdbRaw_Features&, llvm::pdb::PdbRaw_Features)
Line
Count
Source
126
83
E &operator|=(E &LHS, E RHS) {
127
83
  LHS = LHS | RHS;
128
83
  return LHS;
129
83
}
130
131
template <typename E,
132
          typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
133
79.7k
E &operator&=(E &LHS, E RHS) {
134
79.7k
  LHS = LHS & RHS;
135
79.7k
  return LHS;
136
79.7k
}
llvm::DINode::DIFlags& llvm::BitmaskEnumDetail::operator&=<llvm::DINode::DIFlags, void>(llvm::DINode::DIFlags&, llvm::DINode::DIFlags)
Line
Count
Source
133
10.8k
E &operator&=(E &LHS, E RHS) {
134
10.8k
  LHS = LHS & RHS;
135
10.8k
  return LHS;
136
10.8k
}
llvm::DISubprogram::DISPFlags& llvm::BitmaskEnumDetail::operator&=<llvm::DISubprogram::DISPFlags, void>(llvm::DISubprogram::DISPFlags&, llvm::DISubprogram::DISPFlags)
Line
Count
Source
133
5.58k
E &operator&=(E &LHS, E RHS) {
134
5.58k
  LHS = LHS & RHS;
135
5.58k
  return LHS;
136
5.58k
}
CGOpenMPRuntime.cpp:(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags& llvm::BitmaskEnumDetail::operator&=<(anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags, void>((anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags&, (anonymous namespace)::MappableExprsHandler::OpenMPOffloadMappingFlags)
Line
Count
Source
133
870
E &operator&=(E &LHS, E RHS) {
134
870
  LHS = LHS & RHS;
135
870
  return LHS;
136
870
}
llvm::MachineMemOperand::Flags& llvm::BitmaskEnumDetail::operator&=<llvm::MachineMemOperand::Flags, void>(llvm::MachineMemOperand::Flags&, llvm::MachineMemOperand::Flags)
Line
Count
Source
133
227
E &operator&=(E &LHS, E RHS) {
134
227
  LHS = LHS & RHS;
135
227
  return LHS;
136
227
}
clang::Parser::ParsedStmtContext& llvm::BitmaskEnumDetail::operator&=<clang::Parser::ParsedStmtContext, void>(clang::Parser::ParsedStmtContext&, clang::Parser::ParsedStmtContext)
Line
Count
Source
133
62.2k
E &operator&=(E &LHS, E RHS) {
134
62.2k
  LHS = LHS & RHS;
135
62.2k
  return LHS;
136
62.2k
}
137
138
template <typename E,
139
          typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
140
E &operator^=(E &LHS, E RHS) {
141
  LHS = LHS ^ RHS;
142
  return LHS;
143
}
144
145
} // namespace BitmaskEnumDetail
146
147
// Enable bitmask enums in namespace ::llvm and all nested namespaces.
148
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
149
150
} // namespace llvm
151
152
#endif