LLVM: include/llvm/Object/WindowsResource.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28#ifndef LLVM_OBJECT_WINDOWSRESOURCE_H

29#define LLVM_OBJECT_WINDOWSRESOURCE_H

30

41

42#include

43

44namespace llvm {

45

48

50

54

60

65

66

67

84

92

98

99class ResourceEntryRef {

100public:

115

116private:

118

120 Error loadNext();

121

124

127 bool IsStringType;

130 bool IsStringName;

135};

136

137class WindowsResource : public Binary {

138public:

140

141 static bool classof(const Binary *V) { return V->isWinRes(); }

142

145

146private:

148

150

152};

153

155public:

159 std::vectorstd::string &Duplicates);

161 std::vectorstd::string &Duplicates);

167

168 class TreeNode {

169 public:

170 template

171 using Children = std::map<T, std::unique_ptr>;

172

183 return StringChildren;

184 }

185

186 private:

188

189

190 static std::unique_ptr createStringNode(uint32_t Index);

191 static std::unique_ptr createIDNode();

192

193 static std::unique_ptr createDataNode(uint16_t MajorVersion,

198

199 explicit TreeNode(uint32_t StringIndex);

202

204 std::vector<std::vector<uint8_t>> &Data,

205 std::vector<std::vector> &StringTable,

206 TreeNode *&Result);

208 std::vector<std::vector> &StringTable);

210 std::vector<std::vector> &StringTable);

212 std::vector<std::vector<uint8_t>> &Data,

213 TreeNode *&Result);

216 uint32_t DataIndex, TreeNode *&Result);

219 std::vector<std::vector> &StringTable);

220 void shiftDataIndexDown(uint32_t Index);

221

222 bool IsDataNode = false;

229 uint32_t Characteristics = 0;

230

231

232

234 };

235

244

245private:

248 std::vector &Context,

249 std::vectorstd::string &Duplicates);

250 bool shouldIgnoreDuplicate(const ResourceEntryRef &Entry) const;

251 bool shouldIgnoreDuplicate(const std::vector &Context) const;

252

253 TreeNode Root;

254 std::vector<std::vector<uint8_t>> Data;

255 std::vector<std::vector> StringTable;

256

257 std::vectorstd::string InputFilenames;

258

259 bool MinGW;

260};

261

264 const WindowsResourceParser &Parser,

266

268}

269}

270

271#endif

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

An implementation of BinaryStream which holds its entire data set in a single contiguous buffer.

Provides read only access to a subclass of BinaryStream.

BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.

Lightweight error class with error context and mandatory checking.

Tagged union holding either a T or a Error.

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

A table of densely packed, null-terminated strings indexed by offset.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

Binary(unsigned int Type, MemoryBufferRef Source)

EmptyResError(Twine Msg, object_error ECOverride)

Definition WindowsResource.h:95

GenericBinaryError(const Twine &Msg)

Definition WindowsResource.h:99

uint16_t getDataVersion() const

Definition WindowsResource.h:108

friend class WindowsResource

Definition WindowsResource.h:117

uint16_t getMajorVersion() const

Definition WindowsResource.h:111

uint16_t getLanguage() const

Definition WindowsResource.h:109

LLVM_ABI Error moveNext(bool &End)

ArrayRef< UTF16 > getTypeString() const

Definition WindowsResource.h:103

uint16_t getNameID() const

Definition WindowsResource.h:107

uint16_t getTypeID() const

Definition WindowsResource.h:104

uint16_t getMemoryFlags() const

Definition WindowsResource.h:110

bool checkNameString() const

Definition WindowsResource.h:105

uint16_t getMinorVersion() const

Definition WindowsResource.h:112

uint32_t getCharacteristics() const

Definition WindowsResource.h:113

bool checkTypeString() const

Definition WindowsResource.h:102

ArrayRef< UTF16 > getNameString() const

Definition WindowsResource.h:106

ArrayRef< uint8_t > getData() const

