clang: lib/AST/ODRHash.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

16

20

21using namespace clang;

22

24 assert(S && "Expecting non-null pointer.");

25 S->ProcessODRHash(ID, *this);

26}

27

29 assert(II && "Expecting non-null pointer.");

30 ID.AddString(II->getName());

31}

32

34 if (TreatAsDecl)

35

37

38 AddDeclarationNameImpl(Name);

39

40 if (TreatAsDecl)

41

43}

44

45void ODRHash::AddDeclarationNameImpl(DeclarationName Name) {

46

47 auto Result = DeclNameMap.insert(std::make_pair(Name, DeclNameMap.size()));

48 ID.AddInteger(Result.first->second);

50

51 return;

52 }

53

54

56 if (Name.isEmpty())

57 return;

58

59 auto Kind = Name.getNameKind();

60 ID.AddInteger(Kind);

61 switch (Kind) {

64 break;

68 Selector S = Name.getObjCSelector();

72 unsigned NumArgs = S.getNumArgs();

73 ID.AddInteger(NumArgs);

74

75

76 unsigned SlotsToCheck = NumArgs > 0 ? NumArgs : 1;

77 for (unsigned i = 0; i < SlotsToCheck; ++i) {

78 const IdentifierInfo *II = S.getIdentifierInfoForSlot(i);

80 if (II) {

82 }

83 }

84 break;

85 }

89 break;

91 ID.AddInteger(Name.getCXXOverloadedOperator());

92 break;

95 break;

98 break;

100 break;

102 auto *Template = Name.getCXXDeductionGuideTemplate();

104 if (Template) {

106 }

107 }

108 }

109}

110

112 assert(NNS && "Expecting non-null pointer.");

113 const auto *Prefix = NNS->getPrefix();

115 if (Prefix) {

117 }

118 auto Kind = NNS->getKind();

119 ID.AddInteger(Kind);

120 switch (Kind) {

123 break;

126 break;

129 break;

133 break;

136 break;

137 }

138}

139

141 auto Kind = Name.getKind();

142 ID.AddInteger(Kind);

143

144 switch (Kind) {

146 AddDecl(Name.getAsTemplateDecl());

147 break;

154 break;

155 }

156

163 break;

165 llvm_unreachable("Unexpected DeducedTemplate");

166 }

167}

168

170 const auto Kind = TA.getKind();

171 ID.AddInteger(Kind);

172

173 switch (Kind) {

175 llvm_unreachable("Expected valid TemplateArgument");

178 break;

181 break;

183 ID.AddPointer(nullptr);

184 break;

186

187

189 break;

190 }

194 break;

198 break;

201 break;

206 }

207 break;

208 }

209}

210

212 assert(TPL && "Expecting non-null pointer.");

213

214 ID.AddInteger(TPL->size());

215 for (auto *ND : TPL->asArray()) {

217 }

218}

219

221 DeclNameMap.clear();

222 Bools.clear();

223 ID.clear();

224}

225

227

228

229

231 const unsigned size = Bools.size();

232 const unsigned remainder = size % unsigned_bits;

233 const unsigned loops = size / unsigned_bits;

234 auto I = Bools.rbegin();

235 unsigned value = 0;

236 for (unsigned i = 0; i < remainder; ++i) {

237 value <<= 1;

238 value |= *I;

239 ++I;

240 }

241 ID.AddInteger(value);

242

243 for (unsigned i = 0; i < loops; ++i) {

244 value = 0;

245 for (unsigned j = 0; j < unsigned_bits; ++j) {

246 value <<= 1;

247 value |= *I;

248 ++I;

249 }

250 ID.AddInteger(value);

251 }

252

253 assert(I == Bools.rend());

254 Bools.clear();

255 return ID.computeStableHash();

256}

257

258namespace {

259

260

261class ODRDeclVisitor : public ConstDeclVisitor {

263 llvm::FoldingSetNodeID &ID;

265

266public:

267 ODRDeclVisitor(llvm::FoldingSetNodeID &ID, ODRHash &Hash)

268 : ID(ID), Hash(Hash) {}

269

270 void AddStmt(const Stmt *S) {

272 if (S) {

274 }

275 }

276

279 if (II) {

281 }

282 }

283

286 }

287

288 void AddDecl(const Decl *D) {

290 if (D) {

292 }

293 }

294

297 }

298

299 void Visit(const Decl *D) {

301 Inherited::Visit(D);

302 }

303

304 void VisitNamedDecl(const NamedDecl *D) {

306 Inherited::VisitNamedDecl(D);

307 }

308

309 void VisitValueDecl(const ValueDecl *D) {

310 if (auto *DD = dyn_cast(D); DD && DD->getTypeSourceInfo())

311 AddQualType(DD->getTypeSourceInfo()->getType());

312

313 Inherited::VisitValueDecl(D);

314 }

