clang: lib/ExtractAPI/DeclarationFragments.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

24#include "llvm/ADT/StringSwitch.h"

25#include "llvm/Support/ErrorHandling.h"

26#include "llvm/Support/raw_ostream.h"

27#include

28

30using namespace llvm;

31

32namespace {

33

37 if (!TSInfo)

38 return;

39

41 while (true) {

42

45 continue;

46 }

47

49 TL = AttrTL.getModifiedLoc();

50 continue;

51 }

52

53

54

59 }

60 break;

61 }

62}

63

64}

65

67DeclarationFragments::appendUnduplicatedTextCharacter(char Character) {

68 if (!Fragments.empty()) {

71

72

73 if (Last.Spelling.back() != Character) {

74 Last.Spelling.push_back(Character);

75 }

76 } else {

78 Fragments.back().Spelling.push_back(Character);

79 }

80 }

81

82 return *this;

83}

84

86 return appendUnduplicatedTextCharacter(' ');

87}

88

90 return appendUnduplicatedTextCharacter(';');

91}

92

94 if (Fragments.empty())

95 return *this;

96

99 Last.Spelling.pop_back();

100

101 return *this;

102}

103

106 switch (Kind) {

108 return "none";

110 return "keyword";

112 return "attribute";

114 return "number";

116 return "string";

118 return "identifier";

120 return "typeIdentifier";

122 return "genericParameter";

124 return "externalParam";

126 return "internalParam";

128 return "text";

129 }

130

131 llvm_unreachable("Unhandled FragmentKind");

132}

133

136 return llvm::StringSwitch(S)

142 .Case("typeIdentifier",

144 .Case("genericParameter",

150}

151

155 switch (ExceptionSpec) {

157 return Fragments;

164

165 return Fragments;

170

171 break;

184 default:

185 return Fragments;

186 }

187

188 llvm_unreachable("Unhandled exception specification");

189}

190

194 if (Record->isStruct())

196 else if (Record->isUnion())

198 else

200

201 return Fragments;

202}

203

204

205

206

207

213 return Fragments;

214

217 Fragments.append(getFragmentsForNNS(Prefix, Context, After));

218 if (const auto *NS = dyn_cast(Namespace);

219 NS && NS->isAnonymousNamespace())

220 return Fragments;

223 Fragments.append(Namespace->getName(),

225 Namespace);

226 break;

227 }

228

230

231 break;

232

234

236 break;

237

239

240 Fragments.append(getFragmentsForType(NNS.getAsType(), Context, After));

241 break;

242 }

243 }

244

245

247}

248

249

250

253 assert(T && "invalid type");

254

255 DeclarationFragments Fragments;

256

257 if (const MacroQualifiedType *MQT = dyn_cast(T)) {

259 getFragmentsForType(MQT->getUnderlyingType(), Context, After));

260 return Fragments;

261 }

262

263 if (const AttributedType *AT = dyn_cast(T)) {

264

266 getFragmentsForType(AT->getModifiedType(), Context, After));

267 return Fragments;

268 }

269

270

271

272

273

274

275 if (const TypedefType *TypedefTy = dyn_cast(T)) {

276 const TypedefNameDecl *Decl = TypedefTy->getDecl();

277 TypedefUnderlyingTypeResolver TypedefResolver(Context);

278 std::string USR = TypedefResolver.getUSRForType(QualType(T, 0));

279

282 Fragments

286 }

287

289 getFragmentsForNNS(TypedefTy->getQualifier(), Context, After));

290

291 if (TypedefTy->isObjCIdType()) {

292 return Fragments.append(Decl->getName(),

294 }

295

296 return Fragments.append(

298 USR, TypedefResolver.getUnderlyingTypeDecl(QualType(T, 0)));

299 }

300

301

302

305 Fragments.append(getFragmentsForType(PointeeT, Context, After));

306

307

311 }

312

313

314

316 T->getAs()->isObjCIdOrClassType()) {

317

319

320

321

322 if (T->getAs()->isObjCQualifiedIdType()) {

324 }

325

326 return Fragments;

327 }

328

329

330

331 if (const LValueReferenceType *LRT = dyn_cast(T))

332 return Fragments

