LLVM: lib/DebugInfo/LogicalView/Core/LVType.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

17

18using namespace llvm;

20

21#define DEBUG_TYPE "Type"

22

23namespace {

24const char *const KindBaseType = "BaseType";

25const char *const KindConst = "Const";

26const char *const KindEnumerator = "Enumerator";

27const char *const KindImport = "Import";

28const char *const KindPointer = "Pointer";

29const char *const KindPointerMember = "PointerMember";

30const char *const KindReference = "Reference";

31const char *const KindRestrict = "Restrict";

32const char *const KindRvalueReference = "RvalueReference";

33const char *const KindSubrange = "Subrange";

34const char *const KindTemplateTemplate = "TemplateTemplate";

35const char *const KindTemplateType = "TemplateType";

36const char *const KindTemplateValue = "TemplateValue";

37const char *const KindTypeAlias = "TypeAlias";

38const char *const KindUndefined = "Undefined";

39const char *const KindUnaligned = "Unaligned";

40const char *const KindUnspecified = "Unspecified";

41const char *const KindVolatile = "Volatile";

42}

43

44

45

46

47

49 const char *Kind = KindUndefined;

50 if (getIsBase())

51 Kind = KindBaseType;

52 else if (getIsConst())

53 Kind = KindConst;

54 else if (getIsEnumerator())

55 Kind = KindEnumerator;

56 else if (getIsImport())

57 Kind = KindImport;

58 else if (getIsPointerMember())

59 Kind = KindPointerMember;

60 else if (getIsPointer())

61 Kind = KindPointer;

62 else if (getIsReference())

63 Kind = KindReference;

64 else if (getIsRestrict())

65 Kind = KindRestrict;

66 else if (getIsRvalueReference())

67 Kind = KindRvalueReference;

68 else if (getIsSubrange())

69 Kind = KindSubrange;

70 else if (getIsTemplateTypeParam())

71 Kind = KindTemplateType;

72 else if (getIsTemplateValueParam())

73 Kind = KindTemplateValue;

74 else if (getIsTemplateTemplateParam())

75 Kind = KindTemplateTemplate;

76 else if (getIsTypedef())

77 Kind = KindTypeAlias;

78 else if (getIsUnaligned())

79 Kind = KindUnaligned;

80 else if (getIsUnspecified())

81 Kind = KindUnspecified;

82 else if (getIsVolatile())

83 Kind = KindVolatile;

85}

86

108

110

111

112

113

114

115

116 setFile(nullptr);

117

120}

121

123 if (getIsResolvedName())

124 return;

125 setIsResolvedName();

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

149 if (BaseType->isTemplateParam())

151

155

156

157

158 if (isNamed() && !getIsTemplateParam())

160

162

163

165}

166

168

169

171}

172

174 const LVTypes *Targets) {

175 if (!(References && Targets))

176 return;

177

179 dbgs() << "\n[LVType::markMissingParents]\n";

181 dbgs() << "References: "

185 dbgs() << "Targets : "

188 });

189

192 dbgs() << "Search Reference: Name = "

194 });

196 Reference->markBranchAsMissing();

197 }

198}

199

200LVType *LVType::findIn(const LVTypes *Targets) const {

201 if (!Targets)

202 return nullptr;

203

205 dbgs() << "\n[LVType::findIn]\n"

206 << "Reference: "

207 << "Level = " << getLevel() << ", "

211 dbgs() << "Target : "

212 << "Level = " << Target->getLevel() << ", "

215 });

216

220

221 return nullptr;

222}

223

224

226 const LVTypes *Targets) {

227 if (!References && !Targets)

228 return true;

229 if (References && Targets) {

232 getParameters(References, &ReferenceTypes, &ReferenceScopes);

235 getParameters(Targets, &TargetTypes, &TargetScopes);

236 if (LVType::equals(&ReferenceTypes, &TargetTypes) ||

238 return false;

239 return true;

240 }

241 return false;

242}

243

244

248 return;

249

250

251

253 if (Type->getIsTemplateParam())

254 continue;

255 if (options().getAttributeArgument()) {

256 if (Type->getIsKindType())

258 else if (Type->getIsKindScope())

260 } else

262 }

263}

264

267}

268

270 if (!References && !Targets)

271 return true;

272 if (References && Targets && References->size() == Targets->size()) {

275 return false;

276 return true;

277 }

278 return false;

279}

280

283}

284

286 if (getIncludeInPrint() &&

287 (getIsReference() || getReader().doPrintType(this))) {

291 }

292}

293

296}

297

298

299

300

301

305

307

309 assert(Type && "Type definition does not have a type.");

310

312 while (Type->getIsTypedef()) {

315

317

318 Type = Type->getTypeAsType();

321 }

322

324}

325

327

328

329

330

331 if (getIsSystem())

332 return;

333

334

335 if (options().getAttributeUnderlying()) {

337 setIsTypedefReduced();

339 Type->resolveName();

341 }

342 }