315

316 void VisitVarDecl(const VarDecl *D) {

319 const bool HasInit = D->hasInit();

321 if (HasInit) {

322 AddStmt(D->getInit());

323 }

324 Inherited::VisitVarDecl(D);

325 }

326

327 void VisitParmVarDecl(const ParmVarDecl *D) {

328

329 Inherited::VisitParmVarDecl(D);

330 }

331

334 Inherited::VisitAccessSpecDecl(D);

335 }

336

338 AddStmt(D->getAssertExpr());

339 AddStmt(D->getMessage());

340

341 Inherited::VisitStaticAssertDecl(D);

342 }

343

344 void VisitFieldDecl(const FieldDecl *D) {

345 const bool IsBitfield = D->isBitField();

347

348 if (IsBitfield) {

349 AddStmt(D->getBitWidth());

350 }

351

353 AddStmt(D->getInClassInitializer());

354

355 Inherited::VisitFieldDecl(D);

356 }

357

359 ID.AddInteger(D->getCanonicalAccessControl());

360 Inherited::VisitObjCIvarDecl(D);

361 }

362

364 ID.AddInteger(D->getPropertyAttributes());

365 ID.AddInteger(D->getPropertyImplementation());

366 AddQualType(D->getTypeSourceInfo()->getType());

367 AddDecl(D);

368

369 Inherited::VisitObjCPropertyDecl(D);

370 }

371

373

374 ID.AddInteger(D->getODRHash());

375

376 Inherited::VisitFunctionDecl(D);

377 }

378

380

381

382 Inherited::VisitCXXMethodDecl(D);

383 }

384

385 void VisitObjCMethodDecl(const ObjCMethodDecl *Method) {

394

400 ID.AddInteger(llvm::to_underlying(Cmd->getParameterKind()));

401

404 if (Self)

405 ID.AddInteger(llvm::to_underlying(Self->getParameterKind()));

406

407 AddDecl(Method);

408

411

413 for (auto Param : Method->parameters())

415

419 if (IsDefinition) {

422 if (Body)

423 AddStmt(Body);

424

425

426

428 for (Decl *SubDecl : Method->decls())

430 Decls.push_back(SubDecl);

431

432 ID.AddInteger(Decls.size());

433 for (auto SubDecl : Decls)

435 }

436 } else {

438 }

439

440 Inherited::VisitObjCMethodDecl(Method);

441 }

442

444 AddQualType(D->getUnderlyingType());

445

446 Inherited::VisitTypedefNameDecl(D);

447 }

448

449 void VisitTypedefDecl(const TypedefDecl *D) {

450 Inherited::VisitTypedefDecl(D);

451 }

452

454 Inherited::VisitTypeAliasDecl(D);

455 }

456

457 void VisitFriendDecl(const FriendDecl *D) {

460 if (TSI) {

461 AddQualType(TSI->getType());

462 } else {

463 AddDecl(D->getFriendDecl());

464 }

466 }

467

469

470 const bool hasDefaultArgument =

471 D->hasDefaultArgument() && D->defaultArgumentWasInherited();

473 if (hasDefaultArgument) {

474 AddTemplateArgument(D->getDefaultArgument().getArgument());

475 }

477

480 if (TC)

482

483 Inherited::VisitTemplateTypeParmDecl(D);

484 }

485

487

488 const bool hasDefaultArgument =

489 D->hasDefaultArgument() && D->defaultArgumentWasInherited();

491 if (hasDefaultArgument) {

492 AddTemplateArgument(D->getDefaultArgument().getArgument());

493 }

495

496 Inherited::VisitNonTypeTemplateParmDecl(D);

497 }

498

500

501 const bool hasDefaultArgument =

502 D->hasDefaultArgument() && D->defaultArgumentWasInherited();

504 if (hasDefaultArgument) {

505 AddTemplateArgument(D->getDefaultArgument().getArgument());

506 }

508

509 Inherited::VisitTemplateTemplateParmDecl(D);

510 }

511

514

515 Inherited::VisitTemplateDecl(D);

516 }

517

519 Hash.AddBoolean(D->isMemberSpecialization());

520 Inherited::VisitRedeclarableTemplateDecl(D);

521 }

522

524 AddDecl(D->getTemplatedDecl());

525 ID.AddInteger(D->getTemplatedDecl()->getODRHash());

526 Inherited::VisitFunctionTemplateDecl(D);

527 }

528

530 AddStmt(D->getInitExpr());

531 Inherited::VisitEnumConstantDecl(D);

532 }

533};

534}

535

536

537

541

543 default:

544 return false;

545 case Decl::AccessSpec:

546 case Decl::CXXConstructor:

547 case Decl::CXXDestructor:

548 case Decl::CXXMethod:

