Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/DebugInfo/CodeView/TypeRecordHelpers.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- TypeRecordHelpers.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/TypeRecordHelpers.h"
10
11
#include "llvm/ADT/SmallVector.h"
12
#include "llvm/DebugInfo/CodeView/TypeIndexDiscovery.h"
13
#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
14
15
using namespace llvm;
16
using namespace llvm::codeview;
17
18
683
template <typename RecordT> static ClassOptions getUdtOptions(CVType CVT) {
19
683
  RecordT Record;
20
683
  if (auto EC = TypeDeserializer::deserializeAs<RecordT>(CVT, Record)) {
21
0
    consumeError(std::move(EC));
22
0
    return ClassOptions::None;
23
0
  }
24
683
  return Record.getOptions();
25
683
}
TypeRecordHelpers.cpp:llvm::codeview::ClassOptions getUdtOptions<llvm::codeview::ClassRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>)
Line
Count
Source
18
578
template <typename RecordT> static ClassOptions getUdtOptions(CVType CVT) {
19
578
  RecordT Record;
20
578
  if (auto EC = TypeDeserializer::deserializeAs<RecordT>(CVT, Record)) {
21
0
    consumeError(std::move(EC));
22
0
    return ClassOptions::None;
23
0
  }
24
578
  return Record.getOptions();
25
578
}
TypeRecordHelpers.cpp:llvm::codeview::ClassOptions getUdtOptions<llvm::codeview::EnumRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>)
Line
Count
Source
18
95
template <typename RecordT> static ClassOptions getUdtOptions(CVType CVT) {
19
95
  RecordT Record;
20
95
  if (auto EC = TypeDeserializer::deserializeAs<RecordT>(CVT, Record)) {
21
0
    consumeError(std::move(EC));
22
0
    return ClassOptions::None;
23
0
  }
24
95
  return Record.getOptions();
25
95
}
TypeRecordHelpers.cpp:llvm::codeview::ClassOptions getUdtOptions<llvm::codeview::UnionRecord>(llvm::codeview::CVRecord<llvm::codeview::TypeLeafKind>)
Line
Count
Source
18
10
template <typename RecordT> static ClassOptions getUdtOptions(CVType CVT) {
19
10
  RecordT Record;
20
10
  if (auto EC = TypeDeserializer::deserializeAs<RecordT>(CVT, Record)) {
21
0
    consumeError(std::move(EC));
22
0
    return ClassOptions::None;
23
0
  }
24
10
  return Record.getOptions();
25
10
}
26
27
1.08k
bool llvm::codeview::isUdtForwardRef(CVType CVT) {
28
1.08k
  ClassOptions UdtOptions = ClassOptions::None;
29
1.08k
  switch (CVT.kind()) {
30
1.08k
  case LF_STRUCTURE:
31
578
  case LF_CLASS:
32
578
  case LF_INTERFACE:
33
578
    UdtOptions = getUdtOptions<ClassRecord>(std::move(CVT));
34
578
    break;
35
578
  case LF_ENUM:
36
95
    UdtOptions = getUdtOptions<EnumRecord>(std::move(CVT));
37
95
    break;
38
578
  case LF_UNION:
39
10
    UdtOptions = getUdtOptions<UnionRecord>(std::move(CVT));
40
10
    break;
41
578
  default:
42
405
    return false;
43
683
  }
44
683
  return (UdtOptions & ClassOptions::ForwardReference) != ClassOptions::None;
45
683
}
46
47
48
TypeIndex llvm::codeview::getModifiedType(const CVType &CVT) {
48
48
  assert(CVT.kind() == LF_MODIFIER);
49
48
  SmallVector<TypeIndex, 1> Refs;
50
48
  discoverTypeIndices(CVT, Refs);
51
48
  return Refs.front();
52
48
}