343

344

345

346

348 if (Aggregate && Aggregate->getIsAnonymous())

350}

351

354}

355

360}

361

362

363

364

367}

368

372}

373

374

375

376

379}

380

384

387}

388

389

390

391

393 options().getAttributeTypename() ? setIncludeInPrint()

394 : resetIncludeInPrint();

395}

396

397

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415 if (getIsTemplateTypeParam()) {

416

417

418

420

422

424

425

426 if (ArgType->getIsTypedef()) {

428 Name.append(std::string(BaseType->getName()));

429 } else {

430 Name.append(std::string(ArgType->getName()));

431 }

432 } else {

435

436

437 if (ArgScope->getIsTemplate())

439 else {

440

442 Name.append(std::string(ArgScope->getName()));

443 }

444 }

445 }

446 } else

447

449}

450

453 return false;

454

455

456 if (getIsTemplateTypeParam() && Type->getIsTemplateTypeParam())

458

459 if ((getIsTemplateValueParam() && Type->getIsTemplateValueParam()) ||

460 (getIsTemplateTemplateParam() && Type->getIsTemplateTemplateParam()))

462

463 return false;

464}

465

469

470

471

472 if (getIsTemplateTypeParam()) {

474 return;

475 }

476 if (getIsTemplateValueParam()) {

478 return;

479 }

480 if (getIsTemplateTemplateParam())

482}

483

484

485

486

488

489

490

491

492

493

494

495

496

497

498

499

500

501

503

504

505 if (getIsSubrangeCount())

506

508 else

511

513}

514

517 return false;

518

520}

521

525}

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

Pass interface - Implemented by all 'passes'.

void push_back(const T &Elt)

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

Target - Wrapper for Target specific information.

const char * getName() const

getName - Get the target name.

The instances of the Type class are immutable: once they are created, they are never changed.

void printItem(LVElement *Element, LVComparePass Pass)

void resolveFullname(LVElement *BaseType, StringRef Name=emptyString())

virtual void resolveName()

StringRef virtualityString(uint32_t Virtuality=dwarf::DW_VIRTUALITY_none) const

bool getIsKindScope() const

void setName(StringRef ElementName) override

StringRef getName() const override

LVType * getTypeAsType() const

LVElement * getType() const

void setFile(LVElement *Reference=nullptr)

StringRef getTypeName() const

StringRef getTypeQualifiedName() const

bool getIsKindType() const

StringRef accessibilityString(uint32_t Access=dwarf::DW_ACCESS_private) const

bool equals(const LVElement *Element) const

std::string typeOffsetAsString() const

bool isNamed() const override

LVScope * getTypeAsScope() const

virtual void print(raw_ostream &OS, bool Full=true) const

void resolvePatternMatch(LVLine *Line)

void incrementPrintedTypes()

void encodeTemplateArguments(std::string &Name) const

virtual bool equals(const LVScope *Scope) const

void setUnderlyingType(LVElement *Element) override

bool equals(const LVType *Type) const override

void resolveExtra() override

void printExtra(raw_ostream &OS, bool Full=true) const override

LVElement * getUnderlyingType() override

void printExtra(raw_ostream &OS, bool Full=true) const override

StringRef getValue() const override

bool equals(const LVType *Type) const override

void printExtra(raw_ostream &OS, bool Full=true) const override

bool equals(const LVType *Type) const override

size_t getValueIndex() const override

void printExtra(raw_ostream &OS, bool Full=true) const override

void encodeTemplateArgument(std::string &Name) const override

bool equals(const LVType *Type) const override

StringRef getValue() const override

void resolveExtra() override

int64_t getUpperBound() const override

void printExtra(raw_ostream &OS, bool Full=true) const override

int64_t getCount() const override

bool equals(const LVType *Type) const override

int64_t getLowerBound() const override

void resolveReferences() override

virtual bool equals(const LVType *Type) const

void report(LVComparePass Pass) override

void printExtra(raw_ostream &OS, bool Full=true) const override

static bool parametersMatch(const LVTypes *References, const LVTypes *Targets)

StringRef resolveReferencesChain()

void resolveName() override

const char * kind() const override

static void getParameters(const LVTypes *Types, LVTypes *TypesParam, LVScopes *ScopesParam)

virtual LVElement * getUnderlyingType()

void print(raw_ostream &OS, bool Full=true) const override

static void markMissingParents(const LVTypes *References, const LVTypes *Targets)

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

A raw_ostream that writes to an std::string.

std::string formattedNames(StringRef Name1, StringRef Name2)

@ IsTemplateTemplateParam

std::string formattedKind(StringRef Kind)

LVScopeCompileUnit * getReaderCompileUnit()

std::string formattedName(StringRef Name)

std::string formatAttributes(const StringRef First, Args... Others)

LVCompare & getComparator()

std::map< LVTypeKind, LVTypeGetFunction > LVTypeDispatch

This is an optimization pass for GlobalISel generic memory operations.

raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.