334 getFragmentsForType(LRT->getPointeeTypeAsWritten(), Context, After))

336

337

338

339 if (const RValueReferenceType *RRT = dyn_cast(T))

340 return Fragments

342 getFragmentsForType(RRT->getPointeeTypeAsWritten(), Context, After))

344

345

346

347

349

350

351

352

354

355 switch (AT->getSizeModifier()) {

357 break;

360 break;

363 break;

364 }

365

366 if (const ConstantArrayType *CAT = dyn_cast(AT)) {

367

368

369

370

371 SmallString<128> Size;

372 CAT->getSize().toStringUnsigned(Size);

374 }

375

377

378 return Fragments.append(

379 getFragmentsForType(AT->getElementType(), Context, After));

380 }

381

382 if (const TemplateSpecializationType *TemplSpecTy =

383 dyn_cast(T)) {

386 Fragments

390

391 auto TemplName = TemplSpecTy->getTemplateName();

392 std::string Str;

393 raw_string_ostream Stream(Str);

396 SmallString<64> USR("");

397 if (const auto *QTN = TemplName.getAsQualifiedTemplateName()) {

398 Fragments.append(getFragmentsForNNS(QTN->getQualifier(), Context, After));

399 TemplName = QTN->getUnderlyingTemplate();

400 }

401 if (const auto *TemplDecl = TemplName.getAsTemplateDecl())

403

404

405 return Fragments

409 TemplSpecTy->template_arguments(), Context, std::nullopt))

411 }

412

413

414

415 if (const TagType *TagTy = dyn_cast(T)) {

418 Fragments

422

423 Fragments.append(getFragmentsForNNS(TagTy->getQualifier(), Context, After));

424

425 const TagDecl *Decl = TagTy->getDecl();

426

427 if (Decl->getName().empty())

428 return Fragments.append("{ ... }",

430 SmallString<128> TagUSR;

432 return Fragments.append(Decl->getName(),

434 TagUSR, Decl);

435 }

436

437

438

440

441

442

443 if (const auto *ObjCIT = dyn_cast(Base)) {

444 const auto *Decl = ObjCIT->getDecl();

445 SmallString<128> USR;

447 return Fragments.append(Decl->getName(),

449 USR, Decl);

450 }

451

452

453 SmallString<128> USR;

457

458 return Fragments;

459}

460

462DeclarationFragmentsBuilder::getFragmentsForQualifiers(const Qualifiers Quals) {

463 DeclarationFragments Fragments;

470

471 return Fragments;

472}

473

476 assert(!QT.isNull() && "invalid type");

477

478 if (const ParenType *PT = dyn_cast(QT)) {

480 return getFragmentsForType(PT->getInnerType(), Context, After)

482 }

483

484 const SplitQualType SQT = QT.split();

485 DeclarationFragments QualsFragments = getFragmentsForQualifiers(SQT.Quals),

486 TypeFragments =

487 getFragmentsForType(SQT.Ty, Context, After);

489 TypeFragments.replace("bool", 0);

490

492 return TypeFragments;

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

512 return TypeFragments.appendSpace().append(std::move(QualsFragments));

513

514 return QualsFragments.appendSpace().append(std::move(TypeFragments));

515}

516

521 if (Decl->isAnonymousNamespace())

525}

526

533

536 Fragments

540

541

542

543

544

545

549 findTypeLocForBlockDecl(Var->getTypeSourceInfo(), BlockLoc, BlockProtoLoc);

550

551 if (!BlockLoc) {

556

559 } else {

560 Fragments.append(getFragmentsForBlock(Var, BlockLoc, BlockProtoLoc, After));

561 }

562

563 return Fragments

565 .append(std::move(After))

567}

568

579

580

584

588 if (StringRef(ArgumentFragment.begin()->Spelling)

589 .starts_with("type-parameter")) {

590 std::string ProperArgName = T.getAsString();

591 ArgumentFragment.begin()->Spelling.swap(ProperArgName);

592 }

593 Fragments.append(std::move(ArgumentFragment))

597 return Fragments;

598}

599

