Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/MC/MCValue.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- lib/MC/MCValue.cpp - MCValue implementation ------------------------===//
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/MC/MCValue.h"
10
#include "llvm/Config/llvm-config.h"
11
#include "llvm/MC/MCExpr.h"
12
#include "llvm/Support/Debug.h"
13
#include "llvm/Support/ErrorHandling.h"
14
#include "llvm/Support/raw_ostream.h"
15
16
using namespace llvm;
17
18
1
void MCValue::print(raw_ostream &OS) const {
19
1
  if (isAbsolute()) {
20
0
    OS << getConstant();
21
0
    return;
22
0
  }
23
1
24
1
  // FIXME: prints as a number, which isn't ideal. But the meaning will be
25
1
  // target-specific anyway.
26
1
  if (getRefKind())
27
0
    OS << ':' << getRefKind() <<  ':';
28
1
29
1
  OS << *getSymA();
30
1
31
1
  if (getSymB()) {
32
1
    OS << " - ";
33
1
    OS << *getSymB();
34
1
  }
35
1
36
1
  if (getConstant())
37
0
    OS << " + " << getConstant();
38
1
}
39
40
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
41
LLVM_DUMP_METHOD void MCValue::dump() const {
42
  print(dbgs());
43
}
44
#endif
45
46
13.0k
MCSymbolRefExpr::VariantKind MCValue::getAccessVariant() const {
47
13.0k
  const MCSymbolRefExpr *B = getSymB();
48
13.0k
  if (B) {
49
1.19k
    if (B->getKind() != MCSymbolRefExpr::VK_None)
50
1.19k
      
llvm_unreachable0
("unsupported");
51
1.19k
  }
52
13.0k
53
13.0k
  const MCSymbolRefExpr *A = getSymA();
54
13.0k
  if (!A)
55
17
    return MCSymbolRefExpr::VK_None;
56
13.0k
57
13.0k
  MCSymbolRefExpr::VariantKind Kind = A->getKind();
58
13.0k
  if (Kind == MCSymbolRefExpr::VK_WEAKREF)
59
0
    return MCSymbolRefExpr::VK_None;
60
13.0k
  return Kind;
61
13.0k
}