549 case Decl::EnumConstant:

550 case Decl::Field:

551 case Decl::Friend:

552 case Decl::FunctionTemplate:

553 case Decl::StaticAssert:

554 case Decl::TypeAlias:

555 case Decl::Typedef:

556 case Decl::Var:

557 case Decl::ObjCMethod:

558 case Decl::ObjCIvar:

559 case Decl::ObjCProperty:

560 return true;

561 }

562}

563

565 assert(D && "Expecting non-null pointer.");

566

567 ODRDeclVisitor(ID, *this).Visit(D);

568}

569

572 "Expected non-null record to be a definition.");

573

575 while (DC) {

576 if (isa(DC)) {

577 return;

578 }

580 }

581

583

584

585

587 for (Decl *SubDecl : Record->decls()) {

589 Decls.push_back(SubDecl);

590 if (auto *Function = dyn_cast(SubDecl)) {

591

593 }

594 }

595 }

596

597 ID.AddInteger(Decls.size());

598 for (auto SubDecl : Decls) {

600 }

601

604 if (TD) {

606 }

607

608 ID.AddInteger(Record->getNumBases());

609 auto Bases = Record->bases();

610 for (const auto &Base : Bases) {

612 ID.AddInteger(Base.isVirtual());

613 ID.AddInteger(Base.getAccessSpecifierAsWritten());

614 }

615}

616

618 assert(!isa(Record) &&

619 "For CXXRecordDecl should call AddCXXRecordDecl.");

621

622

623

625 for (Decl *SubDecl : Record->decls()) {

627 Decls.push_back(SubDecl);

628 }

629

630 ID.AddInteger(Decls.size());

631 for (const Decl *SubDecl : Decls)

633}

634

637

640 if (SuperClass)

641 ID.AddInteger(SuperClass->getODRHash());

642

643

646

648 }

649

650

651

653 for (Decl *SubDecl : IF->decls())

655 Decls.push_back(SubDecl);

656

657 ID.AddInteger(Decls.size());

658 for (auto *SubDecl : Decls)

660}

661

663 bool SkipBody) {

664 assert(Function && "Expecting non-null pointer.");

665

666

668 while (DC) {

669 if (isa(DC)) return;

670 if (auto *F = dyn_cast(DC)) {

671 if (F->isFunctionTemplateSpecialization()) {

672 if (!isa(DC)) return;

674

675

676 if (F->getDependentSpecializationInfo())

677 return;

678

679

680 }

681 }

683 }

684

685 ID.AddInteger(Function->getDeclKind());

686

687 const auto *SpecializationArgs = Function->getTemplateSpecializationArgs();

689 if (SpecializationArgs) {

690 ID.AddInteger(SpecializationArgs->size());

691 for (const TemplateArgument &TA : SpecializationArgs->asArray()) {

693 }

694 }

695

696 if (const auto *Method = dyn_cast(Function)) {

699 }

700

701 ID.AddInteger(Function->getStorageClass());

707

710

711 if (DeletedMessage)

712 ID.AddString(DeletedMessage->getBytes());

713

715

717

718 ID.AddInteger(Function->param_size());

719 for (auto *Param : Function->parameters())

721

722 if (SkipBody) {

724 return;

725 }

726

727 const bool HasBody = Function->isThisDeclarationADefinition() &&

729 Function->isLateTemplateParsed();

731 if (!HasBody) {

732 return;

733 }

734

735 auto *Body = Function->getBody();

737 if (Body)

739

740

741

745 Decls.push_back(SubDecl);

746 }

747 }

748

749 ID.AddInteger(Decls.size());

750 for (auto SubDecl : Decls) {

752 }

753}

754

756 assert(Enum);

758

760 if (Enum->isScoped())

762

763 if (Enum->getIntegerTypeSourceInfo())

765

766

767

769 for (Decl *SubDecl : Enum->decls()) {

771 assert(isa(SubDecl) && "Unexpected Decl");

772 Decls.push_back(SubDecl);

773 }

774 }

775

776 ID.AddInteger(Decls.size());

777 for (auto SubDecl : Decls) {

779 }

780

781}

782

785

786

787 ID.AddInteger(P->getReferencedProtocols().size());

789

791 }

792

793

794

796 for (Decl *SubDecl : P->decls()) {

798 Decls.push_back(SubDecl);

799 }

800 }

801

802 ID.AddInteger(Decls.size());

803 for (auto *SubDecl : Decls) {

805 }

806}

807

809 assert(D && "Expecting non-null pointer.");

811

812 const NamedDecl *ND = dyn_cast(D);

814 if (!ND) {

816 return;

817 }

818

820

821

822

823

825 if (auto *CTSD = dyn_cast(D))

826 Args = CTSD->getTemplateArgs().asArray();

827 else if (auto *VTSD = dyn_cast(D))