601DeclarationFragmentsBuilder::getFragmentsForParam(const ParmVarDecl *Param) {

603

604 auto *TSInfo = Param->getTypeSourceInfo();

605

607 : Param->getASTContext().getUnqualifiedObjCPointerType(

608 Param->getType());

609

612 findTypeLocForBlockDecl(TSInfo, BlockLoc, BlockProtoLoc);

613

615 if (BlockLoc)

616 TypeFragments.append(

617 getFragmentsForBlock(Param, BlockLoc, BlockProtoLoc, After));

618 else

619 TypeFragments.append(getFragmentsForType(T, Param->getASTContext(), After));

620

621 if (StringRef(TypeFragments.begin()->Spelling)

622 .starts_with("type-parameter")) {

623 std::string ProperArgName = Param->getOriginalType().getAsString();

624 TypeFragments.begin()->Spelling.swap(ProperArgName);

625 }

626

627 if (Param->isObjCMethodParameter()) {

629 .append(std::move(TypeFragments))

630 .append(std::move(After))

632 .append(Param->getName(),

634 } else {

635 Fragments.append(std::move(TypeFragments));

636

637

638 if (T->isTypedefNameType() ||

639 (!T->isAnyPointerType() && !T->isBlockPointerType()))

641 Fragments

642 .append(Param->getName(),

644 .append(std::move(After));

645 }

646 return Fragments;

647}

648

650 const NamedDecl *BlockDecl, FunctionTypeLoc &Block,

652 DeclarationFragments Fragments;

653

654 DeclarationFragments RetTyAfter;

655 auto ReturnValueFragment = getFragmentsForType(

656 Block.getTypePtr()->getReturnType(), BlockDecl->getASTContext(), After);

657

658 Fragments.append(std::move(ReturnValueFragment))

659 .append(std::move(RetTyAfter))

662

664 unsigned NumParams = Block.getNumParams();

665

666 if (!BlockProto || NumParams == 0) {

669 else

671 } else {

673 for (unsigned I = 0; I != NumParams; ++I) {

674 if (I)

676 After.append(getFragmentsForParam(Block.getParam(I)));

679 }

681 }

682

683 return Fragments;

684}

685

689 switch (Func->getStorageClass()) {

692 break;

696 break;

700 break;

703 llvm_unreachable("invalid for functions");

704 }

705 if (Func->isConsteval())

708 else if (Func->isConstexpr())

711

712

715 auto ReturnValueFragment =

716 getFragmentsForType(ReturnType, Func->getASTContext(), After);

717 if (StringRef(ReturnValueFragment.begin()->Spelling)

718 .starts_with("type-parameter")) {

719 std::string ProperArgName = ReturnType.getAsString();

720 ReturnValueFragment.begin()->Spelling.swap(ProperArgName);

721 }

722

723 Fragments.append(std::move(ReturnValueFragment));

726 Fragments.append(Func->getNameAsString(),

728

729 if (Func->getTemplateSpecializationInfo()) {

731

732 for (unsigned i = 0, end = Func->getNumParams(); i != end; ++i) {

733 if (i)

736 getFragmentsForType(Func->getParamDecl(i)->getType(),

737 Func->getParamDecl(i)->getASTContext(), After));

738 }

740 }

741 Fragments.append(std::move(After));

742

744 unsigned NumParams = Func->getNumParams();

745 for (unsigned i = 0; i != NumParams; ++i) {

746 if (i)

748 Fragments.append(getFragmentsForParam(Func->getParamDecl(i)));

749 }

750

751 if (Func->isVariadic()) {

752 if (NumParams > 0)

755 }

757

759 Func->getExceptionSpecType()));

760

762}

763

770

775

778

782

784 if (!IntegerType.isNull())

789 .append(std::move(After));

790

794

796}

797

802 if (Field->isMutable())

805 return Fragments

807 getFragmentsForType(Field->getType(), Field->getASTContext(), After))

810 .append(std::move(After))

812}

813

818

820 if (Record->isUnion())

822 else

824

826 if (Record->getName().empty())

829 else

831

833}

834

839

842

843 if (Record->getName().empty())

846

848}

849

854 std::string Name;

