Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/DebugInfo/CodeView/TypeTableCollection.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- TypeTableCollection.cpp -------------------------------- *- 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
#include "llvm/DebugInfo/CodeView/TypeTableCollection.h"
10
11
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
12
#include "llvm/DebugInfo/CodeView/RecordName.h"
13
#include "llvm/Support/BinaryStreamReader.h"
14
15
using namespace llvm;
16
using namespace llvm::codeview;
17
18
TypeTableCollection::TypeTableCollection(ArrayRef<ArrayRef<uint8_t>> Records)
19
202
    : NameStorage(Allocator), Records(Records) {
20
202
  Names.resize(Records.size());
21
202
}
22
23
202
Optional<TypeIndex> TypeTableCollection::getFirst() {
24
202
  if (empty())
25
3
    return None;
26
199
  return TypeIndex::fromArrayIndex(0);
27
199
}
28
29
3.39k
Optional<TypeIndex> TypeTableCollection::getNext(TypeIndex Prev) {
30
3.39k
  assert(contains(Prev));
31
3.39k
  ++Prev;
32
3.39k
  if (Prev.toArrayIndex() == size())
33
199
    return None;
34
3.19k
  return Prev;
35
3.19k
}
36
37
4.73k
CVType TypeTableCollection::getType(TypeIndex Index) {
38
4.73k
  assert(Index.toArrayIndex() < Records.size());
39
4.73k
  return CVType(Records[Index.toArrayIndex()]);
40
4.73k
}
41
42
2.96k
StringRef TypeTableCollection::getTypeName(TypeIndex Index) {
43
2.96k
  if (Index.isNoneType() || 
Index.isSimple()2.95k
)
44
319
    return TypeIndex::simpleTypeName(Index);
45
2.64k
46
2.64k
  uint32_t I = Index.toArrayIndex();
47
2.64k
  if (Names[I].data() == nullptr) {
48
1.33k
    StringRef Result = NameStorage.save(computeTypeName(*this, Index));
49
1.33k
    Names[I] = Result;
50
1.33k
  }
51
2.64k
  return Names[I];
52
2.64k
}
53
54
0
bool TypeTableCollection::contains(TypeIndex Index) {
55
0
  return Index.toArrayIndex() <= size();
56
0
}
57
58
3.59k
uint32_t TypeTableCollection::size() { return Records.size(); }
59
60
0
uint32_t TypeTableCollection::capacity() { return Records.size(); }