828 Args = VTSD->getTemplateArgs().asArray();

829 else if (auto *FD = dyn_cast(D))

830 if (FD->getTemplateSpecializationArgs())

831 Args = FD->getTemplateSpecializationArgs()->asArray();

832

833 for (auto &TA : Args)

835}

836

837namespace {

838

839

840class ODRTypeVisitor : public TypeVisitor {

842 llvm::FoldingSetNodeID &ID;

844

845public:

846 ODRTypeVisitor(llvm::FoldingSetNodeID &ID, ODRHash &Hash)

847 : ID(ID), Hash(Hash) {}

848

849 void AddStmt(Stmt *S) {

851 if (S) {

853 }

854 }

855

856 void AddDecl(const Decl *D) {

858 if (D) {

860 }

861 }

862

865 }

866

867 void AddType(const Type *T) {

869 if (T) {

871 }

872 }

873

876 if (NNS) {

878 }

879 }

880

883 if (II) {

885 }

886 }

887

888 void VisitQualifiers(Qualifiers Quals) {

890 }

891

892

893

894 static const Type *RemoveTypedef(const Type *T) {

895 const auto *TypedefT = dyn_cast(T);

896 if (!TypedefT) {

897 return T;

898 }

899

901 QualType UnderlyingType = D->getUnderlyingType();

902

904 return T;

905 }

906

907 const auto *ElaboratedT = dyn_cast(UnderlyingType);

908 if (!ElaboratedT) {

909 return T;

910 }

911

912 if (ElaboratedT->getQualifier() != nullptr) {

913 return T;

914 }

915

916 QualType NamedType = ElaboratedT->getNamedType();

918 return T;

919 }

920

921 const auto *RecordT = dyn_cast(NamedType);

922 if (!RecordT) {

923 return T;

924 }

925

926 const IdentifierInfo *TypedefII = TypedefT->getDecl()->getIdentifier();

927 const IdentifierInfo *RecordII = RecordT->getDecl()->getIdentifier();

928 if (!TypedefII || !RecordII ||

930 return T;

931 }

932

933 return RecordT;

934 }

935

936 void Visit(const Type *T) {

937 T = RemoveTypedef(T);

939 Inherited::Visit(T);

940 }

941

942 void VisitType(const Type *T) {}

943

945 AddQualType(T->getOriginalType());

946

947 VisitType(T);

948 }

949

950 void VisitDecayedType(const DecayedType *T) {

951

952

953 VisitAdjustedType(T);

954 }

955

956 void VisitArrayType(const ArrayType *T) {

957 AddQualType(T->getElementType());

958 ID.AddInteger(llvm::to_underlying(T->getSizeModifier()));

959 VisitQualifiers(T->getIndexTypeQualifiers());

960 VisitType(T);

961 }

964 VisitArrayType(T);

965 }

966

968 VisitConstantArrayType(T);

969 }

970

972 AddStmt(T->getSizeExpr());

973 VisitArrayType(T);

974 }

975

977 VisitArrayType(T);

978 }

979

981 AddStmt(T->getSizeExpr());

982 VisitArrayType(T);

983 }

984

986 ID.AddInteger(T->getAttrKind());

987 AddQualType(T->getModifiedType());

988

989 VisitType(T);

990 }

991

994 VisitType(T);

995 }

996

997 void VisitBuiltinType(const BuiltinType *T) {

998 ID.AddInteger(T->getKind());

999 VisitType(T);

1000 }

1001

1002 void VisitComplexType(const ComplexType *T) {

1003 AddQualType(T->getElementType());

1004 VisitType(T);

1005 }

1006

1008 AddStmt(T->getUnderlyingExpr());

1009 VisitType(T);

1010 }

1011

1013 VisitDecltypeType(T);

1014 }

1015

1016 void VisitDeducedType(const DeducedType *T) {

1017 AddQualType(T->getDeducedType());

1018 VisitType(T);

1019 }

1020

1021 void VisitAutoType(const AutoType *T) {

1022 ID.AddInteger((unsigned)T->getKeyword());

1023 ID.AddInteger(T->isConstrained());

1024 if (T->isConstrained()) {

1025 AddDecl(T->getTypeConstraintConcept());

1026 ID.AddInteger(T->getTypeConstraintArguments().size());

1027 for (const auto &TA : T->getTypeConstraintArguments())

1029 }

1030 VisitDeducedType(T);

1031 }

1032

1033 void VisitDeducedTemplateSpecializationType(

1036 VisitDeducedType(T);

1037 }

1038

1041 AddStmt(T->getAddrSpaceExpr());

1042 VisitType(T);

1043 }

1044

1046 AddQualType(T->getElementType());

1047 AddStmt(T->getSizeExpr());

1048 VisitType(T);

1049 }

1050

1057 VisitType(T);