855 if (const auto *Constructor = dyn_cast(Method)) {

856 Name = Method->getNameAsString();

861 Name = Method->getNameAsString();

862

865 .append(std::move(After));

867 for (unsigned i = 0, end = Method->getNumParams(); i != end; ++i) {

868 if (i)

870 Fragments.append(getFragmentsForParam(Method->getParamDecl(i)));

871 }

873

875 Method->getExceptionSpecType()));

876

878}

879

883 StringRef Name = Method->getName();

884 if (Method->isStatic())

887 if (Method->isConstexpr())

890 if (Method->isVolatile())

893 if (Method->isVirtual())

896

897

899 Fragments

900 .append(getFragmentsForType(Method->getReturnType(),

901 Method->getASTContext(), After))

904 .append(std::move(After));

906 for (unsigned i = 0, end = Method->getNumParams(); i != end; ++i) {

907 if (i)

909 Fragments.append(getFragmentsForParam(Method->getParamDecl(i)));

910 }

912

913 if (Method->isConst())

916

918 Method->getExceptionSpecType()));

919

921}

922

927

928 if (ConversionFunction->isExplicit())

931

934

935 Fragments

936 .append(ConversionFunction->getConversionType().getAsString(),

939 for (unsigned i = 0, end = ConversionFunction->getNumParams(); i != end;

940 ++i) {

941 if (i)

943 Fragments.append(getFragmentsForParam(ConversionFunction->getParamDecl(i)));

944 }

946

947 if (ConversionFunction->isConst())

950

952}

953

958

959

961 Fragments

962 .append(getFragmentsForType(Method->getReturnType(),

963 Method->getASTContext(), After))

967 .append(std::move(After));

969 for (unsigned i = 0, end = Method->getNumParams(); i != end; ++i) {

970 if (i)

972 Fragments.append(getFragmentsForParam(Method->getParamDecl(i)));

973 }

975

976 if (Method->isConst())

979

981 Method->getExceptionSpecType()));

982

984}

985

986

991 for (unsigned i = 0, end = ParameterArray.size(); i != end; ++i) {

992 if (i)

995

997 dyn_cast(ParameterArray[i])) {

1000 ->getNamedConcept()

1001 ->getName()

1002 .str(),

1004 else if (TemplateParam->wasDeclaredWithTypename())

1005 Fragments.append("typename",

1007 else

1009

1012

1017

1024 }

1025 } else if (const auto *NTP =

1026 dyn_cast(ParameterArray[i])) {

1028 const auto TyFragments =

1029 getFragmentsForType(NTP->getType(), NTP->getASTContext(), After);

1030 Fragments.append(std::move(TyFragments)).append(std::move(After));

1031

1032 if (NTP->isParameterPack())

1034

1035 if (!NTP->getName().empty())

1037 NTP->getName(),

1039

1040 if (NTP->hasDefaultArgument()) {

1042 raw_svector_ostream Output(ExprStr);

1043 NTP->getDefaultArgument().getArgument().print(

1044 NTP->getASTContext().getPrintingPolicy(), Output,

1045 false);

1048 }

1049 } else if (const auto *TTP =

1050 dyn_cast(ParameterArray[i])) {

1055 TTP->getTemplateParameters()->asArray()))

1058 .append(TTP->wasDeclaredWithTypename() ? "typename" : "class",

1060

1061 if (TTP->isParameterPack())

1063

1064 if (!TTP->getName().empty())

1066 TTP->getName(),

1068 if (TTP->hasDefaultArgument()) {

1069 const auto Default = TTP->getDefaultArgument();

1072 {Default.getArgument()}, TTP->getASTContext(), {Default}));

1073 }

1074 }

1075 }

1076 return Fragments;

1077}

1078

1079

1080

1081

1082

1083

1084