Definition WindowsResource.h:114

Definition WindowsResource.h:168

const Children< std::string > & getStringChildren() const

Definition WindowsResource.h:182

uint16_t getMinorVersion() const

Definition WindowsResource.h:178

LLVM_ABI uint32_t getTreeSize() const

const Children< uint32_t > & getIDChildren() const

Definition WindowsResource.h:181

LLVM_ABI void print(ScopedPrinter &Writer, StringRef Name) const

std::map< T, std::unique_ptr< TreeNode > > Children

Definition WindowsResource.h:171

uint32_t getCharacteristics() const

Definition WindowsResource.h:179

uint32_t getDataIndex() const

Definition WindowsResource.h:176

uint32_t getStringIndex() const

Definition WindowsResource.h:175

friend class WindowsResourceParser

Definition WindowsResource.h:187

uint16_t getMajorVersion() const

Definition WindowsResource.h:177

bool checkIsDataNode() const

Definition WindowsResource.h:180

LLVM_ABI void cleanUpManifests(std::vector< std::string > &Duplicates)

const TreeNode & getTree() const

Definition WindowsResource.h:164

LLVM_ABI void printTree(raw_ostream &OS) const

ArrayRef< std::vector< uint8_t > > getData() const

Definition WindowsResource.h:165

LLVM_ABI WindowsResourceParser(bool MinGW=false)

ArrayRef< std::vector< UTF16 > > getStringTable() const

Definition WindowsResource.h:166

LLVM_ABI Error parse(WindowsResource *WR, std::vector< std::string > &Duplicates)

Definition WindowsResource.h:137

LLVM_ABI Expected< ResourceEntryRef > getHeadEntry()

static bool classof(const Binary *V)

Definition WindowsResource.h:141

friend class ResourceEntryRef

Definition WindowsResource.h:147

static LLVM_ABI Expected< std::unique_ptr< WindowsResource > > createWindowsResource(MemoryBufferRef Source)

This class implements an extremely fast bulk output stream that can only output to a stream.

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

LLVM_ABI Expected< std::unique_ptr< MemoryBuffer > > writeWindowsResourceCOFF(llvm::COFF::MachineTypes MachineType, const WindowsResourceParser &Parser, uint32_t TimeDateStamp)

const size_t WIN_RES_NULL_ENTRY_SIZE

Definition WindowsResource.h:56

const uint32_t WIN_RES_DATA_ALIGNMENT

Definition WindowsResource.h:58

LLVM_ABI void printResourceTypeName(uint16_t TypeID, raw_ostream &OS)

const uint32_t WIN_RES_HEADER_ALIGNMENT

Definition WindowsResource.h:57

const size_t WIN_RES_MAGIC_SIZE

Definition WindowsResource.h:55

const uint16_t WIN_RES_PURE_MOVEABLE

Definition WindowsResource.h:59

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

detail::packed_endian_specific_integral< uint16_t, llvm::endianness::little, unaligned > ulittle16_t

This is an optimization pass for GlobalISel generic memory operations.

@ Ref

The access may reference the value stored in memory.

FunctionAddr VTableAddr uintptr_t uintptr_t Data

Definition WindowsResource.h:68

support::ulittle16_t TypeID

Definition WindowsResource.h:70

uint16_t TypeFlag

Definition WindowsResource.h:69

support::ulittle16_t NameID

Definition WindowsResource.h:72

void setType(uint16_t ID)

Definition WindowsResource.h:74

void setName(uint16_t ID)

Definition WindowsResource.h:79

uint16_t NameFlag

Definition WindowsResource.h:71

StringOrID(uint32_t ID)

Definition WindowsResource.h:241

uint32_t ID

Definition WindowsResource.h:239

StringOrID(ArrayRef< UTF16 > String)

Definition WindowsResource.h:242

ArrayRef< UTF16 > String

Definition WindowsResource.h:238

bool IsString

Definition WindowsResource.h:237