1058 }

1059

1061 VisitFunctionType(T);

1062 }

1063

1067 AddQualType(ParamType);

1068

1069 VisitFunctionType(T);

1070 }

1071

1073 AddDecl(T->getDecl());

1074 VisitType(T);

1075 }

1076

1079 AddType(T->getClass());

1080 VisitType(T);

1081 }

1082

1085 VisitType(T);

1086 }

1087

1089 AddDecl(T->getInterface());

1090

1091 auto TypeArgs = T->getTypeArgsAsWritten();

1092 ID.AddInteger(TypeArgs.size());

1093 for (auto Arg : TypeArgs) {

1094 AddQualType(Arg);

1095 }

1096

1097 auto Protocols = T->getProtocols();

1098 ID.AddInteger(Protocols.size());

1099 for (auto *Protocol : Protocols) {

1100 AddDecl(Protocol);

1101 }

1102

1104

1105 VisitType(T);

1106 }

1107

1109

1110 VisitObjCObjectType(T);

1111 }

1112

1114 AddDecl(T->getDecl());

1115 auto Protocols = T->getProtocols();

1116 ID.AddInteger(Protocols.size());

1117 for (auto *Protocol : Protocols) {

1118 AddDecl(Protocol);

1119 }

1120

1121 VisitType(T);

1122 }

1123

1125 AddQualType(T->getPattern());

1126 VisitType(T);

1127 }

1128

1129 void VisitParenType(const ParenType *T) {

1130 AddQualType(T->getInnerType());

1131 VisitType(T);

1132 }

1133

1134 void VisitPipeType(const PipeType *T) {

1135 AddQualType(T->getElementType());

1137 VisitType(T);

1138 }

1139

1140 void VisitPointerType(const PointerType *T) {

1142 VisitType(T);

1143 }

1144

1146 AddQualType(T->getPointeeTypeAsWritten());

1147 VisitType(T);

1148 }

1149

1151 VisitReferenceType(T);

1152 }

1153

1155 VisitReferenceType(T);

1156 }

1157

1158 void

1160 AddDecl(T->getAssociatedDecl());

1162 VisitType(T);

1163 }

1164

1166 AddDecl(T->getAssociatedDecl());

1167 AddQualType(T->getReplacementType());

1168 VisitType(T);

1169 }

1170

1171 void VisitTagType(const TagType *T) {

1172 AddDecl(T->getDecl());

1173 VisitType(T);

1174 }

1175

1176 void VisitRecordType(const RecordType *T) { VisitTagType(T); }

1177 void VisitEnumType(const EnumType *T) { VisitTagType(T); }

1178

1180 ID.AddInteger(T->template_arguments().size());

1181 for (const auto &TA : T->template_arguments()) {

1183 }

1185 VisitType(T);

1186 }

1187

1189 ID.AddInteger(T->getDepth());

1190 ID.AddInteger(T->getIndex());

1192 AddDecl(T->getDecl());

1193 }

1194

1195 void VisitTypedefType(const TypedefType *T) {

1196 AddDecl(T->getDecl());

1197 VisitType(T);

1198 }

1199

1201 AddStmt(T->getUnderlyingExpr());

1203

1204 VisitType(T);

1205 }

1206 void VisitTypeOfType(const TypeOfType *T) {

1207 AddQualType(T->getUnmodifiedType());

1208 VisitType(T);

1209 }

1210

1212 ID.AddInteger(llvm::to_underlying(T->getKeyword()));

1213 VisitType(T);

1214 };

1215

1217 AddNestedNameSpecifier(T->getQualifier());

1218 AddIdentifierInfo(T->getIdentifier());

1219 VisitTypeWithKeyword(T);

1220 }

1221

1222 void VisitDependentTemplateSpecializationType(

1224 AddIdentifierInfo(T->getIdentifier());

1225 AddNestedNameSpecifier(T->getQualifier());

1226 ID.AddInteger(T->template_arguments().size());

1227 for (const auto &TA : T->template_arguments()) {

1229 }

1230 VisitTypeWithKeyword(T);

1231 }

1232

1234 AddNestedNameSpecifier(T->getQualifier());

1235 AddQualType(T->getNamedType());

1236 VisitTypeWithKeyword(T);

1237 }

1238

1240 AddQualType(T->getUnderlyingType());

1241 AddQualType(T->getBaseType());

1242 VisitType(T);

1243 }

1244

1246 AddDecl(T->getDecl());

1247 VisitType(T);

1248 }

1249

1250 void VisitVectorType(const VectorType *T) {

1251 AddQualType(T->getElementType());

1252 ID.AddInteger(T->getNumElements());

1253 ID.AddInteger(llvm::to_underlying(T->getVectorKind()));

1254 VisitType(T);

1255 }

1256

1258 VisitVectorType(T);