1090 for (unsigned i = 0, end = TemplateArguments.size(); i != end; ++i) {

1091 if (i)

1094

1095 const auto &CTA = TemplateArguments[i];

1096 switch (CTA.getKind()) {

1100 getFragmentsForType(CTA.getAsType(), Context, After);

1101

1102 if (StringRef(ArgumentFragment.begin()->Spelling)

1103 .starts_with("type-parameter")) {

1104 if (TemplateArgumentLocs.has_value() &&

1105 TemplateArgumentLocs->size() > i) {

1106 std::string ProperArgName = TemplateArgumentLocs.value()[i]

1107 .getTypeSourceInfo()

1108 ->getType()

1109 .getAsString();

1110 ArgumentFragment.begin()->Spelling.swap(ProperArgName);

1111 } else {

1112 auto &Spelling = ArgumentFragment.begin()->Spelling;

1113 Spelling.clear();

1114 raw_string_ostream OutStream(Spelling);

1115 CTA.print(Context.getPrintingPolicy(), OutStream, false);

1116 }

1117 }

1118

1119 Fragments.append(std::move(ArgumentFragment));

1120 break;

1121 }

1123 const auto *VD = CTA.getAsDecl();

1126 Fragments.append(VD->getNameAsString(),

1128 break;

1129 }

1132 break;

1133

1136 CTA.getAsIntegral().toString(Str);

1138 break;

1139 }

1140

1142 const auto SVTy = CTA.getStructuralValueType();

1143 Fragments.append(CTA.getAsStructuralValue().getAsString(Context, SVTy),

1145 break;

1146 }

1147

1150 std::string Str;

1151 raw_string_ostream Stream(Str);

1152 CTA.getAsTemplate().print(Stream, Context.getPrintingPolicy());

1154 if (const auto *TemplDecl =

1155 CTA.getAsTemplateOrTemplatePattern().getAsTemplateDecl())

1158 USR);

1161 break;

1162 }

1163

1167 {}))

1169 break;

1170

1173 raw_svector_ostream Output(ExprStr);

1174 CTA.getAsExpr()->printPretty(Output, nullptr,

1175 Context.getPrintingPolicy());

1177 break;

1178 }

1179

1181 break;

1182 }

1183 }

1184 return Fragments;

1185}

1186

1190 return Fragments

1195 Concept->getTemplateParameters()->asArray()))

1203}

1204

1226

1231 std::optional<ArrayRef> TemplateArgumentLocs = {};

1232 if (auto *TemplateArgs = Decl->getTemplateArgsAsWritten()) {

1233 TemplateArgumentLocs = TemplateArgs->arguments();

1234 }

1235 return Fragments

1243 .pop_back()

1247 TemplateArgumentLocs))

1250}

1251

1256 return Fragments

1261 Decl->getTemplateParameters()->asArray()))

1266 .pop_back()

1270 Decl->getTemplateArgsAsWritten()->arguments()))

1273}

1274

1279 return Fragments

1286 .pop_back()

1290 Decl->getTemplateArgsAsWritten()->arguments()))

1293}

1294

1299 return Fragments

1303

1305 Decl->getTemplateParameters()->asArray()))

1309 .pop_back()

1313 Decl->getTemplateArgsAsWritten()->arguments()))

1316}

1317

1322 return Fragments

1326

1328 Decl->getTemplateParameters()->asArray()))

1333}

1334

1339 return Fragments

1345}

1346

1354

1357 unsigned numParameters = MI->getNumParams();

1359 --numParameters;

1360 for (unsigned i = 0; i < numParameters; ++i) {

1361 if (i)

1363 Fragments.append(MI->params()[i]->getName(),

1365 }

1370 }

1372 }

1373 return Fragments;

1374}

1375

1379

1380 auto *Interface = Category->getClassInterface();

1383

1390 .append(Category->getName(),

1393

1394 return Fragments;

1395}

1396

1400

1405

1406

1411 .append(SuperClass->getName(),

1413 SuperClass);

1414 }

1415

1416 return Fragments;

1417}

1418

1422

1423 if (Method->isClassMethod())

1425 else if (Method->isInstanceMethod())

1427

1428

1430 .append(getFragmentsForType(Method->getReturnType(),

1431 Method->getASTContext(), After))

1432 .append(std::move(After))

1434

1435

1438

1439

1443

1444

1445 for (unsigned i = 0, end = Method->param_size(); i != end; ++i) {

1446

1447

1448

1449

1451 ParamID.append(":");

1454

1455

1457 Fragments.append(getFragmentsForParam(Param));

1458 }

1459

1461}

1462

1466

1467

1469

