Coverage Report

Created: 2019-05-19 14:56

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/lib/Core/DefinedAtom.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- DefinedAtom.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/Support/ErrorHandling.h"
10
#include "lld/Core/DefinedAtom.h"
11
#include "lld/Core/File.h"
12
13
namespace lld {
14
15
2.53k
DefinedAtom::ContentPermissions DefinedAtom::permissions() const {
16
2.53k
  // By default base permissions on content type.
17
2.53k
  return permissions(this->contentType());
18
2.53k
}
19
20
// Utility function for deriving permissions from content type
21
2.87k
DefinedAtom::ContentPermissions DefinedAtom::permissions(ContentType type) {
22
2.87k
  switch (type) {
23
2.87k
  case typeCode:
24
1.37k
  case typeResolver:
25
1.37k
  case typeBranchIsland:
26
1.37k
  case typeBranchShim:
27
1.37k
  case typeStub:
28
1.37k
  case typeStubHelper:
29
1.37k
  case typeMachHeader:
30
1.37k
    return permR_X;
31
1.37k
32
1.37k
  case typeConstant:
33
701
  case typeCString:
34
701
  case typeUTF16String:
35
701
  case typeCFI:
36
701
  case typeLSDA:
37
701
  case typeLiteral4:
38
701
  case typeLiteral8:
39
701
  case typeLiteral16:
40
701
  case typeDTraceDOF:
41
701
  case typeCompactUnwindInfo:
42
701
  case typeProcessedUnwindInfo:
43
701
  case typeObjCImageInfo:
44
701
  case typeObjCMethodList:
45
701
    return permR__;
46
701
47
701
  case typeData:
48
312
  case typeDataFast:
49
312
  case typeZeroFill:
50
312
  case typeZeroFillFast:
51
312
  case typeObjC1Class:
52
312
  case typeLazyPointer:
53
312
  case typeLazyDylibPointer:
54
312
  case typeNonLazyPointer:
55
312
  case typeThunkTLV:
56
312
    return permRW_;
57
312
58
312
  case typeGOT:
59
132
  case typeConstData:
60
132
  case typeCFString:
61
132
  case typeInitializerPtr:
62
132
  case typeTerminatorPtr:
63
132
  case typeCStringPtr:
64
132
  case typeObjCClassPtr:
65
132
  case typeObjC2CategoryList:
66
132
  case typeInterposingTuples:
67
132
  case typeTLVInitialData:
68
132
  case typeTLVInitialZeroFill:
69
132
  case typeTLVInitializerPtr:
70
132
    return permRW_L;
71
132
72
351
  case typeUnknown:
73
351
  case typeTempLTO:
74
351
  case typeSectCreate:
75
351
  case typeDSOHandle:
76
351
    return permUnknown;
77
0
  }
78
0
  llvm_unreachable("unknown content type");
79
0
}
80
81
} // namespace