1259 }

1260};

1261}

1262

1264 assert(T && "Expecting non-null pointer.");

1265 ODRTypeVisitor(ID, *this).Visit(T);

1266}

1267

1270 if (T.isNull())

1271 return;

1275}

1276

1278 Bools.push_back(Value);

1279}

1280

1283

1284

1285

1286

1287

1291 if (Base) {

1292 ID.AddInteger(Value.getLValueOffset().getQuantity());

1293 break;

1294 }

1295

1298 ID.AddInteger(Value.getLValueOffset().getQuantity());

1299

1300 bool OnePastTheEnd = Value.isLValueOnePastTheEnd();

1301 if (Value.hasLValuePath()) {

1305 if (const auto *CAT = dyn_cast(AT))

1306 OnePastTheEnd |= CAT->getSize() == E.getAsArrayIndex();

1307 TypeSoFar = AT->getElementType();

1308 } else {

1309 const Decl *D = E.getAsBaseOrMember().getPointer();

1310 if (const auto *FD = dyn_cast(D)) {

1311 if (FD->getParent()->isUnion())

1312 ID.AddInteger(FD->getFieldIndex());

1313 TypeSoFar = FD->getType();

1314 } else {

1315 TypeSoFar =

1317 }

1318 }

1319 }

1320 }

1321 unsigned Val = 0;

1322 if (Value.isNullPointer())

1323 Val |= 1 << 0;

1324 if (OnePastTheEnd)

1325 Val |= 1 << 1;

1326 if (Value.hasLValuePath())

1327 Val |= 1 << 2;

1328 ID.AddInteger(Val);

1329 break;

1330 }

1333 assert(D);

1335 ID.AddInteger(

1337 break;

1338 }

1339 default:

1340 Value.Profile(ID);

1341 }

1342}

llvm::MachO::Record Record

This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes,...

A non-discriminated union of a base, field, or array index.

APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...

CharUnits getMemberPointerPathAdjustment(const APValue &MP) const

Find the 'this' offset for the member path in a pointer-to-member APValue.

QualType getRecordType(const RecordDecl *Decl) const

Represents an access specifier followed by colon ':'.

Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.

Represents a constant array type that does not decay to a pointer when used as a function parameter.

Represents an array type, per C99 6.7.5.2 - Array Declarators.

An attributed type is a type to which a type attribute has been applied.

Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.

This class is used for builtin types like 'int'.

Represents a static or instance method of a struct/union/class.

Represents a C++ struct/union/class.

QuantityType getQuantity() const

getQuantity - Get the raw integer representation of this quantity.

Declaration of a class template.

Complex values, per C99 6.2.5p11.

A simple visitor class that helps create declaration visitors.

Represents the canonical version of C arrays with a specified constant size.

Represents a pointer type decayed from an array or function type.

DeclContext - This is used only as base class of specific decl types that can act as declaration cont...

DeclContext * getParent()

getParent - Returns the containing DeclContext.

bool isFileContext() const

DeclContext * getLexicalParent()

getLexicalParent - Returns the containing lexical DeclContext.

decl_range decls() const

decls_begin/decls_end - Iterate over the declarations stored in this context.

Decl::Kind getDeclKind() const

Decl - This represents one declaration (or definition), e.g.

ASTContext & getASTContext() const LLVM_READONLY

bool isImplicit() const

isImplicit - Indicates whether the declaration was implicitly generated by the implementation.

bool isParameterPack() const

Whether this declaration is a parameter pack.

DeclContext * getDeclContext()

AccessSpecifier getAccess() const

virtual Decl * getCanonicalDecl()

Retrieves the "canonical" declaration of the given declaration.

The name of a declaration.

@ CXXConversionFunctionName

Represents the type decltype(expr) (C++11).

Represents a C++17 deduced template specialization type.

Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...

Represents an extended address space qualifier where the input address space value is dependent.

Internal representation of canonical, dependent decltype(expr) types.

Represents a qualified type name for which the type name is dependent.

Represents an array type in C++ whose size is a value-dependent expression.

Represents an extended vector type where either the type or size is dependent.

Represents a template specialization type whose template cannot be resolved, e.g.

Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...

An instance of this object exists for each enum constant that is defined.

A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.

ExtVectorType - Extended vector type.

Represents a member of a struct/union/class.

FriendDecl - Represents the declaration of a friend entity, which can be a function,...

Represents a function declaration or definition.

Represents a K&R-style 'int foo()' function, which has no information available about its arguments.

Represents a prototype with parameter type info, e.g.

unsigned getNumParams() const

void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)

ArrayRef< QualType > getParamTypes() const

Declaration of a template function.

void Profile(llvm::FoldingSetNodeID &ID) const

FunctionType - C99 6.7.5.3 - Function Declarators.

ExtInfo getExtInfo() const

