Coverage Report

Created: 2018-01-17 21:32

/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
//                             The LLVM Linker
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
10
#include "llvm/Support/ErrorHandling.h"
11
#include "lld/Core/DefinedAtom.h"
12
#include "lld/Core/File.h"
13
14
namespace lld {
15
16
1.12k
DefinedAtom::ContentPermissions DefinedAtom::permissions() const {
17
1.12k
  // By default base permissions on content type.
18
1.12k
  return permissions(this->contentType());
19
1.12k
}
20
21
// Utility function for deriving permissions from content type
22
1.26k
DefinedAtom::ContentPermissions DefinedAtom::permissions(ContentType type) {
23
1.26k
  switch (type) {
24
1.26k
  case typeCode:
25
592
  case typeResolver:
26
592
  case typeBranchIsland:
27
592
  case typeBranchShim:
28
592
  case typeStub:
29
592
  case typeStubHelper:
30
592
  case typeMachHeader:
31
592
    return permR_X;
32
592
33
592
  case typeConstant:
34
339
  case typeCString:
35
339
  case typeUTF16String:
36
339
  case typeCFI:
37
339
  case typeLSDA:
38
339
  case typeLiteral4:
39
339
  case typeLiteral8:
40
339
  case typeLiteral16:
41
339
  case typeDTraceDOF:
42
339
  case typeCompactUnwindInfo:
43
339
  case typeProcessedUnwindInfo:
44
339
  case typeObjCImageInfo:
45
339
  case typeObjCMethodList:
46
339
    return permR__;
47
339
48
339
  case typeData:
49
112
  case typeDataFast:
50
112
  case typeZeroFill:
51
112
  case typeZeroFillFast:
52
112
  case typeObjC1Class:
53
112
  case typeLazyPointer:
54
112
  case typeLazyDylibPointer:
55
112
  case typeNonLazyPointer:
56
112
  case typeThunkTLV:
57
112
    return permRW_;
58
112
59
112
  case typeGOT:
60
60
  case typeConstData:
61
60
  case typeCFString:
62
60
  case typeInitializerPtr:
63
60
  case typeTerminatorPtr:
64
60
  case typeCStringPtr:
65
60
  case typeObjCClassPtr:
66
60
  case typeObjC2CategoryList:
67
60
  case typeInterposingTuples:
68
60
  case typeTLVInitialData:
69
60
  case typeTLVInitialZeroFill:
70
60
  case typeTLVInitializerPtr:
71
60
    return permRW_L;
72
60
73
166
  case typeUnknown:
74
166
  case typeTempLTO:
75
166
  case typeSectCreate:
76
166
  case typeDSOHandle:
77
166
    return permUnknown;
78
0
  }
79
0
  llvm_unreachable("unknown content type");
80
0
}
81
82
} // namespace