Coverage Report

Created: 2017-10-03 07:32

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