QualType getReturnType() const

One of these records is kept for each identifier that is lexed.

StringRef getName() const

Return the actual identifier string.

Represents a C array with an unspecified size.

The injected class name of a C++ class template or class template partial specialization.

An lvalue reference type, per C++11 [dcl.ref].

A pointer to member type per C++ 8.3.3 - Pointers to members.

This represents a decl that may have a name.

DeclarationName getDeclName() const

Get the actual, stored name of the declaration, which may be a special name.

Represents a C++ nested name specifier, such as "\::std::vector::".

SpecifierKind getKind() const

Determine what kind of nested name specifier is stored.

NamespaceAliasDecl * getAsNamespaceAlias() const

Retrieve the namespace alias stored in this nested name specifier.

IdentifierInfo * getAsIdentifier() const

Retrieve the identifier stored in this nested name specifier.

NestedNameSpecifier * getPrefix() const

Return the prefix of this nested name specifier.

@ NamespaceAlias

A namespace alias, stored as a NamespaceAliasDecl*.

@ TypeSpec

A type, stored as a Type*.

@ TypeSpecWithTemplate

A type that was preceded by the 'template' keyword, stored as a Type*.

@ Super

Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.

@ Identifier

An identifier, stored as an IdentifierInfo*.

@ Global

The global specifier '::'. There is no stored value.

@ Namespace

A namespace, stored as a NamespaceDecl*.

NamespaceDecl * getAsNamespace() const

Retrieve the namespace stored in this nested name specifier.

const Type * getAsType() const

Retrieve the type stored in this nested name specifier.

NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.

void AddDecl(const Decl *D)

void AddStmt(const Stmt *S)

void AddStructuralValue(const APValue &)

void AddCXXRecordDecl(const CXXRecordDecl *Record)

void AddIdentifierInfo(const IdentifierInfo *II)

void AddObjCProtocolDecl(const ObjCProtocolDecl *P)

void AddDeclarationName(DeclarationName Name, bool TreatAsDecl=false)

void AddObjCInterfaceDecl(const ObjCInterfaceDecl *Record)

void AddType(const Type *T)

void AddEnumDecl(const EnumDecl *Enum)

void AddNestedNameSpecifier(const NestedNameSpecifier *NNS)

void AddFunctionDecl(const FunctionDecl *Function, bool SkipBody=false)

void AddBoolean(bool value)

void AddTemplateName(TemplateName Name)

void AddRecordDecl(const RecordDecl *Record)

void AddSubDecl(const Decl *D)

void AddQualType(QualType T)

void AddTemplateParameterList(const TemplateParameterList *TPL)

void AddTemplateArgument(TemplateArgument TA)

static bool isSubDeclToBeProcessed(const Decl *D, const DeclContext *Parent)

Represents an ObjC class declaration.

protocol_range protocols() const

const ObjCProtocolList & getReferencedProtocols() const

ObjCInterfaceDecl * getSuperClass() const

Interfaces are the core concept in Objective-C for object oriented design.

ObjCIvarDecl - Represents an ObjC instance variable.

ObjCMethodDecl - Represents an instance or class method declaration.

ImplicitParamDecl * getSelfDecl() const

bool hasBody() const override

Determine whether this method has a body.

ArrayRef< ParmVarDecl * > parameters() const

unsigned param_size() const

Stmt * getBody() const override

Retrieve the body of this method, if it has one.

TypeSourceInfo * getReturnTypeSourceInfo() const

bool isSynthesizedAccessorStub() const

bool isDirectMethod() const

True if the method is tagged as objc_direct.

ImplicitParamDecl * getCmdDecl() const

bool isInstanceMethod() const

bool isThisDeclarationADefinition() const

Returns whether this specific method is a definition.

bool isThisDeclarationADesignatedInitializer() const

Returns true if this specific method declaration is marked with the designated initializer attribute.

ObjCMethodFamily getMethodFamily() const

Determines the family of this method.

ObjCImplementationControl getImplementationControl() const

bool hasSkippedBody() const

True if the method was a definition but its body was skipped.

Represents a pointer to an Objective C object.

Represents a class type in Objective C.

Represents one property declaration in an Objective-C interface.

Represents an Objective-C protocol declaration.

Represents a type parameter type in Objective C.

Represents a pack expansion of types.

Sugar for parentheses used when specifying types.

Represents a parameter to a function.

PointerType - C99 6.7.5.1 - Pointer Declarators.

A (possibly-)qualified type.

bool hasLocalQualifiers() const

Determine whether this particular QualType instance has any qualifiers, without looking through any t...

Represents a template name as written in source code.

TemplateName getUnderlyingTemplate() const

Return the underlying template name.

NestedNameSpecifier * getQualifier() const

Return the nested name specifier that qualifies this name.

bool hasTemplateKeyword() const

