LLVM: lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

17#include

18#include

19

20using namespace llvm;

22

30 "Not enough bytes for a Cross Module Import Header!");

31 if (auto EC = Reader.readObject(Item.Header))

32 return EC;

36 "Not enough to read specified number of Cross Module References!");

38 return EC;

40}

41

46

51

54 Strings.insert(Module);

56 auto Result = Mappings.insert(std::make_pair(Module, Targets));

57 if (!Result.second)

58 Result.first->getValue().push_back(Targets[0]);

59}

60

63 for (const auto &Item : Mappings) {

66 }

68}

69

72 using T = decltype(&*Mappings.begin());

73 std::vector Ids;

74 Ids.reserve(Mappings.size());

75

76 for (const auto &M : Mappings)

77 Ids.push_back(&M);

78

79 llvm::sort(Ids, [this](const T &L1, const T &L2) {

80 return Strings.getIdForString(L1->getKey()) <

81 Strings.getIdForString(L2->getKey());

82 });

83

84 for (const auto &Item : Ids) {

86 Imp.ModuleNameOffset = Strings.getIdForString(Item->getKey());

87 Imp.Count = Item->getValue().size();

89 return EC;

91 return EC;

92 }

94}

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

Provides read only access to a subclass of BinaryStream.

uint64_t bytesRemaining() const

Error readArray(ArrayRef< T > &Array, uint32_t NumElements)

Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...

BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.

Provides write only access to a subclass of WritableBinaryStream.

Error writeArray(ArrayRef< T > Array)

Writes an array of objects of type T to the underlying stream, as if by using memcpy.

Error writeObject(const T &Obj)

Writes the object Obj to the underlying stream, as if by using memcpy.

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

A Module instance is used to store all the information related to an LLVM module.

StringRef - Represent a constant reference to a string, i.e.

LLVM_ABI Error initialize(BinaryStreamReader Reader)

Definition DebugCrossImpSubsection.cpp:42

void addImport(StringRef Module, uint32_t ImportId)

Definition DebugCrossImpSubsection.cpp:52

uint32_t calculateSerializedSize() const override

Definition DebugCrossImpSubsection.cpp:61

Error commit(BinaryStreamWriter &Writer) const override

Definition DebugCrossImpSubsection.cpp:70

detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned > ulittle32_t

This is an optimization pass for GlobalISel generic memory operations.

void sort(IteratorTy Start, IteratorTy End)

Error make_error(ArgTs &&... Args)

Make a Error instance representing failure using the given error info type.

FixedStreamArray< support::ulittle32_t > Imports

const CrossModuleImport * Header

support::ulittle32_t Count

support::ulittle32_t ModuleNameOffset