LLVM: include/llvm/ObjCopy/CommonConfig.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_OBJCOPY_COMMONCONFIG_H

10#define LLVM_OBJCOPY_COMMONCONFIG_H

11

24#include

25

26namespace llvm {

28

30

31

32

33

47

48

49

50

69

75

80

86

92

93class NameOrPattern {

95

96 std::shared_ptr R;

97 std::shared_ptr G;

98 bool IsPositiveMatch = true;

99

101 NameOrPattern(std::shared_ptr R) : R(R) {}

102 NameOrPattern(std::shared_ptr G, bool IsPositiveMatch)

103 : G(G), IsPositiveMatch(IsPositiveMatch) {}

104

105public:

106

107

111

113 std::optional getName() const {

114 if (!R && !G)

115 return Name;

116 return std::nullopt;

117 }

119 return R ? R->match(S) : G ? G->match(S) : Name == S;

120 }

122};

123

124

125

130

131public:

133 if (!Matcher)

134 return Matcher.takeError();

135 if (Matcher->isPositiveMatch()) {

136 if (std::optional MaybeName = Matcher->getName())

138 else

139 PosPatterns.push_back(std::move(*Matcher));

140 } else {

141 NegMatchers.push_back(std::move(*Matcher));

142 }

144 }

151 return PosNames.empty() && PosPatterns.empty() && NegMatchers.empty();

152 }

153};

154

156

161

166

186

187

188

196

197

206

207

209

214

215

217

218

220

230

231

237

238

242

243

252

253

259

260

262

263

265

266

281

283

286

287

288

289

291};

292

293}

294}

295

296#endif

This file defines the StringMap class.

This file defines CachedHashString and CachedHashStringRef.

This file defines the DenseSet and SmallDenseSet classes.

This file defines the SmallVector class.

A container which contains a StringRef plus a precomputed hash.

Implements a dense probed hash-table based set.

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

Tagged union holding either a T or a Error.

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...

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

An efficient, type-erasing, non-owning reference to a callable.

Definition CommonConfig.h:126

bool matches(StringRef S) const

Definition CommonConfig.h:145

bool empty() const

Definition CommonConfig.h:150

Error addMatcher(Expected< NameOrPattern > Matcher)

Definition CommonConfig.h:132

std::optional< StringRef > getName() const

Definition CommonConfig.h:113

bool isPositiveMatch() const

Definition CommonConfig.h:112

bool operator!=(StringRef S) const

Definition CommonConfig.h:121

static LLVM_ABI Expected< NameOrPattern > create(StringRef Pattern, MatchStyle MS, llvm::function_ref< Error(Error)> ErrorCallback)

bool operator==(StringRef S) const

Definition CommonConfig.h:118

SectionFlag

Definition CommonConfig.h:51

@ SecAlloc

Definition CommonConfig.h:53

@ SecCode

Definition CommonConfig.h:58

@ SecLoad

Definition CommonConfig.h:54

@ SecDebug

Definition CommonConfig.h:57

@ SecNoload

Definition CommonConfig.h:55

@ SecReadonly

Definition CommonConfig.h:56

@ SecLarge

Definition CommonConfig.h:66

@ SecData

Definition CommonConfig.h:59

@ SecExclude

Definition CommonConfig.h:65

@ SecShare

Definition CommonConfig.h:64

@ SecStrings

Definition CommonConfig.h:62

@ SecMerge

Definition CommonConfig.h:61

@ SecNone

Definition CommonConfig.h:52

@ SecRom

Definition CommonConfig.h:60

@ SecContents

Definition CommonConfig.h:63

SymbolFlag

Definition CommonConfig.h:167

@ File

Definition CommonConfig.h:174

@ Indirect

Definition CommonConfig.h:182

@ Warning

Definition CommonConfig.h:181

@ IndirectFunction

Definition CommonConfig.h:178

@ Object

Definition CommonConfig.h:176

@ Global