Whether the template name was prefixed by the "template" keyword.

The collection of all-type qualifiers we support.

uint64_t getAsOpaqueValue() const

An rvalue reference type, per C++11 [dcl.ref].

Represents a struct/union/class.

A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...

Declaration of a redeclarable template.

Base for LValueReferenceType and RValueReferenceType.

Smart pointer class that efficiently represents Objective-C method names.

Represents a C++11 static_assert declaration.

Stmt - This represents one statement.

StringLiteral - This represents a string literal expression, e.g.

StringRef getBytes() const

Allow access to clients that need the byte representation, such as ASTWriterStmt::VisitStringLiteral(...

Represents the result of substituting a set of types for a template type parameter pack.

Represents the result of substituting a type for a template type parameter.

Represents a template argument.

QualType getStructuralValueType() const

Get the type of a StructuralValue.

Expr * getAsExpr() const

Retrieve the template argument as an expression.

QualType getAsType() const

Retrieve the type for a type template argument.

llvm::APSInt getAsIntegral() const

Retrieve the template argument as an integral value.

unsigned pack_size() const

The number of template arguments in the given template argument pack.

ValueDecl * getAsDecl() const

Retrieve the declaration for a declaration non-type template argument.

ArrayRef< TemplateArgument > pack_elements() const

Iterator range referencing all of the elements of a template argument pack.

@ Declaration

The template argument is a declaration that was provided for a pointer, reference,...

@ Template

The template argument is a template name that was provided for a template template parameter.

@ StructuralValue

The template argument is a non-type template argument that can't be represented by the special-case D...

@ Pack

The template argument is actually a parameter pack.

@ TemplateExpansion

The template argument is a pack expansion of a template name that was provided for a template templat...

@ NullPtr

The template argument is a null pointer or null pointer to member that was provided for a non-type te...

@ Type

The template argument is a type.

@ Null

Represents an empty template argument, e.g., one that has not been deduced.

@ Integral

The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...

@ Expression

The template argument is an expression, and we've not resolved it to one of the other forms yet,...

ArgKind getKind() const

Return the kind of stored template argument.

TemplateName getAsTemplateOrTemplatePattern() const

Retrieve the template argument as a template name; if the argument is a pack expansion,...

const APValue & getAsStructuralValue() const

Get the value of a StructuralValue.

The base class of all kinds of template declarations (e.g., class, function, etc.).

TemplateParameterList * getTemplateParameters() const

Get the list of template parameters.

Represents a C++ template name within the type system.

@ UsingTemplate

A template name that refers to a template declaration found through a specific using shadow declarati...

@ OverloadedTemplate

A set of overloaded template declarations.

@ Template

A single template declaration.

@ DependentTemplate

A dependent template name that has not been resolved to a template (or set of templates).

@ SubstTemplateTemplateParm

A template template parameter that has been substituted for some other template name.

@ SubstTemplateTemplateParmPack

A template template parameter pack that has been substituted for a template template argument pack,...

@ DeducedTemplate

A template name that refers to another TemplateName with deduced default arguments.

@ QualifiedTemplate

A qualified template name, where the qualification is kept to describe the source code as written.

@ AssumedTemplate

An unqualified-id that has been assumed to name a function template that will be found by ADL.

Stores a list of template parameters for a TemplateDecl and its derived classes.

ArrayRef< NamedDecl * > asArray()

Represents a type template specialization; the template must be a class template, a type alias templa...

TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.

Declaration of a template type parameter.

Represents the declaration of a typedef-name via a C++11 alias-declaration.

Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...

Expr * getImmediatelyDeclaredConstraint() const

Get the immediately-declared constraint expression introduced by this type-constraint,...

Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...

Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...

A container of type source information.

QualType getType() const

Return the type wrapped by this type source info.

A helper class for Type nodes having an ElaboratedTypeKeyword.

The base class of the type hierarchy.

QualType getPointeeType() const

If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.

const ArrayType * getAsArrayTypeUnsafe() const

A variant of getAs<> for array types which silently discards qualifiers from the outermost type.

TypeClass getTypeClass() const

Represents the declaration of a typedef-name via the 'typedef' type specifier.

Base class for declarations which introduce a typedef-name.

A unary type transform, which is a type constructed from another.

Represents the dependent type named by a dependently-scoped typename using declaration,...

Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...

Represents a variable declaration or definition.

Represents a C array with a specified size that is not an integer-constant-expression.

Represents a GCC generic vector type.

The JSON file list parser is used to communicate input to InstallAPI.

@ Result

The result type of a method or function.

const FunctionProtoType * T

@ Enum

The "enum" keyword introduces the elaborated-type-specifier.

A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...

const Type * Ty

The locally-unqualified type.

Qualifiers Quals

The local qualifiers.

#define remainder(__x, __y)