Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/ADT/bit.h
Line
Count
Source
1
//===-- llvm/ADT/bit.h - C++20 <bit> ----------------------------*- 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
// This file implements the C++20 <bit> header.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_ADT_BIT_H
14
#define LLVM_ADT_BIT_H
15
16
#include "llvm/Support/Compiler.h"
17
#include <cstring>
18
#include <type_traits>
19
20
namespace llvm {
21
22
// This implementation of bit_cast is different from the C++17 one in two ways:
23
//  - It isn't constexpr because that requires compiler support.
24
//  - It requires trivially-constructible To, to avoid UB in the implementation.
25
template <typename To, typename From
26
          , typename = typename std::enable_if<sizeof(To) == sizeof(From)>::type
27
#if (__has_feature(is_trivially_constructible) && defined(_LIBCPP_VERSION)) || \
28
    (defined(__GNUC__) && __GNUC__ >= 5)
29
          , typename = typename std::is_trivially_constructible<To>::type
30
#elif __has_feature(is_trivially_constructible)
31
          , typename = typename std::enable_if<__is_trivially_constructible(To)>::type
32
#else
33
  // See comment below.
34
#endif
35
#if (__has_feature(is_trivially_copyable) && defined(_LIBCPP_VERSION)) || \
36
    (defined(__GNUC__) && __GNUC__ >= 5)
37
          , typename = typename std::enable_if<std::is_trivially_copyable<To>::value>::type
38
          , typename = typename std::enable_if<std::is_trivially_copyable<From>::value>::type
39
#elif __has_feature(is_trivially_copyable)
40
          , typename = typename std::enable_if<__is_trivially_copyable(To)>::type
41
          , typename = typename std::enable_if<__is_trivially_copyable(From)>::type
42
#else
43
// This case is GCC 4.x. clang with libc++ or libstdc++ never get here. Unlike
44
// llvm/Support/type_traits.h's is_trivially_copyable we don't want to
45
// provide a good-enough answer here: developers in that configuration will hit
46
// compilation failures on the bots instead of locally. That's acceptable
47
// because it's very few developers, and only until we move past C++11.
48
#endif
49
>
50
1.63G
inline To bit_cast(const From &from) noexcept {
51
1.63G
  To to;
52
1.63G
  std::memcpy(&to, &from, sizeof(To));
53
1.63G
  return to;
54
1.63G
}
unsigned long llvm::bit_cast<unsigned long, llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::StorageT, void, std::__1::integral_constant<bool, true>, void, void>(llvm::PointerSumType<llvm::MemDepResult::DepType, llvm::PointerSumTypeMember<0ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<1ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<2ul, llvm::Instruction*, llvm::PointerLikeTypeTraits<llvm::Instruction*> >, llvm::PointerSumTypeMember<3ul, llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3>, llvm::PointerLikeTypeTraits<llvm::PointerEmbeddedInt<llvm::MemDepResult::OtherType, 3> > > >::StorageT const&)
Line
Count
Source
50
137M
inline To bit_cast(const From &from) noexcept {
51
137M
  To to;
52
137M
  std::memcpy(&to, &from, sizeof(To));
53
137M
  return to;
54
137M
}
unsigned long llvm::bit_cast<unsigned long, llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::StorageT, void, std::__1::integral_constant<bool, true>, void, void>(llvm::PointerSumType<llvm::MachineInstr::ExtraInfoInlineKinds, llvm::PointerSumTypeMember<0ul, llvm::MachineMemOperand*, llvm::PointerLikeTypeTraits<llvm::MachineMemOperand*> >, llvm::PointerSumTypeMember<1ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<2ul, llvm::MCSymbol*, llvm::PointerLikeTypeTraits<llvm::MCSymbol*> >, llvm::PointerSumTypeMember<3ul, llvm::MachineInstr::ExtraInfo*, llvm::PointerLikeTypeTraits<llvm::MachineInstr::ExtraInfo*> > >::StorageT const&)
Line
Count
Source
50
1.11G
inline To bit_cast(const From &from) noexcept {
51
1.11G
  To to;
52
1.11G
  std::memcpy(&to, &from, sizeof(To));
53
1.11G
  return to;
54
1.11G
}
float llvm::bit_cast<float, unsigned int, void, std::__1::integral_constant<bool, true>, void, void>(unsigned int const&)
Line
Count
Source
50
2.32k
inline To bit_cast(const From &from) noexcept {
51
2.32k
  To to;
52
2.32k
  std::memcpy(&to, &from, sizeof(To));
53
2.32k
  return to;
54
2.32k
}
std::__1::array<int, 2ul> llvm::bit_cast<std::__1::array<int, 2ul>, long long, void, std::__1::integral_constant<bool, true>, void, void>(long long const&)
Line
Count
Source
50
216
inline To bit_cast(const From &from) noexcept {
51
216
  To to;
52
216
  std::memcpy(&to, &from, sizeof(To));
53
216
  return to;
54
216
}
std::__1::array<short, 4ul> llvm::bit_cast<std::__1::array<short, 4ul>, long long, void, std::__1::integral_constant<bool, true>, void, void>(long long const&)
Line
Count
Source
50
238
inline To bit_cast(const From &from) noexcept {
51
238
  To to;
52
238
  std::memcpy(&to, &from, sizeof(To));
53
238
  return to;
54
238
}
std::__1::array<signed char, 8ul> llvm::bit_cast<std::__1::array<signed char, 8ul>, long long, void, std::__1::integral_constant<bool, true>, void, void>(long long const&)
Line
Count
Source
50
222
inline To bit_cast(const From &from) noexcept {
51
222
  To to;
52
222
  std::memcpy(&to, &from, sizeof(To));
53
222
  return to;
54
222
}
std::__1::array<long long, 1ul> llvm::bit_cast<std::__1::array<long long, 1ul>, long long, void, std::__1::integral_constant<bool, true>, void, void>(long long const&)
Line
Count
Source
50
26
inline To bit_cast(const From &from) noexcept {
51
26
  To to;
52
26
  std::memcpy(&to, &from, sizeof(To));
53
26
  return to;
54
26
}
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::bit_cast<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, char*, void, std::__1::integral_constant<bool, true>, void, void>(char* const&)
Line
Count
Source
50
290M
inline To bit_cast(const From &from) noexcept {
51
290M
  To to;
52
290M
  std::memcpy(&to, &from, sizeof(To));
53
290M
  return to;
54
290M
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData* llvm::bit_cast<llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData*, char*, void, std::__1::integral_constant<bool, true>, void, void>(char* const&)
Line
Count
Source
50
72.8M
inline To bit_cast(const From &from) noexcept {
51
72.8M
  To to;
52
72.8M
  std::memcpy(&to, &from, sizeof(To));
53
72.8M
  return to;
54
72.8M
}
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::bit_cast<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, char*, void, std::__1::integral_constant<bool, true>, void, void>(char* const&)
Line
Count
Source
50
66.4k
inline To bit_cast(const From &from) noexcept {
51
66.4k
  To to;
52
66.4k
  std::memcpy(&to, &from, sizeof(To));
53
66.4k
  return to;
54
66.4k
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData* llvm::bit_cast<llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData*, char*, void, std::__1::integral_constant<bool, true>, void, void>(char* const&)
Line
Count
Source
50
200
inline To bit_cast(const From &from) noexcept {
51
200
  To to;
52
200
  std::memcpy(&to, &from, sizeof(To));
53
200
  return to;
54
200
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData* llvm::bit_cast<llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData*, char*, void, std::__1::integral_constant<bool, true>, void, void>(char* const&)
Line
Count
Source
50
2.39M
inline To bit_cast(const From &from) noexcept {
51
2.39M
  To to;
52
2.39M
  std::memcpy(&to, &from, sizeof(To));
53
2.39M
  return to;
54
2.39M
}
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::bit_cast<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, char*, void, std::__1::integral_constant<bool, true>, void, void>(char* const&)
Line
Count
Source
50
8.62M
inline To bit_cast(const From &from) noexcept {
51
8.62M
  To to;
52
8.62M
  std::memcpy(&to, &from, sizeof(To));
53
8.62M
  return to;
54
8.62M
}
unsigned long long llvm::bit_cast<unsigned long long, double, void, std::__1::integral_constant<bool, true>, void, void>(double const&)
Line
Count
Source
50
40
inline To bit_cast(const From &from) noexcept {
51
40
  To to;
52
40
  std::memcpy(&to, &from, sizeof(To));
53
40
  return to;
54
40
}
Unexecuted instantiation: double llvm::bit_cast<double, unsigned long long, void, std::__1::integral_constant<bool, true>, void, void>(unsigned long long const&)
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >* llvm::bit_cast<llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >*, char*, void, std::__1::integral_constant<bool, true>, void, void>(char* const&)
Line
Count
Source
50
14.0M
inline To bit_cast(const From &from) noexcept {
51
14.0M
  To to;
52
14.0M
  std::memcpy(&to, &from, sizeof(To));
53
14.0M
  return to;
54
14.0M
}
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::RootBranchData* llvm::bit_cast<llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::RootBranchData*, char*, void, std::__1::integral_constant<bool, true>, void, void>(char* const&)
Line
Count
Source
50
8.40k
inline To bit_cast(const From &from) noexcept {
51
8.40k
  To to;
52
8.40k
  std::memcpy(&to, &from, sizeof(To));
53
8.40k
  return to;
54
8.40k
}
55
56
} // namespace llvm
57
58
#endif