1470 const auto Attributes = Property->getPropertyAttributesAsWritten();

1471

1473

1474 bool First = true;

1476

1477 auto RenderAttribute =

1479 StringRef Arg = "",

1482

1483 if ((Attributes & Kind) && !Spelling.empty()) {

1484

1487

1488 Fragments.append(Spelling,

1490

1491

1492 if (!Arg.empty())

1494 .append(Arg, ArgKind);

1496 }

1497 };

1498

1499

1500

1511 "unsafe_unretained");

1515 Property->getGetterName().getAsString());

1517 Property->getSetterName().getAsString());

1518

1519

1522 if (const auto Nullability =

1523 AttributedType::stripOuterNullability(Type)) {

1528 Fragments.append("null_resettable",

1530 else

1535 }

1536 }

1537

1539 }

1540

1542

1545 findTypeLocForBlockDecl(Property->getTypeSourceInfo(), BlockLoc,

1546 BlockProtoLoc);

1547

1548 auto PropType = Property->getType();

1549 if (!BlockLoc)

1550 Fragments

1551 .append(getFragmentsForType(PropType, Property->getASTContext(), After))

1553 else

1555 getFragmentsForBlock(Property, BlockLoc, BlockProtoLoc, After));

1556

1557 return Fragments

1560 .append(std::move(After))

1562}

1563

1567

1570 .append(Protocol->getName(),

1572

1573

1574 if (!Protocol->protocols().empty()) {

1577 It != Protocol->protocol_end(); It++) {

1578

1579 if (It != Protocol->protocol_begin())

1581

1584 Fragments.append((*It)->getName(),

1586 *It);

1587 }

1589 }

1590

1591 return Fragments;

1592}

1593

1599 .append(getFragmentsForType(Decl->getUnderlyingType(),

1601 .append(std::move(After))

1604

1606}

1607

1608

1611

1612

1615

1616

1632 Fragments.append(Decl->getNameAsString(),

1637 } else if (Decl->getIdentifier()) {

1640 } else {

1641 Fragments.append(Decl->getDeclName().getAsString(),

1643 }

1644

1645 return Fragments;

1646}

1647

1648

1649

1653 if (Method->isClassMethod())

1655 else if (Method->isInstanceMethod())

1657

1658 return Fragments.append(Method->getNameAsString(),

1660}

1661

1662

1667 return Fragments;

1668}

Forward declaration of all AST node types.

Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....

This file defines the Declaration Fragments related classes.

llvm::MachO::Record Record

Defines the clang::TypeLoc interface and its subclasses.

C Language Family Type Representation.

This file defines the UnderlyingTypeResolver which is a helper type for resolving the undelrying type...

const clang::PrintingPolicy & getPrintingPolicy() const

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

QualType getUnqualifiedObjCPointerType(QualType type) const

getUnqualifiedObjCPointerType - Returns version of Objective-C pointer type with lifetime qualifier r...

Type source information for an attributed type.

Wrapper for source info for block pointers.

Represents a C++ conversion function within a class.

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

Represents a C++ struct/union/class.

Represents a class template specialization, which refers to a class template with a given set of temp...

Declaration of a C++20 concept.

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

ASTContext & getASTContext() const LLVM_READONLY

FunctionDecl * getAsFunction() LLVM_READONLY

Returns the function itself, or the templated function if this is a function template.

DeclContext * getDeclContext()

TypeSourceInfo * getTypeSourceInfo() const

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

QualType getIntegerType() const

Return the integer type this enum decl corresponds to.

Represents a member of a struct/union/class.

Represents a function declaration or definition.

bool isVariadic() const

Whether this function prototype is variadic.

Declaration of a template function.

Wrapper for source info for functions.

const TypeClass * getTypePtr() const