Definition CommonConfig.h:168

@ Local

Definition CommonConfig.h:169

@ Protected

Definition CommonConfig.h:173

@ Constructor

Definition CommonConfig.h:180

@ Weak

Definition CommonConfig.h:170

@ Default

Definition CommonConfig.h:171

@ Hidden

Definition CommonConfig.h:172

@ Function

Definition CommonConfig.h:177

@ Debug

Definition CommonConfig.h:179

@ Section

Definition CommonConfig.h:175

@ UniqueObject

Definition CommonConfig.h:184

@ Synthetic

Definition CommonConfig.h:183

MatchStyle

Definition CommonConfig.h:87

@ Regex

Definition CommonConfig.h:90

@ Wildcard

Definition CommonConfig.h:89

@ Literal

Definition CommonConfig.h:88

AdjustKind

Definition CommonConfig.h:155

@ Subtract

Definition CommonConfig.h:155

@ Set

Definition CommonConfig.h:155

@ Add

Definition CommonConfig.h:155

FileFormat

Definition CommonConfig.h:29

@ IHex

Definition CommonConfig.h:29

@ Binary

Definition CommonConfig.h:29

@ Unspecified

Definition CommonConfig.h:29

@ SREC

Definition CommonConfig.h:29

@ ELF

Definition CommonConfig.h:29

DiscardType

Definition CommonConfig.h:81

@ Locals

Definition CommonConfig.h:84

@ None

Definition CommonConfig.h:82

@ All

Definition CommonConfig.h:83

This is an optimization pass for GlobalISel generic memory operations.

@ LLVM_MARK_AS_BITMASK_ENUM

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

bool is_contained(R &&Range, const E &Element)

Returns true if Element is found in Range.

Implement std::hash so that hash_code can be used in STL containers.

Definition CommonConfig.h:157

uint64_t Value

Definition CommonConfig.h:158

AdjustKind Kind

Definition CommonConfig.h:159

Definition CommonConfig.h:208

SmallVector< SectionPatternAddressUpdate, 0 > ChangeSectionAddress

Definition CommonConfig.h:235

bool StripDWO

Definition CommonConfig.h:274

SmallVector< NewSectionInfo, 0 > UpdateSection

Definition CommonConfig.h:234

NameMatcher SymbolsToGlobalize

Definition CommonConfig.h:244

int64_t ChangeSectionLMAValAll

Definition CommonConfig.h:264

StringMap< SectionRename > SectionsToRename

Definition CommonConfig.h:254

bool PreserveDates

Definition CommonConfig.h:271

NameMatcher SymbolsToRemove

Definition CommonConfig.h:247

std::optional< MachineInfo > OutputArch

Definition CommonConfig.h:216

StringRef InputFilename

Definition CommonConfig.h:210

SmallVector< StringRef, 0 > ExtractSection

Definition CommonConfig.h:236

SmallVector< std::pair< NameMatcher, llvm::DebugCompressionType >, 0 > compressSections

Definition CommonConfig.h:285

bool ExtractMainPartition

Definition CommonConfig.h:269

bool DecompressDebugSections

Definition CommonConfig.h:280

SmallVector< StringRef, 0 > DumpSection

Definition CommonConfig.h:233

bool OnlyKeepDebug

Definition CommonConfig.h:270

SmallVector< NewSymbolInfo, 0 > SymbolsToAdd

Definition CommonConfig.h:261

NameMatcher SymbolsToKeep

Definition CommonConfig.h:245

StringRef AddGnuDebugLink

Definition CommonConfig.h:219

StringRef SymbolsPrefix

Definition CommonConfig.h:226

StringMap< uint64_t > SetSectionAlignment

Definition CommonConfig.h:255

NameMatcher SymbolsToWeaken

Definition CommonConfig.h:249

uint32_t GnuDebugLinkCRC32

Definition CommonConfig.h:221

FileFormat OutputFormat

Definition CommonConfig.h:213