Encapsulates the data about a macro definition (e.g.

bool isC99Varargs() const

bool isFunctionLike() const

ArrayRef< const IdentifierInfo * > params() const

unsigned getNumParams() const

This represents a decl that may have a name.

StringRef getName() const

Get the name of identifier for this declaration as a StringRef.

Represent a C++ namespace.

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

NamespaceAndPrefix getAsNamespaceAndPrefix() const

const Type * getAsType() const

@ MicrosoftSuper

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

@ Global

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

@ Type

A type, stored as a Type*.

@ Namespace

A namespace-like entity, stored as a NamespaceBaseDecl*.

ObjCCategoryDecl - Represents a category declaration.

Represents an ObjC class declaration.

ObjCMethodDecl - Represents an instance or class method declaration.

Represents one property declaration in an Objective-C interface.

Represents an Objective-C protocol declaration.

ObjCProtocolList::iterator protocol_iterator

Represents a parameter to a function.

A (possibly-)qualified type.

bool isNull() const

Return true if this QualType doesn't point to a type yet.

SplitQualType split() const

Divides a QualType into its unqualified type and a set of local qualifiers.

static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)

Wrapper of type source information for a type with non-trivial direct qualifiers.

Represents a struct/union/class.

Declaration of a redeclarable template.

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

StringRef getNameForSlot(unsigned argIndex) const

Retrieve the name at a given position in the selector.

unsigned getNumArgs() const

TypedefNameDecl * getTypedefNameForAnonDecl() const

@ 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,...

TemplateParameterList * getTemplateParameters() const

Get the list of template parameters.

ArrayRef< NamedDecl * > asArray()

Base wrapper for a particular "section" of type source info.

UnqualTypeLoc getUnqualifiedLoc() const

Skips past any qualifiers, if this is qualified.

T getAs() const

Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...

TypeLoc IgnoreParens() const

A container of type source information.

TypeLoc getTypeLoc() const

Return the TypeLoc wrapper for the type source info.

QualType getType() const

Return the type wrapped by this type source info.

The base class of the type hierarchy.

bool isFunctionPointerType() const

bool isPointerType() const

CanQualType getCanonicalTypeUnqualified() const

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.

bool isObjCObjectPointerType() const

bool isAnyPointerType() const

const T * getAs() const

Member-template getAs'.

Base class for declarations which introduce a typedef-name.

Represents a variable declaration or definition.

bool isConstexpr() const

Whether this variable is (C++11) constexpr.

static const char * getStorageClassSpecifierString(StorageClass SC)

Return the string used to specify the storage class SC.

bool isStaticDataMember() const

Determines whether this is a static data member.

StorageClass getStorageClass() const

Returns the storage class as written in the source.

Represents a variable template specialization, which refers to a variable template with a given set o...

@ kind_nullability

Indicates that the nullability of the type was spelled with a property attribute rather than a type q...

@ After

Like System, but searched after the system directories.

bool generateUSRForType(QualType T, ASTContext &Ctx, SmallVectorImpl< char > &Buf)

Generates a USR for a type.

bool generateUSRForDecl(const Decl *D, SmallVectorImpl< char > &Buf)

Generate a USR for a Decl, including the USR prefix.

std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl

All declarations that can appear in a module declaration.

bool isa(CodeGen::Address addr)

@ Unspecified

Whether values of this type can be null is (explicitly) unspecified.

StorageClass

Storage classes.

@ Property

The type of a property.

llvm::StringRef getNullabilitySpelling(NullabilityKind kind, bool isContextSensitive=false)

Retrieve the spelling of the given nullability kind.

const FunctionProtoType * T

@ Keyword

The name has been typo-corrected to a keyword.

@ Type

The name was classified as a type.

@ Concept

The name was classified as a concept name.

llvm::StringRef getAsString(SyncScope S)

U cast(CodeGen::Address addr)

ElaboratedTypeKeyword

The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...

@ Interface

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

@ None

No keyword precedes the qualified type name.

ExceptionSpecificationType

The various types of exception specifications that exist in C++11.

@ EST_DependentNoexcept

noexcept(expression), value-dependent

@ EST_None

no exception specification

@ EST_BasicNoexcept

noexcept

@ EST_NoexceptFalse

noexcept(expression), evals to 'false'

@ EST_NoexceptTrue

noexcept(expression), evals to 'true'

@ EST_Dynamic

throw(T1, T2)

Diagnostic wrappers for TextAPI types for error reporting.

static StringRef getKeywordName(ElaboratedTypeKeyword Keyword)

const Type * Ty

The locally-unqualified type.

Qualifiers Quals

The local qualifiers.