NameMatcher SymbolsToKeepGlobal

Definition CommonConfig.h:250

DebugCompressionType CompressionType

Definition CommonConfig.h:282

bool Weaken

Definition CommonConfig.h:279

std::function< Error(Error)> ErrorCallback

Definition CommonConfig.h:290

StringMap< SectionFlagsUpdate > SetSectionFlags

Definition CommonConfig.h:256

StringRef OutputFilename

Definition CommonConfig.h:212

bool DeterministicArchives

Definition CommonConfig.h:267

NameMatcher SymbolsToSkip

Definition CommonConfig.h:251

SmallVector< NewSectionInfo, 0 > AddSection

Definition CommonConfig.h:232

bool StripNonAlloc

Definition CommonConfig.h:276

bool StripUnneeded

Definition CommonConfig.h:278

NameMatcher UnneededSymbolsToRemove

Definition CommonConfig.h:248

bool StripSections

Definition CommonConfig.h:277

uint8_t GapFill

Definition CommonConfig.h:223

bool StripAll

Definition CommonConfig.h:272

StringRef SymbolsPrefixRemove

Definition CommonConfig.h:227

NameMatcher OnlySection

Definition CommonConfig.h:240

bool StripDebug

Definition CommonConfig.h:275

NameMatcher KeepSection

Definition CommonConfig.h:239

FileFormat InputFormat

Definition CommonConfig.h:211

std::optional< StringRef > ExtractPartition

Definition CommonConfig.h:222

DiscardType DiscardMode

Definition CommonConfig.h:229

StringRef SplitDWO

Definition CommonConfig.h:225

uint64_t PadTo

Definition CommonConfig.h:224

StringRef AllocSectionsPrefix

Definition CommonConfig.h:228

NameMatcher ToRemove

Definition CommonConfig.h:241

bool ExtractDWO

Definition CommonConfig.h:268

StringMap< StringRef > SymbolsToRename

Definition CommonConfig.h:258

NameMatcher SymbolsToLocalize

Definition CommonConfig.h:246

bool StripAllGNU

Definition CommonConfig.h:273

StringMap< uint64_t > SetSectionType

Definition CommonConfig.h:257

bool Is64Bit

Definition CommonConfig.h:44

MachineInfo(uint16_t EM, bool Is64, bool IsLittle)

Definition CommonConfig.h:38

MachineInfo()

Definition CommonConfig.h:41

bool IsLittleEndian

Definition CommonConfig.h:45

uint16_t EMachine

Definition CommonConfig.h:42

MachineInfo(uint16_t EM, uint8_t ABI, bool Is64, bool IsLittle)

Definition CommonConfig.h:35

uint8_t OSABI

Definition CommonConfig.h:43

StringRef SectionName

Definition CommonConfig.h:203

std::shared_ptr< MemoryBuffer > SectionData

Definition CommonConfig.h:204

NewSectionInfo(StringRef Name, std::unique_ptr< MemoryBuffer > &&Buffer)

Definition CommonConfig.h:200

Definition CommonConfig.h:189

StringRef SymbolName

Definition CommonConfig.h:190

uint64_t Value

Definition CommonConfig.h:192

StringRef SectionName

Definition CommonConfig.h:191

SmallVector< StringRef, 0 > BeforeSyms

Definition CommonConfig.h:194

SmallVector< SymbolFlag, 0 > Flags

Definition CommonConfig.h:193

Definition CommonConfig.h:76

SectionFlag NewFlags

Definition CommonConfig.h:78

StringRef Name

Definition CommonConfig.h:77

Definition CommonConfig.h:162

AddressUpdate Update

Definition CommonConfig.h:164

NameMatcher SectionPattern

Definition CommonConfig.h:163

Definition CommonConfig.h:70

StringRef NewName

Definition CommonConfig.h:72

std::optional< SectionFlag > NewFlags

Definition CommonConfig.h:73

StringRef OriginalName

Definition CommonConfig.h:71