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

1

2

3

4

5

6

7

8

9

10

11

12

54#include "llvm/ADT/APSInt.h"

55#include "llvm/ADT/ArrayRef.h"

56#include "llvm/ADT/STLExtras.h"

57#include "llvm/ADT/SmallVector.h"

58#include "llvm/ADT/StringRef.h"

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

60#include "llvm/ADT/iterator_range.h"

61#include "llvm/Support/Casting.h"

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

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

64#include "llvm/TargetParser/Triple.h"

65#include

66#include

67#include

68#include

69#include

70#include

71#include

72#include <type_traits>

73

74using namespace clang;

75

79

82 if (!Loc.isValid() && TheDecl) Loc = TheDecl->getLocation();

83 if (Loc.isValid()) {

84 Loc.print(OS, Context.getSourceManager());

85 OS << ": ";

86 }

87 OS << Message;

88

89 if (auto *ND = dyn_cast_if_present(TheDecl)) {

90 OS << " '";

91 ND->getNameForDiagnostic(OS, Context.getPrintingPolicy(), true);

92 OS << "'";

93 }

94

95 OS << '\n';

96}

97

98

102

103TranslationUnitDecl::TranslationUnitDecl(ASTContext &ctx)

105 DeclContext(TranslationUnit), redeclarable_base(ctx), Ctx(ctx) {}

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

162

163

164

170

173 assert(!kind.IgnoreExplicitVisibility &&

174 "asking for explicit visibility when we shouldn't be");

176}

177

178

179

185

186

187

188template

189static std::enable_if_t<!std::is_base_of_v<RedeclarableTemplateDecl, T>, bool>

192 D->getMemberSpecializationInfo()) {

193 return member->isExplicitSpecialization();

194 }

195 return false;

196}

197

198

199

200

204

205

206

207template

209 switch (attr->getVisibility()) {

210 case T::Default:

212 case T::Hidden:

214 case T::Protected:

216 }

217 llvm_unreachable("bad visibility kind");

218}

219

220

221static std::optional

223

224

226 if (const auto *A = D->getAttr()) {

228 }

229 }

230

231

232 if (const auto *A = D->getAttr()) {

234 }

235

236 return std::nullopt;

237}

238

244}

245

246

247

248

249LinkageInfo LinkageComputer::getLVForTemplateParameterList(

251 LinkageInfo LV;

252 for (const NamedDecl *P : *Params) {

253

254

256 continue;

257

258

259

260

261

262 if (const auto *NTTP = dyn_cast(P)) {

263

264 if (!NTTP->isExpandedParameterPack()) {

265 if (!NTTP->getType()->isDependentType()) {

266 LV.merge(getLVForType(*NTTP->getType(), computation));

267 }

268 continue;

269 }

270

271

272 for (unsigned i = 0, n = NTTP->getNumExpansionTypes(); i != n; ++i) {

273 QualType type = NTTP->getExpansionType(i);

274 if (type->isDependentType())

276 }

277 continue;

278 }

279

280

281

283

284

285 if (!TTP->isExpandedParameterPack()) {

286 LV.merge(getLVForTemplateParameterList(TTP->getTemplateParameters(),

287 computation));

288 continue;

289 }

290

291

292 for (unsigned i = 0, n = TTP->getNumExpansionTemplateParameters();

293 i != n; ++i) {

294 LV.merge(getLVForTemplateParameterList(

295 TTP->getExpansionTemplateParameters(i), computation));

296 }

297 }

298

299 return LV;

300}

301

303 const Decl *Ret = nullptr;

305 while (DC->getDeclKind() != Decl::TranslationUnit) {

309 }

310 return Ret;

311}

312

313

314

315

316

317

321 LinkageInfo LV;

322

323 for (const TemplateArgument &Arg : Args) {

324 switch (Arg.getKind()) {

328 continue;

329

331 LV.merge(getLVForType(*Arg.getAsType(), computation));

332 continue;

333

335 const NamedDecl *ND = Arg.getAsDecl();

338 continue;

339 }

340

343 continue;

344

346 LV.merge(getLVForValue(Arg.getAsStructuralValue(), computation));

347 continue;

348

352 Arg.getAsTemplateOrTemplatePattern().getAsTemplateDecl(

353 true))

355 continue;

356

358 LV.merge(getLVForTemplateArgumentList(Arg.getPackAsArray(), computation));

359 continue;

360 }

361 llvm_unreachable("bad template argument kind");

362 }

363

364 return LV;

365}

366

368LinkageComputer::getLVForTemplateArgumentList(const TemplateArgumentList &TArgs,

370 return getLVForTemplateArgumentList(TArgs.asArray(), computation);

371}

372

375

376

377

378

380 return true;

381

382 return !fn->hasAttr();

383}

384

385

386

387

388

389

390

391

392void LinkageComputer::mergeTemplateLV(

396 bool considerVisibility =

398

399 FunctionTemplateDecl *temp = specInfo->getTemplate();

400

401 LinkageInfo tempLV = getLVForDecl(temp, computation);

402

403

405

406

407 LinkageInfo paramsLV =

410

411

412 const TemplateArgumentList &templateArgs = *specInfo->TemplateArguments;

413 LinkageInfo argsLV = getLVForTemplateArgumentList(templateArgs, computation);

415}

416

417

418

422 return false;

423

425 D->hasAttr();

426}

427

428

429

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

454 return true;

455

456

459 return false;

460

462}

463

464

465

466void LinkageComputer::mergeTemplateLV(

470

471

472

474

475 LinkageInfo tempLV = getLVForDecl(temp, computation);

476

477

479

480 LinkageInfo paramsLV =

484

485

486

487

488 const TemplateArgumentList &templateArgs = spec->getTemplateArgs();

489 LinkageInfo argsLV = getLVForTemplateArgumentList(templateArgs, computation);

490 if (considerVisibility)

493}

494

495

496

497

498

502

503

504

505

507 return true;

508

509

510

511

512

515 return false;

516

518}

519

520

521

522

523void LinkageComputer::mergeTemplateLV(LinkageInfo &LV,

527

528

529

531 LinkageInfo tempLV =

535

536

537

538

539 const TemplateArgumentList &templateArgs = spec->getTemplateArgs();

540 LinkageInfo argsLV = getLVForTemplateArgumentList(templateArgs, computation);

541 if (considerVisibility)

544}

545

547

549 if (!Opts.CPlusPlus || !Opts.InlineVisibilityHidden)

550 return false;

551

552 const auto *FD = dyn_cast(D);

553 if (!FD)

554 return false;

555

558 = FD->getTemplateSpecializationInfo()) {

561 FD->getMemberSpecializationInfo()) {

562 TSK = MSI->getTemplateSpecializationKind();

563 }

564

566

567

568

571 FD->hasBody(Def) && Def->isInlined() && !Def->hasAttr();

572}

573

575 const T *First = D->getFirstDecl();

576 return First->isInExternCContext();

577}

578

580 if (const auto *SD = dyn_cast(D.getDeclContext()))

581 if (!SD->hasBraces())

582 return true;

583 return false;

584}

585

589

591 if (auto *TD = dyn_cast(D))

592 D = TD->getTemplatedDecl();

593 if (D) {

594 if (auto *VD = dyn_cast(D))

595 return VD->getStorageClass();

596 if (auto *FD = dyn_cast(D))

597 return FD->getStorageClass();

598 }

600}

601

603LinkageComputer::getLVForNamespaceScopeDecl(const NamedDecl *D,

605 bool IgnoreVarTypeLinkage) {

607 "Not a name having namespace scope");

609 const auto *Var = dyn_cast(D);

610

611

612

613

614

616 (Context.getLangOpts().C23 && Var && Var->isConstexpr())) {

617

618

619

620

621

622

623

624

626 }

627

628 if (Var) {

629

630

631

632

633

634

635

636

637 if (Context.getLangOpts().CPlusPlus && Var->getType().isConstQualified() &&

638 !Var->getType().isVolatileQualified() && !Var->isInline() &&

639 ![Var]() {

640

641

642 if (auto *M = Var->getOwningModule())

643 return M->isInterfaceOrPartition() || M->isImplicitGlobalModule();

644 return false;

645 }() &&

647 !Var->getDescribedVarTemplate()) {

648 const VarDecl *PrevVar = Var->getPreviousDecl();

649 if (PrevVar)

651

652 if (Var->getStorageClass() != SC_Extern &&

656 }

657

658 for (const VarDecl *PrevVar = Var->getPreviousDecl(); PrevVar;

661 Var->getStorageClass() == SC_None)

663

666 }

667 } else if (const auto *IFD = dyn_cast(D)) {

668

669 const VarDecl *VD = IFD->getVarDecl();

670 assert(VD && "Expected a VarDecl in this IndirectFieldDecl!");

671 return getLVForNamespaceScopeDecl(VD, computation, IgnoreVarTypeLinkage);

672 }

673 assert(isa<FieldDecl>(D) && "Didn't expect a FieldDecl!");

674

675

676

678 const auto *Var = dyn_cast(D);

679 const auto *Func = dyn_cast(D);

680

681

682

683

684

685

686

690 }

691

692

693

694

695

696

697

699

703 } else {

704

705

708 DC = DC->getParent()) {

709 const auto *ND = dyn_cast(DC);

710 if (!ND) continue;

711 if (std::optional Vis =

714 break;

715 }

716 }

717 }

718

719

721

724 ? Context.getLangOpts().getValueVisibilityMode()

725 : Context.getLangOpts().getTypeVisibilityMode();

726 LV.mergeVisibility(globalVisibility, false);

727

728

729

732 }

733 }

734

735

736

737

738

739

740

741

742

743

744

745

746

747

748

749

750

751 if (const auto *Var = dyn_cast(D)) {

752

753

754

755

756

757

758

759

760

761

762

763

764

765

766

767

768

769

770

771

772

773

775 !IgnoreVarTypeLinkage) {

776 LinkageInfo TypeLV = getLVForType(*Var->getType(), computation);

781 }

782

785

786

787

788

789

790

791

792

793 if (const auto *spec = dyn_cast(Var)) {

794 mergeTemplateLV(LV, spec, computation);

795 }

796

797

798 } else if (const auto *Function = dyn_cast(D)) {

799

800

801

802

803

806

807

808

809

811 Context.getLangOpts().OpenMPIsTargetDevice &&

813 OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(Function)))

815

816

817

818

819

820

821

822

823

825

826

827 QualType TypeAsWritten = Function->getType();

828 if (TypeSourceInfo *TSI = Function->getTypeSourceInfo())

829 TypeAsWritten = TSI->getType();

832 }

833

834

835

836

837 if (FunctionTemplateSpecializationInfo *specInfo

838 = Function->getTemplateSpecializationInfo()) {

839 mergeTemplateLV(LV, Function, specInfo, computation);

840 }

841

842

843

844

845

846

847

848 } else if (const auto *Tag = dyn_cast(D)) {

849

850 if (Tag->hasNameForLinkage())

852

853

854

855

856 if (const auto *spec = dyn_cast(Tag)) {

857 mergeTemplateLV(LV, spec, computation);

858 }

859

860

861

864 computation);

867 LV.merge(EnumLV);

868

869

870 } else if (const auto *temp = dyn_cast(D)) {

872 LinkageInfo tempLV =

875

876

877

878

879

880

882 return LV;

883

884

885

887

888

889 } else if (auto *TD = dyn_cast(D)) {

890

891

892 if (!TD->getAnonDeclWithTypedefName(true))

894

896

897

898

899

900 } else {

902 }

903

904

905

908

909 return LV;

910}

911

913LinkageComputer::getLVForClassMember(const NamedDecl *D,

915 bool IgnoreVarTypeLinkage) {

916

917

918

919

920

921

922

923

924

925

933

934 LinkageInfo LV;

935

936

940

941

942

943

944

947 }

948

949

950

951

952 LVComputationKind classComputation = computation;

955

956 LinkageInfo classLV =

958

959

960

962 return classLV;

963

964

965

966

967

968

969 const NamedDecl *explicitSpecSuppressor = nullptr;

970

971 if (const auto *MD = dyn_cast(D)) {

972

973

974 QualType TypeAsWritten = MD->getType();

975 if (TypeSourceInfo *TSI = MD->getTypeSourceInfo())

976 TypeAsWritten = TSI->getType();

979

980

981

982 if (FunctionTemplateSpecializationInfo *spec

983 = MD->getTemplateSpecializationInfo()) {

984 mergeTemplateLV(LV, MD, spec, computation);

986 explicitSpecSuppressor = MD;

988 explicitSpecSuppressor = spec->getTemplate()->getTemplatedDecl();

989 }

991 explicitSpecSuppressor = MD;

992 }

993

994

995

996

999 Context.getLangOpts().OpenMPIsTargetDevice &&

1002 OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(MD)))

1004

1005 } else if (const auto *RD = dyn_cast(D)) {

1006 if (const auto *spec = dyn_cast(RD)) {

1007 mergeTemplateLV(LV, spec, computation);

1009 explicitSpecSuppressor = spec;

1010 } else {

1014 }

1015 }

1017 explicitSpecSuppressor = RD;

1018 }

1019

1020

1021 } else if (const auto *VD = dyn_cast(D)) {

1022 if (const auto *spec = dyn_cast(VD))

1023 mergeTemplateLV(LV, spec, computation);

1024

1025

1026

1027 if (!IgnoreVarTypeLinkage) {

1028 LinkageInfo typeLV = getLVForType(*VD->getType(), computation);

1029

1030

1034 }

1035

1037 explicitSpecSuppressor = VD;

1038 }

1039

1040

1041 } else if (const auto *temp = dyn_cast(D)) {

1042 bool considerVisibility =

1046 LinkageInfo tempLV =

1049

1050 if (const auto *redeclTemp = dyn_cast(temp)) {

1053 } else if (const RedeclarableTemplateDecl *from =

1054 redeclTemp->getInstantiatedFromMemberTemplate()) {

1055

1056

1057

1058 LinkageInfo fromLV = from->getLinkageAndVisibility();

1060 }

1061 }

1062 }

1063

1064

1065 assert(!explicitSpecSuppressor || isa<TemplateDecl>(explicitSpecSuppressor));

1066

1067

1068

1069 bool considerClassVisibility = true;

1070 if (explicitSpecSuppressor &&

1071

1075 considerClassVisibility = false;

1076 }

1077

1078

1080 return LV;

1081}

1082

1083void NamedDecl::anchor() {}

1084

1087 return true;

1088

1091 .getLinkage();

1093}

1094

1096

1097

1098

1099

1100

1101

1102

1105 return false;

1107 return true;

1108 if (const auto *IFD = dyn_cast(this)) {

1111 return false;

1112 const VarDecl *VD = IFD->getVarDecl();

1114 }

1115

1116 if (const auto *VD = dyn_cast(this)) {

1118 return false;

1120 return true;

1122 }

1123 if (const auto *BD = dyn_cast(this);

1125 const VarDecl *VD = BD->getHoldingVar();

1127 }

1128 return false;

1129}

1130

1134

1135

1136

1137 if (!II)

1139

1142

1143

1146

1147

1148

1149

1150

1151

1152

1153

1156 return Status;

1157 if (auto *VD = dyn_cast(this))

1160 if (auto *FD = dyn_cast(this))

1161 if (FD->isExternC())

1164 }

1165

1166 return Status;

1167}

1168

1170 StringRef name = getName();

1171 if (name.empty()) return SFF_None;

1172

1173 if (name.front() == 'C')

1174 if (name == "CFStringCreateWithFormat" ||

1175 name == "CFStringCreateWithFormatAndArguments" ||

1176 name == "CFStringAppendFormat" ||

1177 name == "CFStringAppendFormatAndArguments")

1180}

1181

1183

1184

1187 .getLinkage();

1188}

1189

1191

1196 return false;

1200 }

1201 llvm_unreachable("unexpected module ownership kind");

1202}

1203

1204

1205

1208

1209

1210

1211

1212

1213

1214

1215

1216

1222

1224}

1225

1229

1230static std::optional

1233 bool IsMostRecent) {

1235

1237 return {};

1238

1239

1240 if (std::optional V = getVisibilityOf(ND, kind))

1241 return V;

1242

1243

1244

1245 if (const auto *RD = dyn_cast(ND)) {

1247 if (InstantiatedFrom)

1249 }

1250

1251

1252

1253

1254 if (const auto *spec = dyn_cast(ND)) {

1255

1256

1258 while (TD != nullptr) {

1260 if (Vis != std::nullopt)

1261 return Vis;

1262 TD = TD->getPreviousDecl();

1263 }

1264 return std::nullopt;

1265 }

1266

1267

1270 if (MostRecent != ND)

1272 }

1273

1274 if (const auto *Var = dyn_cast(ND)) {

1275 if (Var->isStaticDataMember()) {

1277 if (InstantiatedFrom)

1279 }

1280

1281 if (const auto *VTSD = dyn_cast(Var))

1282 return getVisibilityOf(VTSD->getSpecializedTemplate()->getTemplatedDecl(),

1283 kind);

1284

1285 return std::nullopt;

1286 }

1287

1288 if (const auto *fn = dyn_cast(ND)) {

1289

1290

1293 return getVisibilityOf(templateInfo->getTemplate()->getTemplatedDecl(),

1294 kind);

1295

1296

1297

1299 if (InstantiatedFrom)

1301

1302 return std::nullopt;

1303 }

1304

1305

1306 if (const auto *TD = dyn_cast(ND))

1308

1309 return std::nullopt;

1310}

1311

1312std::optional

1316

1318 Decl *ContextDecl,

1320

1322 if (!ContextDecl)

1323 Owner = dyn_cast(DC);

1325 Owner =

1328

1329

1330 Owner = dyn_cast(ContextDecl->getDeclContext());

1331 } else {

1333 }

1334

1335 if (!Owner)

1337

1338

1339

1340

1341

1342 auto *VD = dyn_cast(Owner);

1343 LinkageInfo OwnerLV =

1345 ? computeLVForDecl(Owner, computation, true)

1347

1348

1349

1354}

1355

1358 if (const auto *Function = dyn_cast(D)) {

1359 if (Function->isInAnonymousNamespace() &&

1362

1363

1364 if (Function->getCanonicalDecl()->getStorageClass() == SC_Static)

1366

1367 LinkageInfo LV;

1369 if (std::optional Vis =

1372 }

1373

1374

1375

1376

1377

1378 return LV;

1379 }

1380

1381 if (const auto *Var = dyn_cast(D)) {

1382 if (Var->hasExternalStorage()) {

1385

1386 LinkageInfo LV;

1390 if (std::optional Vis =

1393 }

1394

1395 if (const VarDecl *Prev = Var->getPreviousDecl()) {

1396 LinkageInfo PrevLV = getLVForDecl(Prev, computation);

1400 }

1401

1402 return LV;

1403 }

1404

1405 if (!Var->isStaticLocal())

1407 }

1408

1412

1416

1417 LinkageInfo LV;

1418 if (const auto *BD = dyn_cast(OuterD)) {

1419 if (!BD->getBlockManglingNumber())

1421

1422 LV = getLVForClosure(BD->getDeclContext()->getRedeclContext(),

1423 BD->getBlockManglingContextDecl(), computation);

1424 } else {

1426 if (!FD->isInlined() &&

1429

1430

1431

1432

1436 !Context.getLangOpts().VisibilityInlinesHiddenStaticLocalVar) {

1438

1439

1440

1441 if (const auto *MD = dyn_cast(FD))

1442 LV = getLVForDecl(MD->getParent(), computation);

1446 ? Context.getLangOpts().getValueVisibilityMode()

1447 : Context.getLangOpts().getTypeVisibilityMode();

1449 false);

1450 }

1451 }

1452 }

1457}

1458

1461 bool IgnoreVarTypeLinkage) {

1462

1463 if (D->hasAttr())

1465

1466

1467

1469 default:

1470 break;

1471

1472

1473

1474

1475

1476

1477

1478 case Decl::ImplicitParam:

1479 case Decl::Label:

1480 case Decl::NamespaceAlias:

1481 case Decl::ParmVar:

1482 case Decl::Using:

1483 case Decl::UsingEnum:

1484 case Decl::UsingShadow:

1485 case Decl::UsingDirective:

1487

1488 case Decl::EnumConstant:

1489

1493

1494 case Decl::Typedef:

1495 case Decl::TypeAlias:

1496

1497

1499 ->getAnonDeclWithTypedefName(true))

1501 break;

1502

1503 case Decl::TemplateTemplateParm:

1504 case Decl::NonTypeTemplateParm:

1505 case Decl::ObjCAtDefsField:

1506 case Decl::ObjCCategory:

1507 case Decl::ObjCCategoryImpl:

1508 case Decl::ObjCCompatibleAlias:

1509 case Decl::ObjCImplementation:

1510 case Decl::ObjCMethod:

1511 case Decl::ObjCProperty:

1512 case Decl::ObjCPropertyImpl:

1513 case Decl::ObjCProtocol:

1515

1516 case Decl::CXXRecord: {

1518 if (Record->isLambda()) {

1519 if (Record->hasKnownLambdaInternalLinkage() ||

1520 Record->getLambdaManglingNumber()) {

1521

1523 }

1524

1525 return getLVForClosure(

1526 Record->getDeclContext()->getRedeclContext(),

1527 Record->getLambdaContextDecl(), computation);

1528 }

1529

1530 break;

1531 }

1532

1533 case Decl::TemplateParamObject: {

1534

1535

1537 LinkageInfo LV = getLVForType(*TPO->getType(), computation);

1538 LV.merge(getLVForValue(TPO->getValue(), computation));

1539 return LV;

1540 }

1541 }

1542

1543

1545 return getLVForNamespaceScopeDecl(D, computation, IgnoreVarTypeLinkage);

1546

1547

1548

1549

1550

1551

1552

1553

1555 return getLVForClassMember(D, computation, IgnoreVarTypeLinkage);

1556

1557

1558

1559

1560

1561

1562

1563

1564

1565

1566

1567

1569 return getLVForLocalDecl(D, computation);

1570

1571

1572

1574}

1575

1576

1579

1580 if (D->hasAttr())

1582

1585

1586 if (std::optional LI = lookup(D, computation))

1587 return *LI;

1588

1592

1594 cache(D, computation, LV);

1595

1596#ifndef NDEBUG

1597

1598

1599

1601 if (!Opts.CPlusPlus || Opts.MicrosoftExt)

1602 return LV;

1603

1604

1605

1606

1607

1608

1611 if (!AlreadyVisited.insert(D).second)

1612 break;

1614 continue;

1617 assert(LV.getLinkage() == OldLinkage);

1618 break;

1619 }

1620 }

1621#endif

1622

1623 return LV;

1624}

1625

1635

1638

1639

1640 return nullptr;

1641

1643 if (!M)

1644 return nullptr;

1645

1646 switch (M->Kind) {

1648

1649 return nullptr;

1650

1655 return M;

1656

1660

1661 return nullptr;

1662

1664

1665

1667 }

1668

1669 llvm_unreachable("unknown module kind");

1670}

1671

1673 Name.print(OS, Policy);

1674}

1675

1679

1681 std::string QualName;

1682 llvm::raw_string_ostream OS(QualName);

1684 return QualName;

1685}

1686

1690

1694

1696 return;

1697 }

1701 } else {

1702

1703

1705 llvm::raw_svector_ostream NameOS(NameBuffer);

1707 if (NameBuffer.empty())

1708 OS << "(anonymous)";

1709 else

1710 OS << NameBuffer;

1711 }

1712}

1713

1717

1721

1722

1723

1724 if (auto *MD = dyn_cast(this)) {

1725 if (auto *ID = MD->getClassInterface())

1726 Ctx = ID;

1727 } else if (auto *PD = dyn_cast(this)) {

1728 if (auto *MD = PD->getGetterMethodDecl())

1729 if (auto *ID = MD->getClassInterface())

1730 Ctx = ID;

1731 } else if (auto *ID = dyn_cast(this)) {

1732 if (auto *CI = ID->getContainingInterface())

1733 Ctx = CI;

1734 }

1735

1737 return;

1738

1740 ContextsTy Contexts;

1741

1742

1744 for (; Ctx; Ctx = Ctx->getParent()) {

1746 continue;

1747

1748

1751 continue;

1752

1753

1756 llvm::to_underlying(

1759 llvm::to_underlying(

1762 NameInScope))) {

1763 continue;

1764 }

1765 }

1766

1767

1769 continue;

1770

1771

1772 const NamedDecl *ND = dyn_cast(Ctx);

1773 if (!ND)

1774 continue;

1775

1776 Contexts.push_back(Ctx);

1778 }

1779

1780 for (const DeclContext *DC : llvm::reverse(Contexts)) {

1781 if (const auto *Spec = dyn_cast(DC)) {

1782 OS << Spec->getName();

1784 printTemplateArgumentList(

1785 OS, TemplateArgs.asArray(), P,

1786 Spec->getSpecializedTemplate()->getTemplateParameters());

1787 } else if (const auto *ND = dyn_cast(DC)) {

1788 if (ND->isAnonymousNamespace()) {

1790 : "(anonymous namespace)");

1791 }

1792 else

1793 OS << *ND;

1794 } else if (const auto *RD = dyn_cast(DC)) {

1795 if (TypedefNameDecl *TD = RD->getTypedefNameForAnonDecl())

1796 OS << *TD;

1797 else if (!RD->getIdentifier())

1798 OS << "(anonymous " << RD->getKindName() << ')';

1799 else

1800 OS << *RD;

1801 } else if (const auto *FD = dyn_cast(DC)) {

1803 if (FD->hasWrittenPrototype())

1804 FT = dyn_cast(FD->getType()->castAs<FunctionType>());

1805

1806 OS << *FD << '(';

1807 if (FT) {

1808 unsigned NumParams = FD->getNumParams();

1809 for (unsigned i = 0; i < NumParams; ++i) {

1810 if (i)

1811 OS << ", ";

1812 OS << FD->getParamDecl(i)->getType().stream(P);

1813 }

1814

1816 if (NumParams > 0)

1817 OS << ", ";

1818 OS << "...";

1819 }

1820 }

1821 OS << ')';

1822 } else if (const auto *ED = dyn_cast(DC)) {

1823

1824

1825

1826

1827

1828

1829

1830 if (ED->isScoped())

1831 OS << *ED;

1832 else

1833 continue;

1834 } else {

1835 OS << *cast(DC);

1836 }

1837 OS << "::";

1838 }

1839}

1840

1849

1855 switch (K) {

1856#define DECL(Type, Base) \

1857 case Decl::Type: \

1858 return isRedeclarableImpl((Type##Decl *)nullptr);

1859#define ABSTRACT_DECL(DECL)

1860#include "clang/AST/DeclNodes.inc"

1861 }

1862 llvm_unreachable("unknown decl kind");

1863}

1864

1866 bool IsKnownNewer) const {

1868

1869

1870

1872 return false;

1873

1874

1876 return false;

1877

1878

1880 return false;

1881

1882

1883

1885 return true;

1886

1887

1888

1889

1890 if (!this->getDeclContext()->getRedeclContext()->Equals(

1892 return false;

1893

1894

1895

1896 if (const auto *UD = dyn_cast(this))

1897 return UD->getQualifier().getCanonical() ==

1898

1900 if (const auto *UUVD = dyn_cast(this))

1901 return UUVD->getQualifier().getCanonical() ==

1903

1906 return false;

1907

1908 if (IsKnownNewer)

1909 return true;

1910

1911

1912

1913

1914 for (const auto *D : redecls()) {

1915 if (D == OldD)

1916 break;

1917

1918

1919

1920

1921

1923 return false;

1924 }

1925

1926

1927

1928 return true;

1929 }

1930

1931

1932

1933

1934 return false;

1935}

1936

1940 llvm_unreachable("Linkage hasn't been computed!");

1942 return false;

1944 return true;

1947 llvm_unreachable("Non-formal linkage is not allowed here!");

1950 return true;

1951 }

1952 llvm_unreachable("Unhandled Linkage enum");

1953}

1954

1955NamedDecl *NamedDecl::getUnderlyingDeclImpl() {

1957 if (auto *UD = dyn_cast(ND))

1958 ND = UD->getTargetDecl();

1959

1960 if (auto *AD = dyn_cast(ND))

1961 return AD->getClassInterface();

1962

1963 if (auto *AD = dyn_cast(ND))

1964 return AD->getNamespace();

1965

1966 return ND;

1967}

1968

1971 return false;

1972

1976

1978 return true;

1979 if (const auto *MD = dyn_cast_if_present(D->getAsFunction()))

1980 return MD->isInstance();

1981 return false;

1982}

1983

1984

1985

1986

1987

1988template

1990 if (decl->getNumTemplateParameterLists() > 0)

1991 return decl->getTemplateParameterList(0)->getTemplateLoc();

1992 return decl->getInnerLocStart();

1993}

1994

2000

2006

2008 if (QualifierLoc) {

2009

2010 if (!hasExtInfo()) {

2011

2013

2015

2016 getExtInfo()->TInfo = savedTInfo;

2017 }

2018

2019 getExtInfo()->QualifierLoc = QualifierLoc;

2020 } else if (hasExtInfo()) {

2021

2022 getExtInfo()->QualifierLoc = QualifierLoc;

2023 }

2024}

2025

2027 assert(AC);

2028

2029 if (!hasExtInfo()) {

2030

2032

2034

2035 getExtInfo()->TInfo = savedTInfo;

2036 }

2037

2038 getExtInfo()->TrailingRequiresClause = AC;

2039}

2040

2043 assert(!TPLists.empty());

2044

2045 if (!hasExtInfo()) {

2046

2048

2050

2051 getExtInfo()->TInfo = savedTInfo;

2052 }

2053

2054 getExtInfo()->setTemplateParameterListsInfo(Context, TPLists);

2055}

2056

2060

2061

2062

2064 while (true) {

2066 switch (T->getTypeClass()) {

2067 default:

2068 return false;

2069 case Type::Pointer:

2071 break;

2072 case Type::BlockPointer:

2074 break;

2075 case Type::MemberPointer:

2077 break;

2078 case Type::LValueReference:

2079 case Type::RValueReference:

2081 break;

2082 case Type::PackExpansion:

2084 break;

2085 case Type::Paren:

2086 case Type::ConstantArray:

2087 case Type::DependentSizedArray:

2088 case Type::IncompleteArray:

2089 case Type::VariableArray:

2090 case Type::FunctionProto:

2091 case Type::FunctionNoProto:

2092 return true;

2093 }

2094 }

2095}

2096

2100

2101

2103 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();

2104 }

2106}

2107

2110

2115 }

2116

2117 if (!TPLists.empty()) {

2121 }

2122}

2123

2124

2125

2126

2127

2129 switch (SC) {

2131 case SC_Auto: return "auto";

2132 case SC_Extern: return "extern";

2135 case SC_Static: return "static";

2136 }

2137

2138 llvm_unreachable("Invalid storage class");

2139}

2140

2145 : DeclaratorDecl(DK, DC, IdLoc, Id, T, TInfo, StartLoc),

2147 static_assert(sizeof(VarDeclBitfields) <= sizeof(unsigned),

2148 "VarDeclBitfields too large!");

2150 "ParmVarDeclBitfields too large!");

2152 "NonParmVarDeclBitfields too large!");

2155

2156}

2157

2161 return new (C, DC) VarDecl(Var, C, DC, StartL, IdL, Id, T, TInfo, S);

2162}

2163

2165 return new (C, ID)

2168}

2169

2174

2180 getASTContext().getTargetInfo().isTLSSupported() &&

2193 }

2194 llvm_unreachable("Unknown thread storage class specifier!");

2195}

2196

2207

2208template

2210

2211

2212 if (!D.hasExternalFormalLinkage())

2214

2215

2216

2217 if (!D.getASTContext().getLangOpts().CPlusPlus)

2219

2220

2221

2222

2223 const DeclContext *DC = D.getDeclContext();

2226

2227

2228

2229

2233}

2234

2235template

2237

2238

2239 const DeclContext *DC = D.getDeclContext();

2241 assert(D.getASTContext().getLangOpts().CPlusPlus);

2242 return false;

2243 }

2244

2246}

2247

2251

2255

2259

2263

2265

2270

2271

2272

2273

2274

2275

2276

2277

2278

2279

2280

2281

2282

2283

2289

2290

2291

2301 }

2302

2303

2304

2305

2306

2307

2308

2311

2314

2316 if (!SAA->isInherited())

2318

2319

2320

2321

2322 if (auto *VTSD = dyn_cast(this)) {

2325 !VTSD->IsCompleteDefinition)

2327 }

2328

2331

2332

2333

2334

2335

2338

2339

2340

2341

2342

2343

2346

2347

2348

2350}

2351

2355 return nullptr;

2356

2357 VarDecl *LastTentative = nullptr;

2358

2359

2362 Kind = Decl->isThisDeclarationADefinition();

2364 return nullptr;

2365

2367 LastTentative = Decl;

2368 }

2369

2370 return LastTentative;

2371}

2372

2375 for (auto *I : First->redecls()) {

2376 if (I->isThisDeclarationADefinition(C) == Definition)

2377 return I;

2378 }

2379 return nullptr;

2380}

2381

2384

2386 for (auto *I : First->redecls()) {

2387 Kind = std::max(Kind, I->isThisDeclarationADefinition(C));

2389 break;

2390 }

2391

2392 return Kind;

2393}

2394

2396 for (auto *I : redecls()) {

2397 if (auto Expr = I->getInit()) {

2398 D = I;

2399 return Expr;

2400 }

2401 }

2402 return nullptr;

2403}

2404

2406 if (auto *P = dyn_cast(this))

2407 if (P->hasUnparsedDefaultArg() || P->hasUninstantiatedDefaultArg())

2408 return false;

2409

2411 return Eval->Value.isValid();

2412

2413 return Init.isNull();

2414}

2415

2418 return nullptr;

2419

2420 if (auto *S = dyn_cast<Stmt *>(Init))

2422

2424

2426 Eval->Value.isOffset() ? getASTContext().getExternalSource() : nullptr));

2427}

2428

2431 return ES->Value.getAddressOfPointer(getASTContext().getExternalSource());

2432

2433 return Init.getAddrOfPtr1();

2434}

2435

2438 for (auto *I : redecls()) {

2439 if (I->hasInit())

2440 return I;

2441

2442 if (I->isThisDeclarationADefinition()) {

2444 return I;

2445 Def = I;

2446 }

2447 }

2448 return Def;

2449}

2450

2453 return false;

2454

2460

2464 }

2466}

2467

2470 return true;

2471

2473 return false;

2474

2475

2476

2477

2480

2481 return false;

2482}

2483

2485 if (auto *Eval = dyn_cast_if_present<EvaluatedStmt *>(Init)) {

2486 Eval->~EvaluatedStmt();

2488 }

2489

2491}

2492

2495

2496

2497

2498 if (!Lang.CPlusPlus && !Lang.OpenCL && !Lang.C23)

2499 return false;

2500

2501

2503 return false;

2504

2505

2507 return false;

2508

2509

2510

2511 if (Lang.CPlusPlus11 && getType()->isReferenceType())

2512 return true;

2513

2514

2515

2516

2517 if (getType().isConstant(C) || getType().isVolatileQualified())

2518 return false;

2519

2520

2521

2522 if (getType()->isIntegralOrEnumerationType() && !Lang.C23)

2523 return true;

2524

2525

2526

2527

2528

2529

2530

2531

2532 return (Lang.CPlusPlus11 || Lang.C23) && isConstexpr();

2533}

2534

2536

2537

2538

2539 const VarDecl *DefVD = nullptr;

2541 if (Init || Init->isValueDependent() || getType()->isDependentType())

2542 return false;

2543

2544

2546 return false;

2547

2548 if ((Context.getLangOpts().CPlusPlus || getLangOpts().C23) &&

2550 return false;

2551

2552

2553

2554

2555 if ((Context.getLangOpts().CPlusPlus || Context.getLangOpts().OpenCL) &&

2556 !Context.getLangOpts().CPlusPlus11 && !DefVD->hasICEInitializer(Context))

2557 return false;

2558 return true;

2559}

2560

2561

2562

2563

2565 auto *Eval = dyn_cast_if_present<EvaluatedStmt *>(Init);

2566 if (!Eval) {

2567

2568

2569

2570

2573 Init = Eval;

2574 }

2575 return Eval;

2576}

2577

2579 return dyn_cast_if_present<EvaluatedStmt *>(Init);

2580}

2581

2586

2588 bool IsConstantInitialization) const {

2590

2592 assert(Init->isValueDependent());

2593

2594

2595

2596

2599

2601

2602 return nullptr;

2603 }

2604

2606

2608 bool Result = Init->EvaluateAsInitializer(Eval->Evaluated, Ctx, this, Notes,

2609 IsConstantInitialization);

2610

2611

2612

2613

2614

2615 if (IsConstantInitialization &&

2618 !Notes.empty())

2619 Result = false;

2620

2621

2622

2623

2624 if (!Result)

2628

2631

2632 return Result ? &Eval->Evaluated : nullptr;

2633}

2634

2639

2640 return nullptr;

2641}

2642

2645 assert(Init && "no initializer");

2646

2650 Eval->HasICEInit = Init->isIntegerConstantExpr(Context);

2651 }

2653}

2654

2656

2657

2658

2661 return true;

2662

2663

2664

2667

2668 return false;

2669}

2670

2674

2675

2676

2678 "already evaluated var value before checking for constant init");

2681 "only meaningful in C++/C23");

2682

2683 assert(getInit()->isValueDependent());

2684

2685

2687 evaluateValueImpl(Notes, true) && Notes.empty();

2688

2689

2690

2693

2695}

2696

2697template

2699 assert(D);

2700 if (auto *Def = D->getDefinition())

2701 return Def;

2702 return D;

2703}

2704

2708

2712

2715 return T->isDependentType() || T->isUndeducedType() ||

2717 return AA->isAlignmentDependent();

2718 });

2719}

2720

2722 const VarDecl *VD = this;

2723

2724

2725

2730 VD = NewVD;

2731 }

2732 }

2733

2734

2735

2736 if (auto *VDTemplSpec = dyn_cast(VD)) {

2738 auto From = VDTemplSpec->getInstantiatedFrom();

2740 while (!VTD->isMemberSpecialization()) {

2741 auto *NewVTD = VTD->getInstantiatedFromMemberTemplate();

2742 if (!NewVTD)

2743 break;

2744 VTD = NewVTD;

2745 }

2747 }

2748 if (auto *VTPSD =

2750 while (!VTPSD->isMemberSpecialization()) {

2751 auto *NewVTPSD = VTPSD->getInstantiatedFromMember();

2752 if (!NewVTPSD)

2753 break;

2754 VTPSD = NewVTPSD;

2755 }

2757 }

2758 }

2759 }

2760

2761

2762

2764 while (VarTemplate->isMemberSpecialization()) {

2765 auto *NewVT = VarTemplate->getInstantiatedFromMemberTemplate();

2766 if (!NewVT)

2767 break;

2769 }

2770

2772 }

2773

2774 if (VD == this)

2775 return nullptr;

2777}

2778

2781 return cast(MSI->getInstantiatedFrom());

2782

2783 return nullptr;

2784}

2785

2787 if (const auto *Spec = dyn_cast(this))

2788 return Spec->getSpecializationKind();

2789

2791 return MSI->getTemplateSpecializationKind();

2792

2794}

2795

2799 return MSI->getTemplateSpecializationKind();

2800

2801 if (const auto *Spec = dyn_cast(this))

2802 return Spec->getSpecializationKind();

2803

2805}

2806

2808 if (const auto *Spec = dyn_cast(this))

2809 return Spec->getPointOfInstantiation();

2810

2812 return MSI->getPointOfInstantiation();

2813

2815}

2816

2818 return dyn_cast_if_present<VarTemplateDecl *>(

2819 getASTContext().getTemplateOrSpecializationInfo(this));

2820}

2821

2825

2828

2829

2830

2831

2832

2833

2834

2835 if (LangOpts.CUDA && !LangOpts.GPURelocatableDeviceCode &&

2838 return true;

2839

2841}

2842

2845 return false;

2847 return true;

2849 return false;

2850

2852 RSDKind K = Ctx.getLangOpts().getRegisterStaticDestructors();

2853 return K == RSDKind::None ||

2855}

2856

2868

2870 assert(hasInit() && "Expect initializer to check for flexible array init");

2872 if (!D || !D->hasFlexibleArrayMember())

2873 return false;

2874 auto *List = dyn_cast(getInit()->IgnoreParens());

2875 if (!List)

2876 return false;

2877 const Expr *FlexibleInit = List->getInit(List->getNumInits() - 1);

2879 if (!InitTy)

2880 return false;

2882}

2883

2885 assert(hasInit() && "Expect initializer to check for flexible array init");

2887 if (!RD || !RD->hasFlexibleArrayMember())

2889 auto *List = dyn_cast(getInit()->IgnoreParens());

2890 if (!List || List->getNumInits() == 0)

2892 const Expr *FlexibleInit = List->getInit(List->getNumInits() - 1);

2894 if (!InitTy)

2900 if (FlexibleArrayOffset + FlexibleArraySize < RL.getSize())

2902 return FlexibleArrayOffset + FlexibleArraySize - RL.getSize();

2903}

2904

2907

2908

2909 return dyn_cast_if_present<MemberSpecializationInfo *>(

2910 getASTContext().getTemplateOrSpecializationInfo(this));

2911 return nullptr;

2912}

2913

2918 "not a variable or static data member template specialization");

2919

2921 dyn_cast(this)) {

2922 Spec->setSpecializationKind(TSK);

2924 PointOfInstantiation.isValid() &&

2925 Spec->getPointOfInstantiation().isInvalid()) {

2926 Spec->setPointOfInstantiation(PointOfInstantiation);

2928 L->InstantiationRequested(this);

2929 }

2931 MSI->setTemplateSpecializationKind(TSK);

2933 MSI->getPointOfInstantiation().isInvalid()) {

2934 MSI->setPointOfInstantiation(PointOfInstantiation);

2936 L->InstantiationRequested(this);

2937 }

2938 }

2939}

2940

2941void

2944 assert(getASTContext().getTemplateOrSpecializationInfo(this).isNull() &&

2945 "Previous template or instantiation?");

2947}

2948

2949

2950

2951

2952

2957 Expr *DefArg) {

2958 return new (C, DC) ParmVarDecl(ParmVar, C, DC, StartLoc, IdLoc, Id, T, TInfo,

2959 S, DefArg);

2960}

2961

2965 if (const auto *DT = dyn_cast(T))

2966 return DT->getOriginalType();

2967 return T;

2968}

2969

2971 return new (C, ID)

2974}

2975

2981 }

2982

2983

2984

2987

2989}

2990

2992

2995

2996

2997

2999 if (RT && RT->getDecl()->getDefinitionOrSelf()->isParamDestroyedInCallee() &&

3000 getType().isDestructedType())

3001 return true;

3002

3003 return false;

3004}

3005

3009 "Default argument is not yet instantiated!");

3010

3012 if (auto *E = dyn_cast_if_present(Arg))

3013 return E->getSubExpr();

3014

3015 return Arg;

3016}

3017

3020 Init = defarg;

3021}

3022

3027

3029

3032

3035 return E->getSourceRange();

3036

3037

3039 }

3040 llvm_unreachable("Invalid default argument kind.");

3041}

3042

3047

3050 "Wrong kind of initialization expression!");

3052}

3053

3055

3056

3057

3059 Init.isNull();

3060}

3061

3062void ParmVarDecl::setParameterIndexLarge(unsigned parameterIndex) {

3064 ParmVarDeclBits.ParameterIndex = ParameterIndexSentinel;

3065}

3066

3067unsigned ParmVarDecl::getParameterIndexLarge() const {

3069}

3070

3071

3072

3073

3074

3083 StartLoc),

3085 EndRangeLoc(NameInfo.getEndLoc()), DNLoc(NameInfo.getInfo()) {

3086 assert(T.isNull() || T->isFunctionType());

3104 FunctionDeclBits.ConstexprKind = static_cast<uint64_t>(ConstexprKind);

3105 FunctionDeclBits.BodyContainsImmediateEscalatingExpression = false;

3115 FunctionDeclBits.FriendConstraintRefersToEnclosingTemplate = false;

3116

3117 if (TrailingRequiresClause)

3119}

3120

3125 if (TemplateArgs)

3126 printTemplateArgumentList(OS, TemplateArgs->asArray(), Policy);

3127}

3128

3130 if (const auto *FT = getType()->getAs())

3131 return FT->isVariadic();

3132 return false;

3133}

3134

3139 static constexpr size_t Alignment =

3142 size_t Size = totalSizeToAlloc<DeclAccessPair, StringLiteral *>(

3143 Lookups.size(), DeletedMessage != nullptr);

3144

3147 Info->NumLookups = Lookups.size();

3148 Info->HasDeletedMessage = DeletedMessage != nullptr;

3149

3150 llvm::uninitialized_copy(Lookups, Info->getTrailingObjects<DeclAccessPair>());

3151 if (DeletedMessage)

3152 *Info->getTrailingObjects<StringLiteral *>() = DeletedMessage;

3153 return Info;

3154}

3155

3158 assert(FunctionDeclBits.HasDefaultedOrDeletedInfo && "already have this");

3159 assert(Body && "can't replace function body with defaulted function info");

3160

3163}

3164

3167

3168 if (Message) {

3172 else

3175 }

3176}

3177

3180

3181

3182

3183

3184 assert(HasDeletedMessage &&

3185 "No space to store a delete message in this DefaultedOrDeletedInfo");

3186 *getTrailingObjects<StringLiteral *>() = Message;

3187}

3188

3194

3196 for (const auto *I : redecls()) {

3197 if (I->doesThisDeclarationHaveABody()) {

3199 return true;

3200 }

3201 }

3202

3203 return false;

3204}

3205

3208 if (!S) {

3209

3210

3211 return false;

3212 }

3213

3215 return true;

3216 return false;

3217}

3218

3221 return false;

3222

3223

3224

3227 return InstantiatedFrom->getFriendObjectKind() &&

3228 InstantiatedFrom->isThisDeclarationADefinition();

3229

3230

3231

3234 Template->getInstantiatedFromMemberTemplate())

3235 return InstantiatedFrom->getFriendObjectKind() &&

3236 InstantiatedFrom->isThisDeclarationADefinition();

3237 }

3238

3239 return false;

3240}

3241

3243 bool CheckForPendingFriendDefinition) const {

3245 if (FD->isThisDeclarationADefinition()) {

3247 return true;

3248 }

3249

3250

3251

3252

3253

3254

3255

3256

3257

3258

3259

3260

3261

3262

3263

3264

3265 if (CheckForPendingFriendDefinition &&

3266 FD->isThisDeclarationInstantiatedFromAFriendDefinition()) {

3268 return true;

3269 }

3270 }

3271

3272 return false;

3273}

3274

3277 return nullptr;

3278

3279 assert(Definition->FunctionDeclBits.HasDefaultedOrDeletedInfo &&

3280 "definition should not have a body");

3283

3284 return nullptr;

3285}

3286

3293

3296 if (P)

3297 if (auto *Parent = dyn_cast(getDeclContext()))

3298 Parent->markedVirtualFunctionPure();

3299}

3300

3301template<std::size_t Len>

3304 return II && II->isStr(Str);

3305}

3306

3308

3309

3310

3311

3313 return true;

3314

3315

3317 return true;

3318

3319 if (auto *CD = dyn_cast(this);

3320 CD && CD->isInheritingConstructor())

3321 return CD->getInheritedConstructor().getConstructor();

3322

3323

3325 return false;

3326

3327

3328

3332 return true;

3333 return false;

3334}

3335

3337

3338

3339

3341 return true;

3342

3343

3345 return true;

3346

3347 if (auto *CD = dyn_cast(this);

3348 CD && CD->isInheritingConstructor())

3349 return CD->getInheritedConstructor()

3350 .getConstructor()

3351 ->isImmediateFunction();

3352

3355 return true;

3356

3357 if (const auto *MD = dyn_cast(this);

3358 MD && MD->isLambdaStaticInvoker())

3359 return MD->getParent()->getLambdaCallOperator()->isImmediateFunction();

3360

3361 return false;

3362}

3363

3370

3374 if (!TUnit)

3375 return false;

3376

3377

3378

3379

3380

3383 return false;

3384

3385

3387 return false;

3388

3389 return llvm::StringSwitch(getName())

3390 .Cases({"main",

3391 "wmain",

3392 "WinMain",

3393 "wWinMain",

3394 "DllMain"},

3395 true)

3397}

3398

3400 if (getDeclName().isAnyOperatorNewOrDelete())

3401 return false;

3402

3404 return false;

3405

3407 return false;

3408

3410 if (proto->getNumParams() != 2 || proto->isVariadic())

3411 return false;

3412

3415 ->getASTContext();

3416

3417

3418

3419 return (proto->getParamType(1).getCanonicalType() == Context.VoidPtrTy);

3420}

3421

3423 UnsignedOrNone *AlignmentParam, bool *IsNothrow) const {

3424 if (getDeclName().isAnyOperatorNewOrDelete())

3425 return false;

3426

3428 return false;

3429

3430

3432 return false;

3433

3435 return false;

3436

3439 unsigned RequiredParameterCount =

3442 if (AlignmentParam)

3443 *AlignmentParam =

3444 1U + IsDelete + 1U;

3445 if (RequiredParameterCount == getNumParams())

3446 return true;

3447 if (getNumParams() > RequiredParameterCount + 1)

3448 return false;

3450 return false;

3451

3452 if (IsNothrow)

3453 *IsNothrow = true;

3454 return true;

3455 }

3456

3458 if (FPT->getNumParams() == 0 || FPT->getNumParams() > 4)

3459 return false;

3460

3461

3462

3463 if (FPT->getNumParams() == 1)

3464 return true;

3465

3466 unsigned Params = 1;

3467 QualType Ty = FPT->getParamType(Params);

3469

3470 auto Consume = [&] {

3471 ++Params;

3472 Ty = Params < FPT->getNumParams() ? FPT->getParamType(Params) : QualType();

3473 };

3474

3475

3476 bool IsSizedDelete = false;

3477 if (Ctx.getLangOpts().SizedDeallocation &&

3480 IsSizedDelete = true;

3481 Consume();

3482 }

3483

3484

3485

3487 Consume();

3488 if (AlignmentParam)

3489 *AlignmentParam = Params;

3490 }

3491

3492

3493

3497 return false;

3499 if (IsNothrow)

3500 *IsNothrow = true;

3501 Consume();

3502 }

3503 }

3504

3505

3506

3507

3508

3511 while (const auto *TD = T->getAs<TypedefType>())

3512 T = TD->getDecl()->getUnderlyingType();

3514 T->castAsCanonical()->getDecl()->getIdentifier();

3515 if (II && II->isStr("__hot_cold_t"))

3516 Consume();

3517 }

3518

3519 return Params == FPT->getNumParams();

3520}

3521

3524 return false;

3525

3528 return false;

3529

3530 if (Definition->isInlineSpecified() ||

3531 Definition->hasAttr())

3532 return false;

3533

3535 switch (Context.GetGVALinkageForFunction(Definition)) {

3539 return false;

3542 return true;

3543 }

3544 llvm_unreachable("Unknown GVALinkage");

3545}

3546

3550

3554

3558

3562

3565

3566

3567 assert(getDeclName().isAnyOperatorDelete());

3568 if (getDeclName().isAnyOperatorDelete())

3569 return Params;

3570

3573

3576 assert(AI != AE);

3577 ++AI;

3578 }

3579

3580

3581

3582

3583 ++AI;

3584

3585

3589 assert(AI != AE);

3590 ++AI;

3591 }

3592

3593

3595 Params.Size = true;

3596 ++AI;

3597 } else

3599

3602 ++AI;

3603 } else

3605

3606 assert(AI == AE && "unexpected usual deallocation function parameter");

3607 return Params;

3608}

3609

3613

3617

3623

3627

3629 if (const auto *Method = dyn_cast(this))

3630 return Method->isStatic();

3631

3633 return false;

3634

3639 if (!Namespace->getDeclName())

3640 return false;

3641 }

3642 }

3643

3644 return true;

3645}

3646

3650 return true;

3651

3652 if (auto *FnTy = getType()->getAs())

3653 return FnTy->getNoReturnAttr();

3654

3655 return false;

3656}

3657

3661

3663

3664

3665

3666

3667

3668

3669

3671 return false;

3672 }

3673

3675

3676

3677

3679 }

3680

3682}

3683

3697

3701

3705

3710

3719

3723

3727

3728void

3731

3735 assert((!PrevDecl || PrevFunTmpl) && "Function/function template mismatch");

3736 FunTmpl->setPreviousDecl(PrevFunTmpl);

3737 }

3738

3739 if (PrevDecl && PrevDecl->isInlined())

3741}

3742

3744

3745

3746

3747

3748

3749

3750

3751

3752

3753

3754

3755

3756

3757

3759 unsigned BuiltinID = 0;

3760

3762 BuiltinID = ABAA->getBuiltinName()->getBuiltinID();

3764 BuiltinID = BAA->getBuiltinName()->getBuiltinID();

3766 BuiltinID = A->getID();

3767 }

3768

3769 if (!BuiltinID)

3770 return 0;

3771

3772

3773

3776 return 0;

3777

3779 BuiltinID == Builtin::BI__builtin_counted_by_ref)

3780 return 0;

3781

3783 if (!Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))

3784 return BuiltinID;

3785

3786

3787

3788

3789

3790

3792 return 0;

3793

3794

3795

3796 if (Context.getLangOpts().OpenCL &&

3797 Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))

3798 return 0;

3799

3800

3801

3804 !(BuiltinID == Builtin::BIprintf || BuiltinID == Builtin::BImalloc))

3805 return 0;

3806

3807

3808

3809

3810 if (Context.getTargetInfo().getTriple().isAMDGCN() &&

3811 Context.getLangOpts().OpenMPIsTargetDevice &&

3812 Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID) &&

3813 !(BuiltinID == Builtin::BIprintf || BuiltinID == Builtin::BImalloc))

3814 return 0;

3815

3816 return BuiltinID;

3817}

3818

3819

3820

3821

3826

3827void FunctionDecl::setParams(ASTContext &C,

3829 assert(!ParamInfo && "Already has param info!");

3830 assert(NewParamInfo.size() == getNumParams() && "Parameter count mismatch!");

3831

3832

3833 if (!NewParamInfo.empty()) {

3834 ParamInfo = new (C) ParmVarDecl*[NewParamInfo.size()];

3835 llvm::copy(NewParamInfo, ParamInfo);

3836 }

3837}

3838

3839

3840

3841

3842

3846

3847

3848

3849 unsigned NumRequiredArgs = 0;

3850 unsigned MinParamsSoFar = 0;

3852 if (!Param->isParameterPack()) {

3853 ++MinParamsSoFar;

3854 if (!Param->hasDefaultArg())

3855 NumRequiredArgs = MinParamsSoFar;

3856 }

3857 }

3858 return NumRequiredArgs;

3859}

3860

3864

3869

3874

3878 llvm::all_of(llvm::drop_begin(parameters()),

3880}

3881

3882

3883

3884

3885

3886

3888 assert(isInlined() && "expected to get called on an inlined function!");

3889

3891 if (!Context.getTargetInfo().getCXXABI().isMicrosoft() &&

3893 return false;

3894

3897 if (!FD->isImplicit() && FD->getStorageClass() == SC_Extern)

3898 return true;

3899

3900 return false;

3901}

3902

3905 return false;

3906

3909 if (!FD->isImplicit() && FD->getStorageClass() == SC_Extern)

3910 return false;

3911

3912 return true;

3913}

3914

3916

3918 return false;

3919

3920

3921

3923 return false;

3924

3926 return true;

3927

3928 return false;

3929}

3930

3931

3932

3933

3934

3935

3936

3939 "Must have a declaration without a body.");

3940

3942

3943 if (Context.getLangOpts().MSVCCompat) {

3947 return true;

3948 }

3949

3950 if (Context.getLangOpts().CPlusPlus)

3951 return false;

3952

3954

3955

3956

3957

3958

3960 return false;

3961

3963 bool FoundBody = false;

3966

3968

3969

3972 return false;

3975 return false;

3976 }

3977 }

3978 return FoundBody;

3979 }

3980

3981

3982

3983

3984

3986 return false;

3988 bool FoundBody = false;

3992 return false;

3993 }

3994 return FoundBody;

3995}

3996

3999

4000 if (!TSI)

4002

4005

4008 TL = PTL.getInnerLoc();

4010 TL = ATL.getEquivalentTypeLoc();

4012 TL = MQTL.getInnerLoc();

4013 else

4014 break;

4015 }

4016

4017 return FTL;

4018}

4019

4022 if (!FTL)

4024

4025

4030 SM.isBeforeInTranslationUnit(RTRange.getEnd(), Boundary))

4032

4033 return RTRange;

4034}

4035

4039

4040 if (NP == 0 && EllipsisLoc.isInvalid())

4042

4044 NP > 0 ? ParamInfo[0]->getSourceRange().getBegin() : EllipsisLoc;

4046 ? EllipsisLoc

4047 : ParamInfo[NP - 1]->getSourceRange().getEnd();

4048

4050}

4051

4056

4057

4058

4059

4060

4061

4062

4063

4064

4065

4066

4067

4068

4069

4070

4071

4072

4073

4077 "Must be a function definition");

4078 assert(isInlined() && "Function must be inline");

4080

4082

4083

4084

4085

4086

4087

4088 if (Context.getLangOpts().CPlusPlus)

4089 return false;

4091 return true;

4092

4093

4094

4095 for (auto *Redecl : redecls()) {

4096 if (Redecl->isInlineSpecified() &&

4097 Redecl->getStorageClass() != SC_Extern)

4098 return true;

4099 }

4100

4101 return false;

4102 }

4103

4104

4105 assert(!Context.getLangOpts().CPlusPlus &&

4106 "should not use C inline rules in C++");

4107

4108

4109

4110

4111

4112 for (auto *Redecl : redecls()) {

4114 return true;

4115 }

4116

4117

4118

4119

4120

4121 return false;

4122}

4123

4124

4125

4131

4132

4133

4137 return nullptr;

4138}

4139

4141 if (TemplateOrSpecialization.isNull())

4143 if (const auto *ND = dyn_cast<NamedDecl *>(TemplateOrSpecialization)) {

4147 "No other valid types in NamedDecl");

4149 }

4155 TemplateOrSpecialization))

4157

4158 llvm_unreachable("Did we miss a TemplateOrSpecialization type?");

4159}

4160

4164

4165 return nullptr;

4166}

4167

4169 if (auto *MSI = dyn_cast_if_present<MemberSpecializationInfo *>(

4170 TemplateOrSpecialization))

4171 return MSI;

4172 if (auto *FTSI = dyn_cast_if_present<FunctionTemplateSpecializationInfo *>(

4173 TemplateOrSpecialization))

4174 return FTSI->getMemberSpecializationInfo();

4175 return nullptr;

4176}

4177

4178void

4179FunctionDecl::setInstantiationOfMemberFunction(ASTContext &C,

4182 assert(TemplateOrSpecialization.isNull() &&

4183 "Member function is already a specialization");

4186 TemplateOrSpecialization = Info;

4187}

4188

4190 return dyn_cast_if_present(

4191 dyn_cast_if_present<NamedDecl *>(TemplateOrSpecialization));

4192}

4193

4196 assert(TemplateOrSpecialization.isNull() &&

4197 "Member function is already a specialization");

4198 TemplateOrSpecialization = Template;

4199}

4200

4204 TemplateOrSpecialization);

4205}

4206

4208 assert(TemplateOrSpecialization.isNull() &&

4209 "Function is already a specialization");

4210 TemplateOrSpecialization = FD;

4211}

4212

4214 return dyn_cast_if_present(

4215 TemplateOrSpecialization.dyn_cast<NamedDecl *>());

4216}

4217

4219

4221 return false;

4222

4227 return false;

4228

4230 return true;

4231

4233

4234 break;

4235 }

4236

4237

4239 bool HasPattern = false;

4240 if (PatternDecl)

4241 HasPattern = PatternDecl->hasBody(PatternDecl);

4242

4243

4244

4245

4246

4247 if (!HasPattern || !PatternDecl)

4248 return true;

4249

4250 return PatternDecl->isInlined();

4251}

4252

4258

4261

4262

4263

4264

4265

4266

4267

4268

4269

4271 dyn_cast(this))) {

4272 assert(getPrimaryTemplate() && "not a generic lambda call operator?");

4274 }

4275

4276

4277

4279 if (isDefined(FD, true))

4280 FD = this;

4281

4283 if (ForDefinition &&

4285 return nullptr;

4287 }

4288

4289 if (ForDefinition &&

4291 return nullptr;

4292

4294

4295

4296 while (!ForDefinition || !Primary->isMemberSpecialization()) {

4297 auto *NewPrimary = Primary->getInstantiatedFromMemberTemplate();

4298 if (!NewPrimary)

4299 break;

4300 Primary = NewPrimary;

4301 }

4302

4304 }

4305

4306 return nullptr;

4307}

4308

4311 dyn_cast_if_present<FunctionTemplateSpecializationInfo *>(

4312 TemplateOrSpecialization)) {

4313 return Info->getTemplate();

4314 }

4315 return nullptr;

4316}

4317

4320 return dyn_cast_if_present<FunctionTemplateSpecializationInfo *>(

4321 TemplateOrSpecialization);

4322}

4323

4327 dyn_cast_if_present<FunctionTemplateSpecializationInfo *>(

4328 TemplateOrSpecialization)) {

4329 return Info->TemplateArguments;

4330 }

4331 return nullptr;

4332}

4333

4337 dyn_cast_if_present<FunctionTemplateSpecializationInfo *>(

4338 TemplateOrSpecialization)) {

4339 return Info->TemplateArgumentsAsWritten;

4340 }

4342 dyn_cast_if_present<DependentFunctionTemplateSpecializationInfo *>(

4343 TemplateOrSpecialization)) {

4344 return Info->TemplateArgumentsAsWritten;

4345 }

4346 return nullptr;

4347}

4348

4349void FunctionDecl::setFunctionTemplateSpecialization(

4355 assert((TemplateOrSpecialization.isNull() ||

4357 "Member function is already a specialization");

4359 "Must specify the type of function template specialization");

4360 assert((TemplateOrSpecialization.isNull() ||

4363 "Member specialization must be an explicit specialization");

4366 C, this, Template, TSK, TemplateArgs, TemplateArgsAsWritten,

4367 PointOfInstantiation,

4368 dyn_cast_if_present<MemberSpecializationInfo *>(

4369 TemplateOrSpecialization));

4370 TemplateOrSpecialization = Info;

4371 Template->addSpecialization(Info, InsertPos);

4372}

4373

4377 assert(TemplateOrSpecialization.isNull());

4380 TemplateArgs);

4381 TemplateOrSpecialization = Info;

4382}

4383

4386 return dyn_cast_if_present<DependentFunctionTemplateSpecializationInfo *>(

4387 TemplateOrSpecialization);

4388}

4389

4394 const auto *TArgsWritten =

4396 return new (Context.Allocate(

4397 totalSizeToAlloc<FunctionTemplateDecl *>(Candidates.size())))

4398 DependentFunctionTemplateSpecializationInfo(Candidates, TArgsWritten);

4399}

4400

4401DependentFunctionTemplateSpecializationInfo::

4402 DependentFunctionTemplateSpecializationInfo(

4405 : NumCandidates(Candidates.size()),

4406 TemplateArgumentsAsWritten(TemplateArgsWritten) {

4407 std::transform(Candidates.begin(), Candidates.end(), getTrailingObjects(),

4410 });

4411}

4412

4414

4415

4417 dyn_cast_if_present<FunctionTemplateSpecializationInfo *>(

4418 TemplateOrSpecialization))

4419 return FTSInfo->getTemplateSpecializationKind();

4420

4422 dyn_cast_if_present<MemberSpecializationInfo *>(

4423 TemplateOrSpecialization))

4424 return MSInfo->getTemplateSpecializationKind();

4425

4426

4427

4429 TemplateOrSpecialization) &&

4432

4434}

4435

4438

4439

4440

4441

4442

4443

4444

4445

4446

4447

4448

4449

4450

4451

4452

4453

4454

4455

4456

4457

4458

4459

4461 dyn_cast_if_present<FunctionTemplateSpecializationInfo *>(

4462 TemplateOrSpecialization)) {

4463 if (auto *MSInfo = FTSInfo->getMemberSpecializationInfo())

4464 return MSInfo->getTemplateSpecializationKind();

4465 return FTSInfo->getTemplateSpecializationKind();

4466 }

4467

4469 dyn_cast_if_present<MemberSpecializationInfo *>(

4470 TemplateOrSpecialization))

4471 return MSInfo->getTemplateSpecializationKind();

4472

4474 TemplateOrSpecialization) &&

4477

4479}

4480

4481void

4485 dyn_cast<FunctionTemplateSpecializationInfo *>(

4486 TemplateOrSpecialization)) {

4487 FTSInfo->setTemplateSpecializationKind(TSK);

4489 PointOfInstantiation.isValid() &&

4490 FTSInfo->getPointOfInstantiation().isInvalid()) {

4491 FTSInfo->setPointOfInstantiation(PointOfInstantiation);

4493 L->InstantiationRequested(this);

4494 }

4496 dyn_cast<MemberSpecializationInfo *>(

4497 TemplateOrSpecialization)) {

4498 MSInfo->setTemplateSpecializationKind(TSK);

4500 PointOfInstantiation.isValid() &&

4501 MSInfo->getPointOfInstantiation().isInvalid()) {

4502 MSInfo->setPointOfInstantiation(PointOfInstantiation);

4504 L->InstantiationRequested(this);

4505 }

4506 } else

4507 llvm_unreachable("Function cannot have a template specialization kind");

4508}

4509

4512 = TemplateOrSpecialization.dyn_cast<

4514 return FTSInfo->getPointOfInstantiation();

4517 return MSInfo->getPointOfInstantiation();

4518

4520}

4521

4524 return true;

4525

4526

4527

4532 }

4533

4534

4535

4538 if (FunTmpl->getTemplatedDecl()->hasBody(Definition))

4540 }

4541

4542 return false;

4543}

4544

4548

4551

4552 if (!FnInfo)

4553 return 0;

4554

4555

4557 case Builtin::BI__builtin_memset:

4558 case Builtin::BI__builtin___memset_chk:

4559 case Builtin::BImemset:

4560 return Builtin::BImemset;

4561

4562 case Builtin::BI__builtin_memcpy:

4563 case Builtin::BI__builtin___memcpy_chk:

4564 case Builtin::BImemcpy:

4565 return Builtin::BImemcpy;

4566

4567 case Builtin::BI__builtin_mempcpy:

4568 case Builtin::BI__builtin___mempcpy_chk:

4569 case Builtin::BImempcpy:

4570 return Builtin::BImempcpy;

4571

4572 case Builtin::BI__builtin_trivially_relocate:

4573 case Builtin::BI__builtin_memmove:

4574 case Builtin::BI__builtin___memmove_chk:

4575 case Builtin::BImemmove:

4576 return Builtin::BImemmove;

4577

4578 case Builtin::BIstrlcpy:

4579 case Builtin::BI__builtin___strlcpy_chk:

4580 return Builtin::BIstrlcpy;

4581

4582 case Builtin::BIstrlcat:

4583 case Builtin::BI__builtin___strlcat_chk:

4584 return Builtin::BIstrlcat;

4585

4586 case Builtin::BI__builtin_memcmp:

4587 case Builtin::BImemcmp:

4588 return Builtin::BImemcmp;

4589

4590 case Builtin::BI__builtin_bcmp:

4591 case Builtin::BIbcmp:

4592 return Builtin::BIbcmp;

4593

4594 case Builtin::BI__builtin_strncpy:

4595 case Builtin::BI__builtin___strncpy_chk:

4596 case Builtin::BIstrncpy:

4597 return Builtin::BIstrncpy;

4598

4599 case Builtin::BI__builtin_strncmp:

4600 case Builtin::BIstrncmp:

4601 return Builtin::BIstrncmp;

4602

4603 case Builtin::BI__builtin_strncasecmp:

4604 case Builtin::BIstrncasecmp:

4605 return Builtin::BIstrncasecmp;

4606

4607 case Builtin::BI__builtin_strncat:

4608 case Builtin::BI__builtin___strncat_chk:

4609 case Builtin::BIstrncat:

4610 return Builtin::BIstrncat;

4611

4612 case Builtin::BI__builtin_strndup:

4613 case Builtin::BIstrndup:

4614 return Builtin::BIstrndup;

4615

4616 case Builtin::BI__builtin_strlen:

4617 case Builtin::BIstrlen:

4618 return Builtin::BIstrlen;

4619

4620 case Builtin::BI__builtin_bzero:

4621 case Builtin::BIbzero:

4622 return Builtin::BIbzero;

4623

4624 case Builtin::BI__builtin_bcopy:

4625 case Builtin::BIbcopy:

4626 return Builtin::BIbcopy;

4627

4628 case Builtin::BIfree:

4629 return Builtin::BIfree;

4630

4631 default:

4633 if (FnInfo->isStr("memset"))

4634 return Builtin::BImemset;

4635 if (FnInfo->isStr("memcpy"))

4636 return Builtin::BImemcpy;

4637 if (FnInfo->isStr("mempcpy"))

4638 return Builtin::BImempcpy;

4639 if (FnInfo->isStr("memmove"))

4640 return Builtin::BImemmove;

4641 if (FnInfo->isStr("memcmp"))

4642 return Builtin::BImemcmp;

4643 if (FnInfo->isStr("bcmp"))

4644 return Builtin::BIbcmp;

4645 if (FnInfo->isStr("strncpy"))

4646 return Builtin::BIstrncpy;

4647 if (FnInfo->isStr("strncmp"))

4648 return Builtin::BIstrncmp;

4649 if (FnInfo->isStr("strncasecmp"))

4650 return Builtin::BIstrncasecmp;

4651 if (FnInfo->isStr("strncat"))

4652 return Builtin::BIstrncat;

4653 if (FnInfo->isStr("strndup"))

4654 return Builtin::BIstrndup;

4655 if (FnInfo->isStr("strlen"))

4656 return Builtin::BIstrlen;

4657 if (FnInfo->isStr("bzero"))

4658 return Builtin::BIbzero;

4659 if (FnInfo->isStr("bcopy"))

4660 return Builtin::BIbcopy;

4662 if (FnInfo->isStr("free"))

4663 return Builtin::BIfree;

4664 }

4665 break;

4666 }

4667 return 0;

4668}

4669

4671 assert(hasODRHash());

4672 return ODRHash;

4673}

4674

4676 if (hasODRHash())

4677 return ODRHash;

4678

4680 setHasODRHash(true);

4681 ODRHash = FT->getODRHash();

4682 return ODRHash;

4683 }

4684

4685 class ODRHash Hash;

4687 setHasODRHash(true);

4689 return ODRHash;

4690}

4691

4692

4693

4694

4695

4701 return new (C, DC) FieldDecl(Decl::Field, DC, StartLoc, IdLoc, Id, T, TInfo,

4702 BW, Mutable, InitStyle);

4703}

4704

4710

4713 return false;

4714

4715 if (const auto *Record = getType()->getAsCanonical())

4716 return Record->getDecl()->isAnonymousStructOrUnion();

4717

4718 return false;

4719}

4720

4723 return nullptr;

4724

4726 return cast_if_present(

4728 : InitPtr.get(nullptr));

4729}

4730

4734

4735void FieldDecl::setLazyInClassInitializer(LazyDeclStmtPtr NewInit) {

4737 if (BitField)

4739 else

4740 Init = NewInit;

4741}

4742

4744 const auto *CE = dyn_cast_if_present(getBitWidth());

4745 return CE && CE->getAPValueResult().isInt();

4746}

4747

4749 assert(isBitField() && "not a bitfield");

4752 ->getAPValueResult()

4753 .getInt()

4754 .getZExtValue();

4755}

4756

4761

4764 return true;

4765

4766

4767

4768

4770 return false;

4771

4772

4774 if (!RT)

4775 return false;

4777 if (!RD) {

4778 assert(isInvalidDecl() && "valid field has incomplete type");

4779 return false;

4780 }

4781

4782

4783

4785 if (!CXXRD->isEmpty())

4786 return false;

4787

4788

4789

4791 return true;

4792

4793

4794

4795 return !llvm::any_of(CXXRD->fields(), [](const FieldDecl *Field) {

4796 return Field->getType()->isRecordType();

4797 });

4798}

4799

4803

4804void FieldDecl::setCachedFieldIndex() const {

4806 "should be called on the canonical decl");

4807

4808 unsigned Index = 0;

4810 assert(RD && "requested index for field of struct with no definition");

4811

4812 for (auto *Field : RD->fields()) {

4813 Field->getCanonicalDecl()->CachedFieldIndex = Index + 1;

4814 assert(Field->getCanonicalDecl()->CachedFieldIndex == Index + 1 &&

4815 "overflow in field numbering");

4816 ++Index;

4817 }

4818

4819 assert(CachedFieldIndex && "failed to find field in parent");

4820}

4821

4824 if (!FinalExpr)

4826 if (FinalExpr)

4829}

4830

4832 assert((getParent()->isLambda() || getParent()->isCapturedRecord()) &&

4833 "capturing type in non-lambda or captured record.");

4834 assert(StorageKind == ISK_NoInit && !BitField &&

4835 "bit-field or field with default member initializer cannot capture "

4836 "VLA type");

4837 StorageKind = ISK_CapturedVLAType;

4839}

4840

4842

4845 return;

4846 }

4847

4849}

4850

4853 if (!CAT)

4854 return nullptr;

4855

4857 const auto *CountDecl = CountDRE->getDecl();

4858 if (const auto *IFD = dyn_cast(CountDecl))

4859 CountDecl = IFD->getAnonField();

4860

4861 return dyn_cast(CountDecl);

4862}

4863

4864

4865

4866

4867

4874 "EnumDecl not matched with TagTypeKind::Enum");

4882 TagDeclBits.IsThisDeclarationADemotedDefinition = false;

4883}

4884

4888

4894

4896

4898 TypedefNameDeclOrQualifier = TDD;

4900}

4901

4904

4905 if (auto *D = dyn_cast(this)) {

4906 struct CXXRecordDecl::DefinitionData *Data =

4907 new (getASTContext()) struct CXXRecordDecl::DefinitionData(D);

4908 for (auto *I : redecls())

4910 }

4911}

4912

4916 "definition completed but not started");

4917

4920

4922 L->CompletedTagDefinition(this);

4923}

4924

4927 return const_cast<TagDecl *>(this);

4928

4929 if (const auto *CXXRD = dyn_cast(this))

4930 return CXXRD->getDefinition();

4931

4934 if (R->isCompleteDefinition() || R->isBeingDefined())

4935 return R;

4936 return nullptr;

4937}

4938

4940 if (QualifierLoc) {

4941

4942 if (!hasExtInfo())

4943 TypedefNameDeclOrQualifier = new (getASTContext()) ExtInfo;

4944

4945 getExtInfo()->QualifierLoc = QualifierLoc;

4946 } else {

4947

4948 if (hasExtInfo()) {

4949 if (getExtInfo()->NumTemplParamLists == 0) {

4951 TypedefNameDeclOrQualifier = (TypedefNameDecl *)nullptr;

4952 }

4953 else

4954 getExtInfo()->QualifierLoc = QualifierLoc;

4955 }

4956 }

4957}

4958

4961

4962

4963 if (Name.isIdentifier() && !Name.getAsIdentifierInfo()) {

4964

4965

4966

4968 Copy.SuppressScope = true;

4970 return;

4971 }

4972

4973 Name.print(OS, Policy);

4974}

4975

4978 assert(!TPLists.empty());

4979

4980 if (!hasExtInfo())

4981

4982 TypedefNameDeclOrQualifier = new (getASTContext()) ExtInfo;

4983

4984 getExtInfo()->setTemplateParameterListsInfo(Context, TPLists);

4985}

4986

4987

4988

4989

4990

4993 bool Scoped, bool ScopedUsingClassTag, bool Fixed)

4995 assert(Scoped || !ScopedUsingClassTag);

4996 IntegerType = nullptr;

4997 setNumPositiveBits(0);

4998 setNumNegativeBits(0);

4999 setScoped(Scoped);

5000 setScopedUsingClassTag(ScopedUsingClassTag);

5001 setFixed(Fixed);

5002 setHasODRHash(false);

5004}

5005

5006void EnumDecl::anchor() {}

5007

5011 EnumDecl *PrevDecl, bool IsScoped,

5012 bool IsScopedUsingClassTag, bool IsFixed) {

5013 return new (C, DC) EnumDecl(C, DC, StartLoc, IdLoc, Id, PrevDecl, IsScoped,

5014 IsScopedUsingClassTag, IsFixed);

5015}

5016

5019 nullptr, nullptr, false, false, false);

5020}

5021

5024 return TI->getTypeLoc().getSourceRange();

5026}

5027

5030 unsigned NumPositiveBits,

5031 unsigned NumNegativeBits) {

5033 if (!IntegerType)

5035 PromotionType = NewPromotionType;

5036 setNumPositiveBits(NumPositiveBits);

5037 setNumNegativeBits(NumNegativeBits);

5039}

5040

5043 return A->getExtensibility() == EnumExtensibilityAttr::Closed;

5044 return true;

5045}

5046

5050

5054

5057 return MSI->getTemplateSpecializationKind();

5058

5060}

5061

5065 assert(MSI && "Not an instantiated member enumeration?");

5068 PointOfInstantiation.isValid() &&

5071}

5072

5078 ED = NewED;

5079 return ::getDefinitionOrSelf(ED);

5080 }

5081 }

5082

5084 "couldn't find pattern for enum instantiation");

5085 return nullptr;

5086}

5087

5089 if (SpecializationInfo)

5090 return cast(SpecializationInfo->getInstantiatedFrom());

5091

5092 return nullptr;

5093}

5094

5097 assert(!SpecializationInfo && "Member enum is already a specialization");

5099}

5100

5102 if (hasODRHash())

5103 return ODRHash;

5104

5105 class ODRHash Hash;

5107 setHasODRHash(true);

5109 return ODRHash;

5110}

5111

5114

5116

5118 Res.setEnd(TSI->getTypeLoc().getEndLoc());

5119 }

5120 return Res;

5121}

5122

5127

5128 if (NumNegativeBits) {

5129 unsigned NumBits = std::max(NumNegativeBits, NumPositiveBits + 1);

5130 Max = llvm::APInt(Bitwidth, 1) << (NumBits - 1);

5132 } else {

5133 Max = llvm::APInt(Bitwidth, 1) << NumPositiveBits;

5134 Min = llvm::APInt::getZero(Bitwidth);

5135 }

5136}

5137

5138

5139

5140

5141

5146 : TagDecl(DK, TK, C, DC, IdLoc, Id, PrevDecl, StartLoc) {

5147 assert(classof(static_cast<Decl *>(this)) && "Invalid Kind!");

5163 setODRHash(0);

5164}

5165

5169 return new (C, DC)

5171}

5172

5175 return new (C, ID)

5178}

5179

5181 if (auto RD = dyn_cast(this))

5183 return false;

5184}

5185

5189

5193

5196 return true;

5197

5199 for (const FieldDecl *FD : Def->fields()) {

5201 if (RT && RT->getDecl()->isOrContainsUnion())

5202 return true;

5203 }

5204 }

5205

5206 return false;

5207}

5208

5211 LoadFieldsFromExternalStorage();

5212

5213

5215 return D->field_begin();

5217}

5218

5222

5223

5224

5228

5230

5231

5232

5233

5234

5235

5236

5237

5241}

5242

5243

5244

5245

5248 return false;

5250 return true;

5251 auto LayoutCompatibility = C.getLangOpts().getLayoutCompatibility();

5253 return C.defaultsToMsStruct();

5255}

5256

5259 LastDecl->NextInContextAndBits.setPointer(nullptr);

5261}

5262

5263void RecordDecl::LoadFieldsFromExternalStorage() const {

5266

5267

5269

5272 Source->FindExternalLexicalDecls(this, [](Decl::Kind K) {

5274 }, Decls);

5275

5276#ifndef NDEBUG

5277

5278 for (unsigned i=0, e=Decls.size(); i != e; ++i)

5280#endif

5281

5282 if (Decls.empty())

5283 return;

5284

5285 auto [ExternalFirst, ExternalLast] =

5287 false);

5288 ExternalLast->NextInContextAndBits.setPointer(FirstDecl);

5292}

5293

5296 const SanitizerMask EnabledAsanMask = Context.getLangOpts().Sanitize.Mask &

5297 (SanitizerKind::Address | SanitizerKind::KernelAddress);

5298 if (!EnabledAsanMask || !Context.getLangOpts().SanitizeAddressFieldPadding)

5299 return false;

5300 const auto &NoSanitizeList = Context.getNoSanitizeList();

5301 const auto *CXXRD = dyn_cast(this);

5302

5303 int ReasonToReject = -1;

5304 if (!CXXRD || CXXRD->isExternCContext())

5305 ReasonToReject = 0;

5306 else if (CXXRD->hasAttr())

5307 ReasonToReject = 1;

5308 else if (CXXRD->isUnion())

5309 ReasonToReject = 2;

5310 else if (CXXRD->isTriviallyCopyable())

5311 ReasonToReject = 3;

5312 else if (CXXRD->hasTrivialDestructor())

5313 ReasonToReject = 4;

5314 else if (CXXRD->isStandardLayout())

5315 ReasonToReject = 5;

5317 "field-padding"))

5318 ReasonToReject = 6;

5321 ReasonToReject = 7;

5322

5323 if (EmitRemark) {

5324 if (ReasonToReject >= 0)

5325 Context.getDiagnostics().Report(

5327 diag::remark_sanitize_address_insert_extra_padding_rejected)

5329 else

5330 Context.getDiagnostics().Report(

5332 diag::remark_sanitize_address_insert_extra_padding_accepted)

5334 }

5335 return ReasonToReject < 0;

5336}

5337

5339 for (const auto *I : fields()) {

5340 if (I->getIdentifier())

5341 return I;

5342

5343 if (const auto *RD = I->getType()->getAsRecordDecl())

5345 return NamedDataMember;

5346 }

5347

5348

5349 return nullptr;

5350}

5351

5353 if (hasODRHash())

5355

5356

5359

5360

5364}

5365

5366

5367

5368

5369

5379

5381 assert(!ParamInfo && "Already has param info!");

5382

5383

5384 if (!NewParamInfo.empty()) {

5385 NumParams = NewParamInfo.size();

5387 llvm::copy(NewParamInfo, ParamInfo);

5388 }

5389}

5390

5392 bool CapturesCXXThis) {

5394 this->NumCaptures = Captures.size();

5395

5396 if (Captures.empty()) {

5397 this->Captures = nullptr;

5398 return;

5399 }

5400

5401 this->Captures = Captures.copy(Context).data();

5402}

5403

5405 for (const auto &I : captures())

5406

5407 if (I.getVariable() == variable)

5408 return true;

5409

5410 return false;

5411}

5412

5416

5417

5418

5419

5420

5421void TranslationUnitDecl::anchor() {}

5422

5424 return new (C, (DeclContext *)nullptr) TranslationUnitDecl(C);

5425}

5426

5428 AnonymousNamespace = D;

5429

5431 Listener->AddedAnonymousNamespace(this, D);

5432}

5433

5434void PragmaCommentDecl::anchor() {}

5435

5440 StringRef Arg) {

5441 PragmaCommentDecl *PCD =

5442 new (C, DC, additionalSizeToAlloc(Arg.size() + 1))

5443 PragmaCommentDecl(DC, CommentLoc, CommentKind);

5444 llvm::copy(Arg, PCD->getTrailingObjects());

5445 PCD->getTrailingObjects()[Arg.size()] = '\0';

5446 return PCD;

5447}

5448

5451 unsigned ArgSize) {

5452 return new (C, ID, additionalSizeToAlloc(ArgSize + 1))

5454}

5455

5456void PragmaDetectMismatchDecl::anchor() {}

5457

5461 StringRef Value) {

5462 size_t ValueStart = Name.size() + 1;

5463 PragmaDetectMismatchDecl *PDMD =

5464 new (C, DC, additionalSizeToAlloc(ValueStart + Value.size() + 1))

5465 PragmaDetectMismatchDecl(DC, Loc, ValueStart);

5466 llvm::copy(Name, PDMD->getTrailingObjects());

5467 PDMD->getTrailingObjects()[Name.size()] = '\0';

5468 llvm::copy(Value, PDMD->getTrailingObjects() + ValueStart);

5469 PDMD->getTrailingObjects()[ValueStart + Value.size()] = '\0';

5470 return PDMD;

5471}

5472

5475 unsigned NameValueSize) {

5476 return new (C, ID, additionalSizeToAlloc(NameValueSize + 1))

5477 PragmaDetectMismatchDecl(nullptr, SourceLocation(), 0);

5478}

5479

5480void ExternCContextDecl::anchor() {}

5481

5484 return new (C, DC) ExternCContextDecl(DC);

5485}

5486

5487void LabelDecl::anchor() {}

5488

5491 return new (C, DC) LabelDecl(DC, IdentL, II, nullptr, IdentL);

5492}

5493

5497 assert(GnuLabelL != IdentL && "Use this only for GNU local labels");

5498 return new (C, DC) LabelDecl(DC, IdentL, II, nullptr, GnuLabelL);

5499}

5500

5502 return new (C, ID) LabelDecl(nullptr, SourceLocation(), nullptr, nullptr,

5504}

5505

5507char *Buffer = new (getASTContext(), 1) char[Name.size() + 1];

5508llvm::copy(Name, Buffer);

5509Buffer[Name.size()] = '\0';

5510MSAsmName = Buffer;

5511}

5512

5513void ValueDecl::anchor() {}

5514

5517 return MostRecent->hasAttr() ||

5518 MostRecent->hasAttr() || isWeakImported();

5519}

5520

5522 if (auto *Var = llvm::dyn_cast(this))

5523 return Var->isInitCapture();

5524 return false;

5525}

5526

5528 if (const auto *NTTP = dyn_cast(this))

5529 return NTTP->isParameterPack();

5530

5531 return isa_and_nonnull(getType().getTypePtrOrNull());

5532}

5533

5534void ImplicitParamDecl::anchor() {}

5535

5542

5547

5552

5566

5573

5578

5582

5586

5587OutlinedFunctionDecl::OutlinedFunctionDecl(DeclContext *DC, unsigned NumParams)

5589 DeclContext(OutlinedFunction), NumParams(NumParams),

5591

5594 unsigned NumParams) {

5595 return new (C, DC, additionalSizeToAlloc<ImplicitParamDecl *>(NumParams))

5596 OutlinedFunctionDecl(DC, NumParams);

5597}

5598

5601 unsigned NumParams) {

5602 return new (C, ID, additionalSizeToAlloc<ImplicitParamDecl *>(NumParams))

5603 OutlinedFunctionDecl(nullptr, NumParams);

5604}

5605

5607 return BodyAndNothrow.getPointer();

5608}

5610

5613 BodyAndNothrow.setInt(Nothrow);

5614}

5615

5616CapturedDecl::CapturedDecl(DeclContext *DC, unsigned NumParams)

5618 NumParams(NumParams), ContextParam(0), BodyAndNothrow(nullptr, false) {}

5619

5621 unsigned NumParams) {

5622 return new (C, DC, additionalSizeToAlloc<ImplicitParamDecl *>(NumParams))

5623 CapturedDecl(DC, NumParams);

5624}

5625

5627 unsigned NumParams) {

5628 return new (C, ID, additionalSizeToAlloc<ImplicitParamDecl *>(NumParams))

5629 CapturedDecl(nullptr, NumParams);

5630}

5631

5634

5637

5644

5648 Expr *E, const llvm::APSInt &V) {

5650}

5651

5655 QualType(), nullptr, llvm::APSInt());

5656}

5657

5658void IndirectFieldDecl::anchor() {}

5659

5664 : ValueDecl(IndirectField, DC, L, N, T), Chaining(CH.data()),

5665 ChainingSize(CH.size()) {

5666

5667

5668 if (C.getLangOpts().CPlusPlus)

5670}

5671

5677 return new (C, DC) IndirectFieldDecl(C, DC, L, Id, T, CH);

5678}

5679

5685

5688 if (Init)

5689 End = Init->getEndLoc();

5691}

5692

5693void TypeDecl::anchor() {}

5694

5699 return new (C, DC) TypedefDecl(C, DC, StartLoc, IdLoc, Id, TInfo);

5700}

5701

5702void TypedefNameDecl::anchor() {}

5703

5706 auto *OwningTypedef = TT->getDecl()->getTypedefNameForAnonDecl();

5707 auto *ThisTypedef = this;

5708 if (AnyRedecl && OwningTypedef) {

5709 OwningTypedef = OwningTypedef->getCanonicalDecl();

5710 ThisTypedef = ThisTypedef->getCanonicalDecl();

5711 }

5712 if (OwningTypedef == ThisTypedef)

5713 return TT->getDecl()->getDefinitionOrSelf();

5714 }

5715

5716 return nullptr;

5717}

5718

5719bool TypedefNameDecl::isTransparentTagSlow() const {

5720 auto determineIsTransparent = [&]() {

5722 if (auto *TD = TT->getDecl()) {

5723 if (TD->getName() != getName())

5724 return false;

5728 return false;

5730 return SM.getSpellingLoc(TTLoc) == SM.getSpellingLoc(TDLoc);

5731 }

5732 }

5733 return false;

5734 };

5735

5736 bool isTransparent = determineIsTransparent();

5737 MaybeModedTInfo.setInt((isTransparent << 1) | 1);

5738 return isTransparent;

5739}

5740

5743 nullptr, nullptr);

5744}

5745

5751 return new (C, DC) TypeAliasDecl(C, DC, StartLoc, IdLoc, Id, TInfo);

5752}

5753

5759

5764 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();

5765 }

5767}

5768

5772 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();

5774}

5775

5776void FileScopeAsmDecl::anchor() {}

5777

5781 return new (C, DC) FileScopeAsmDecl(DC, Str, AsmLoc, RParenLoc);

5782}

5783

5786 return new (C, ID) FileScopeAsmDecl(nullptr, nullptr, SourceLocation(),

5788}

5789

5793

5794void TopLevelStmtDecl::anchor() {}

5795

5797 assert(C.getLangOpts().IncrementalExtensions &&

5798 "Must be used only in incremental mode");

5799

5801 DeclContext *DC = C.getTranslationUnitDecl();

5802

5803 return new (C, DC) TopLevelStmtDecl(DC, Loc, Statement);

5804}

5805

5808 return new (C, ID)

5809 TopLevelStmtDecl(nullptr, SourceLocation(), nullptr);

5810}

5811

5815

5817 assert(S);

5818 Statement = S;

5820}

5821

5822void EmptyDecl::anchor() {}

5823

5825 return new (C, DC) EmptyDecl(DC, L);

5826}

5827

5831

5832HLSLBufferDecl::HLSLBufferDecl(DeclContext *DC, bool CBuffer,

5836 DeclContext(Decl::Kind::HLSLBuffer), LBraceLoc(LBrace), KwLoc(KwLoc),

5837 IsCBuffer(CBuffer), HasValidPackoffset(false), LayoutStruct(nullptr) {}

5838

5840 DeclContext *LexicalParent, bool CBuffer,

5844

5845

5846

5847

5848

5849

5850

5851

5852

5853

5854

5856 HLSLBufferDecl *Result =

5857 new (C, DC) HLSLBufferDecl(DC, CBuffer, KwLoc, ID, IDLoc, LBrace);

5859}

5860

5865 IdentifierInfo *II = &C.Idents.get("$Globals", tok::TokenKind::identifier);

5866 HLSLBufferDecl *Result = new (C, DC) HLSLBufferDecl(

5868 Result->setImplicit(true);

5869 Result->setDefaultBufferDecls(DefaultCBufferDecls);

5871}

5872

5875 return new (C, ID) HLSLBufferDecl(nullptr, false, SourceLocation(), nullptr,

5877}

5878

5880 assert(LayoutStruct == nullptr && "layout struct has already been set");

5881 LayoutStruct = LS;

5883}

5884

5885void HLSLBufferDecl::setDefaultBufferDecls(ArrayRef<Decl *> Decls) {

5886 assert(!Decls.empty());

5887 assert(DefaultBufferDecls.empty() && "default decls are already set");

5889 "default decls can only be added to the implicit/default constant "

5890 "buffer $Globals");

5891

5892

5894 llvm::copy(Decls, DeclsArray);

5895 DefaultBufferDecls = ArrayRef<Decl *>(DeclsArray, Decls.size());

5896}

5897

5900 return buffer_decl_iterator(llvm::iterator_range(DefaultBufferDecls.begin(),

5901 DefaultBufferDecls.end()),

5903}

5904

5907 llvm::iterator_range(DefaultBufferDecls.end(), DefaultBufferDecls.end()),

5909}

5910

5912 return DefaultBufferDecls.empty() && decls_empty();

5913}

5914

5915

5916

5917

5918

5919HLSLRootSignatureDecl::HLSLRootSignatureDecl(

5921 llvm::dxbc::RootSignatureVersion Version, unsigned NumElems)

5923 Version(Version), NumElems(NumElems) {}

5924

5927 llvm::dxbc::RootSignatureVersion Version,

5929 HLSLRootSignatureDecl *RSDecl =

5930 new (C, DC,

5931 additionalSizeToAllocllvm::hlsl::rootsig::RootElement(

5932 RootElements.size()))

5933 HLSLRootSignatureDecl(DC, Loc, ID, Version, RootElements.size());

5934 auto *StoredElems = RSDecl->getElems();

5935 llvm::uninitialized_copy(RootElements, StoredElems);

5936 return RSDecl;

5937}

5938

5941 HLSLRootSignatureDecl *Result = new (C, ID)

5942 HLSLRootSignatureDecl(nullptr, SourceLocation(), nullptr,

5943 llvm::dxbc::RootSignatureVersion::V1_1,

5944 0);

5946}

5947

5948

5949

5950

5951

5952

5953

5955 unsigned Result = 1;

5956 while (Mod->Parent) {

5958 ++Result;

5959 }

5960 return Result;

5961}

5962

5966 : Decl(Import, DC, StartLoc), ImportedModule(Imported),

5967 NextLocalImportAndComplete(nullptr, true) {

5969 auto *StoredLocs = getTrailingObjects();

5970 llvm::uninitialized_copy(IdentifierLocs, StoredLocs);

5971}

5972

5975 : Decl(Import, DC, StartLoc), ImportedModule(Imported),

5976 NextLocalImportAndComplete(nullptr, false) {

5977 *getTrailingObjects() = EndLoc;

5978}

5979

5983 return new (C, DC,

5984 additionalSizeToAlloc(IdentifierLocs.size()))

5985 ImportDecl(DC, StartLoc, Imported, IdentifierLocs);

5986}

5987

5992 ImportDecl *Import = new (C, DC, additionalSizeToAlloc(1))

5993 ImportDecl(DC, StartLoc, Imported, EndLoc);

5994 Import->setImplicit();

5995 return Import;

5996}

5997

5999 unsigned NumLocations) {

6000 return new (C, ID, additionalSizeToAlloc(NumLocations))

6002}

6003

6005 if (!isImportComplete())

6006 return {};

6007

6009}

6010

6012 if (!isImportComplete())

6014

6016}

6017

6018

6019

6020

6021

6022void ExportDecl::anchor() {}

6023

6026 return new (C, DC) ExportDecl(DC, ExportLoc);

6027}

6028

6032

6034 bool IncludeLocallyStreaming) {

6035 if (IncludeLocallyStreaming)

6036 if (FD->hasAttr())

6037 return true;

6038

6039 assert(!FD->getType().isNull() && "Expected a valid FunctionDecl");

6042 return true;

6043

6044 return false;

6045}

6046

6051 (FD->hasAttr() && FD->getAttr()->isNewZA());

6052}

6053

6058 (FD->hasAttr() && FD->getAttr()->isNewZT0());

6059}

Defines the clang::ASTContext interface.

This file provides some common utility functions for processing Lambda related AST Constructs.

Defines enum values for all the target-independent builtin functions.

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

Defines the C++ template declaration subclasses.

static bool isFirstInExternCContext(T *D)

Definition Decl.cpp:574

static bool isRedeclarableImpl(Redeclarable< T > *)

Definition Decl.cpp:1850

static bool isDeclExternC(const T &D)

Definition Decl.cpp:2236

static bool hasExplicitVisibilityAlready(LVComputationKind computation)

Does this computation kind permit us to consider additional visibility settings from attributes and t...

Definition Decl.cpp:159

static bool RedeclForcesDefC99(const FunctionDecl *Redecl)

Definition Decl.cpp:3915

static bool isExportedFromModuleInterfaceUnit(const NamedDecl *D)

Definition Decl.cpp:1190

static bool isRedeclarable(Decl::Kind K)

Definition Decl.cpp:1854

static bool redeclForcesDefMSVC(const FunctionDecl *Redecl)

Definition Decl.cpp:3903

static bool usesTypeVisibility(const NamedDecl *D)

Is the given declaration a "type" or a "value" for the purposes of visibility computation?

Definition Decl.cpp:180

static std::optional< Visibility > getVisibilityOf(const NamedDecl *D, NamedDecl::ExplicitVisibilityKind kind)

Return the explicit visibility of the given declaration.

Definition Decl.cpp:222

static LanguageLinkage getDeclLanguageLinkage(const T &D)

Definition Decl.cpp:2209

static LVComputationKind withExplicitVisibilityAlready(LVComputationKind Kind)

Given an LVComputationKind, return one of the same type/value sort that records that it already has e...

Definition Decl.cpp:166

static std::enable_if_t<!std::is_base_of_v< RedeclarableTemplateDecl, T >, bool > isExplicitMemberSpecialization(const T *D)

Does the given declaration have member specialization information, and if so, is it an explicit speci...

Definition Decl.cpp:190

static unsigned getNumModuleIdentifiers(Module *Mod)

Retrieve the number of module identifiers needed to name the given module.

Definition Decl.cpp:5954

static bool isSingleLineLanguageLinkage(const Decl &D)

Definition Decl.cpp:579

static bool useInlineVisibilityHidden(const NamedDecl *D)

Definition Decl.cpp:546

static bool shouldConsiderTemplateVisibility(const FunctionDecl *fn, const FunctionTemplateSpecializationInfo *specInfo)

Definition Decl.cpp:373

static bool hasDirectVisibilityAttribute(const NamedDecl *D, LVComputationKind computation)

Does the given declaration have a direct visibility attribute that would match the given rules?

Definition Decl.cpp:419

static DeclT * getDefinitionOrSelf(DeclT *D)

Definition Decl.cpp:2698

static Visibility getVisibilityFromAttr(const T *attr)

Given a visibility attribute, return the explicit visibility associated with it.

Definition Decl.cpp:208

static const Decl * getOutermostFuncOrBlockContext(const Decl *D)

Definition Decl.cpp:302

static bool typeIsPostfix(QualType QT)

Definition Decl.cpp:2063

static LinkageInfo getExternalLinkageFor(const NamedDecl *D)

Definition Decl.cpp:586

static StorageClass getStorageClass(const Decl *D)

Definition Decl.cpp:590

static std::optional< Visibility > getExplicitVisibilityAux(const NamedDecl *ND, NamedDecl::ExplicitVisibilityKind kind, bool IsMostRecent)

Definition Decl.cpp:1231

static SourceLocation getTemplateOrInnerLocStart(const DeclT *decl)

Definition Decl.cpp:1989

static bool isNamed(const NamedDecl *ND, const char(&Str)[Len])

Definition Decl.cpp:3302

static std::optional< Visibility > getExplicitVisibility(const NamedDecl *D, LVComputationKind kind)

Definition Decl.cpp:171

static bool hasDefinition(const ObjCObjectPointerType *ObjPtr)

Defines the clang::Expr interface and subclasses for C++ expressions.

TokenType getType() const

Returns the token's type, e.g.

Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.

Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.

Defines the clang::LangOptions interface.

llvm::MachO::Record Record

Defines the clang::Module class, which describes a module in the source code.

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

Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.

Defines the clang::SanitizerKind enum.

static bool hasAttr(const Decl *D, bool IgnoreImplicitAttr)

Defines the clang::SourceLocation class and associated facilities.

Defines the SourceManager interface.

Defines various enumerations that describe declaration and type specifiers.

Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting.

Defines the clang::TypeLoc interface and its subclasses.

C Language Family Type Representation.

static const TypeInfo & getInfo(unsigned id)

Defines the clang::Visibility enumeration and various utility functions.

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

bool needsCleanup() const

Returns whether the object performed allocations.

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

SourceManager & getSourceManager()

const ConstantArrayType * getAsConstantArrayType(QualType T) const

unsigned getIntWidth(QualType T) const

void setTemplateOrSpecializationInfo(VarDecl *Inst, TemplateOrSpecializationInfo TSI)

bool isTypeAwareOperatorNewOrDelete(const FunctionDecl *FD) const

const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const

Get or compute information about the layout of the specified record (struct/union/class) D,...

void setIsTypeAwareOperatorNewOrDelete(const FunctionDecl *FD, bool IsTypeAware)

void Deallocate(void *Ptr) const

const LangOptions & getLangOpts() const

void setParameterIndex(const ParmVarDecl *D, unsigned index)

Used by ParmVarDecl to store on the side the index of the parameter when it exceeds the size of the n...

Decl * getPrimaryMergedDecl(Decl *D)

bool isDestroyingOperatorDelete(const FunctionDecl *FD) const

CharUnits getTypeSizeInChars(QualType T) const

Return the size of the specified (complete) type T, in characters.

void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl, TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())

Note that the static data member Inst is an instantiation of the static data member template Tmpl of ...

static bool hasSameType(QualType T1, QualType T2)

Determine whether the given types T1 and T2 are equivalent.

QualType getSizeType() const

Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.

const TargetInfo & getTargetInfo() const

CharUnits toCharUnitsFromBits(int64_t BitSize) const

Convert a size in bits to a size in characters.

void addDestruction(T *Ptr) const

If T isn't trivially destructible, calls AddDeallocation to register it for destruction.

ExternalASTSource * getExternalSource() const

Retrieve a pointer to the external AST source associated with this AST context, if any.

unsigned getParameterIndex(const ParmVarDecl *D) const

Used by ParmVarDecl to retrieve on the side the index of the parameter when it exceeds the size of th...

void setIsDestroyingOperatorDelete(const FunctionDecl *FD, bool IsDestroying)

An abstract interface that should be implemented by listeners that want to be notified when an AST en...

ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...

CharUnits getSize() const

getSize - Get the record size in characters.

unsigned getFieldCount() const

getFieldCount - Get the number of fields in the layout.

uint64_t getFieldOffset(unsigned FieldNo) const

getFieldOffset - Get the offset of the given field index, in bits.

Type source information for an attributed type.

BlockDecl(DeclContext *DC, SourceLocation CaretLoc)

Definition Decl.cpp:5370

void setParams(ArrayRef< ParmVarDecl * > NewParamInfo)

Definition Decl.cpp:5380

void setDoesNotEscape(bool B=true)

void setCapturesCXXThis(bool B=true)

void setCanAvoidCopyToHeap(bool B=true)

void setIsConversionFromLambda(bool val=true)

void setBlockMissingReturnType(bool val=true)

ArrayRef< Capture > captures() const

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition Decl.cpp:5413

static BlockDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5583

void setIsVariadic(bool value)

bool capturesVariable(const VarDecl *var) const

Definition Decl.cpp:5404

void setCaptures(ASTContext &Context, ArrayRef< Capture > Captures, bool CapturesCXXThis)

Definition Decl.cpp:5391

static BlockDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L)

Definition Decl.cpp:5579

Represents a C++ struct/union/class.

CXXRecordDecl * getInstantiatedFromMemberClass() const

If this record is an instantiation of a member class, retrieves the member class from which it was in...

void setBody(Stmt *B)

Definition Decl.cpp:5633

static CapturedDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumParams)

Definition Decl.cpp:5626

bool isNothrow() const

Definition Decl.cpp:5635

void setNothrow(bool Nothrow=true)

Definition Decl.cpp:5636

static CapturedDecl * Create(ASTContext &C, DeclContext *DC, unsigned NumParams)

Definition Decl.cpp:5620

Stmt * getBody() const override

getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...

Definition Decl.cpp:5632

CharUnits - This is an opaque type for sizes expressed in character units.

static CharUnits Zero()

Zero - Construct a CharUnits quantity of zero.

CXXRecordDecl * getTemplatedDecl() const

Get the underlying class declarations of the template.

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

ClassTemplateDecl * getSpecializedTemplate() const

Retrieve the template that this specialization specializes.

const TemplateArgumentList & getTemplateArgs() const

Retrieve the template arguments of the class template specialization.

bool isExplicitSpecialization() const

bool isExplicitInstantiationOrSpecialization() const

True if this declaration is an explicit specialization, explicit instantiation declaration,...

bool isZeroSize() const

Return true if the size is zero.

Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...

A POD class for pairing a NamedDecl* with an access specifier.

decl_iterator - Iterates through the declarations stored within this context.

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 Equals(const DeclContext *DC) const

Determine whether this declaration context is equivalent to the declaration context DC.

FunctionDeclBitfields FunctionDeclBits

bool isFileContext() const

static std::pair< Decl *, Decl * > BuildDeclChain(ArrayRef< Decl * > Decls, bool FieldsAlreadyLoaded)

Build up a chain of declarations.

bool isTransparentContext() const

isTransparentContext - Determines whether this context is a "transparent" context,...

TagDeclBitfields TagDeclBits

bool isExternCXXContext() const

Determines whether this context or some of its ancestors is a linkage specification context that spec...

bool isTranslationUnit() const

DeclContext * getRedeclContext()

getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...

RecordDeclBitfields RecordDeclBits

Decl * FirstDecl

FirstDecl - The first declaration stored within this declaration context.

DeclContext(Decl::Kind K)

void addDecl(Decl *D)

Add the declaration D into this context.

llvm::iterator_range< decl_iterator > decl_range

decl_iterator decls_end() const

bool hasExternalLexicalStorage() const

Whether this DeclContext has external storage containing additional declarations that are lexically i...

Decl * LastDecl

LastDecl - The last declaration stored within this declaration context.

bool isInlineNamespace() const

bool isFunctionOrMethod() const

bool isExternCContext() const

Determines whether this context or some of its ancestors is a linkage specification context that spec...

Decl::Kind getDeclKind() const

decl_iterator decls_begin() const

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

Decl * getPreviousDecl()

Retrieve the previous declaration that declares the same entity as this declaration,...

bool isInStdNamespace() const

SourceLocation getEndLoc() const LLVM_READONLY

FriendObjectKind getFriendObjectKind() const

Determines whether this declaration is the object of a friend declaration and, if so,...

ASTContext & getASTContext() const LLVM_READONLY

bool isImplicit() const

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

bool isInNamedModule() const

Whether this declaration comes from a named module.

virtual bool isOutOfLine() const

Determine whether this declaration is declared out of line (outside its semantic context).

Definition Decl.cpp:99

bool isWeakImported() const

Determine whether this is a weak-imported symbol.

ModuleOwnershipKind getModuleOwnershipKind() const

Get the kind of module ownership for this declaration.

ASTMutationListener * getASTMutationListener() const

bool hasCachedLinkage() const

Kind

Lists the kind of concrete classes of Decl.

@ FOK_None

Not a friend object.

bool isCanonicalDecl() const

Whether this particular Decl is a canonical one.

Module * getOwningModule() const

Get the module that owns this declaration (for visibility purposes).

FunctionDecl * getAsFunction() LLVM_READONLY

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

bool isFromASTFile() const

Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...

Linkage getCachedLinkage() const

bool isTemplateParameter() const

isTemplateParameter - Determines whether this declaration is a template parameter.

bool isInvalidDecl() const

bool hasDefiningAttr() const

Return true if this declaration has an attribute which acts as definition of the entity,...

llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const

SourceLocation getLocation() const

IdentifierNamespace

IdentifierNamespace - The different namespaces in which declarations may appear.

@ IDNS_Tag

Tags, declared with 'struct foo;' and referenced with 'struct foo'.

redecl_range redecls() const

Returns an iterator range for all the redeclarations of the same decl.

void setLocation(SourceLocation L)

friend class LinkageComputer

DeclContext * getDeclContext()

bool isInAnonymousNamespace() const

void setCachedLinkage(Linkage L) const

Module * getOwningModuleForLinkage() const

Get the module that owns this declaration for linkage purposes.

Definition Decl.cpp:1636

DeclContext * getLexicalDeclContext()

getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).

virtual Decl * getCanonicalDecl()

Retrieves the "canonical" declaration of the given declaration.

@ VisibleWhenImported

This declaration has an owning module, and is visible when that module is imported.

@ Unowned

This declaration is not owned by a module.

@ ReachableWhenImported

This declaration has an owning module, and is visible to lookups that occurs within that module.

@ ModulePrivate

This declaration has an owning module, but is only visible to lookups that occur within that module.

@ Visible

This declaration has an owning module, but is globally visible (typically because its owning module i...

const LangOptions & getLangOpts() const LLVM_READONLY

Helper to get the language options from the ASTContext.

The name of a declaration.

const IdentifierInfo * getCXXLiteralIdentifier() const

If this name is the name of a literal operator, retrieve the identifier associated with it.

bool isAnyOperatorDelete() const

OverloadedOperatorKind getCXXOverloadedOperator() const

If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...

SourceLocation getTypeSpecEndLoc() const

Definition Decl.cpp:2001

SourceLocation getInnerLocStart() const

Return start of source range ignoring outer template declarations.

SourceLocation getOuterLocStart() const

Return start of source range taking into account any outer template declarations.

Definition Decl.cpp:2057

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition Decl.cpp:2097

SourceLocation getTypeSpecStartLoc() const

Definition Decl.cpp:1995

SourceLocation getBeginLoc() const LLVM_READONLY

const AssociatedConstraint & getTrailingRequiresClause() const

Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...

DeclaratorDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL)

void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)

Definition Decl.cpp:2007

void setTrailingRequiresClause(const AssociatedConstraint &AC)

Definition Decl.cpp:2026

TypeSourceInfo * getTypeSourceInfo() const

void setTemplateParameterListsInfo(ASTContext &Context, ArrayRef< TemplateParameterList * > TPLists)

Definition Decl.cpp:2041

Provides information about a dependent function-template specialization declaration.

static DependentFunctionTemplateSpecializationInfo * Create(ASTContext &Context, const UnresolvedSetImpl &Candidates, const TemplateArgumentListInfo *TemplateArgs)

Definition Decl.cpp:4391

static EmptyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L)

Definition Decl.cpp:5824

static EmptyDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5828

EnumConstantDecl(const ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, Expr *E, const llvm::APSInt &V)

Definition Decl.cpp:5638

static EnumConstantDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5652

void setInitVal(const ASTContext &C, const llvm::APSInt &V)

static EnumConstantDecl * Create(ASTContext &C, EnumDecl *DC, SourceLocation L, IdentifierInfo *Id, QualType T, Expr *E, const llvm::APSInt &V)

Definition Decl.cpp:5645

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition Decl.cpp:5686

MemberSpecializationInfo * getMemberSpecializationInfo() const

If this enumeration is an instantiation of a member enumeration of a class template specialization,...

unsigned getNumNegativeBits() const

Returns the width in bits required to store all the negative enumerators of this enum.

unsigned getODRHash()

Definition Decl.cpp:5101

void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())

For an enumeration member that was instantiated from a member enumeration of a templated class,...

Definition Decl.cpp:5062

static EnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl, bool IsScoped, bool IsScopedUsingClassTag, bool IsFixed)

Definition Decl.cpp:5008

TypeSourceInfo * getIntegerTypeSourceInfo() const

Return the type source info for the underlying integer type, if no type source info exists,...

static EnumDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5017

bool isClosedFlag() const

Returns true if this enum is annotated with flag_enum and isn't annotated with enum_extensibility(ope...

Definition Decl.cpp:5047

SourceRange getIntegerTypeRange() const LLVM_READONLY

Retrieve the source range that covers the underlying type if specified.

Definition Decl.cpp:5022

SourceRange getSourceRange() const override LLVM_READONLY

Overrides to provide correct range when there's an enum-base specifier with forward declarations.

Definition Decl.cpp:5112

QualType getIntegerType() const

Return the integer type this enum decl corresponds to.

EnumDecl * getInstantiatedFromMemberEnum() const

Returns the enumeration (declared within the template) from which this enumeration type was instantia...

Definition Decl.cpp:5088

unsigned getNumPositiveBits() const

Returns the width in bits required to store all the non-negative enumerators of this enum.

TemplateSpecializationKind getTemplateSpecializationKind() const

If this enumeration is a member of a specialization of a templated class, determine what kind of temp...

Definition Decl.cpp:5055

bool isClosed() const

Returns true if this enum is either annotated with enum_extensibility(closed) or isn't annotated with...

Definition Decl.cpp:5041

EnumDecl * getTemplateInstantiationPattern() const

Retrieve the enum definition from which this enumeration could be instantiated, if it is an instantia...

Definition Decl.cpp:5073

bool isClosedNonFlag() const

Returns true if this enum is annotated with neither flag_enum nor enum_extensibility(open).

Definition Decl.cpp:5051

void getValueRange(llvm::APInt &Max, llvm::APInt &Min) const

Calculates the [Min,Max) values the enum can store based on the NumPositiveBits and NumNegativeBits.

Definition Decl.cpp:5123

static ExportDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation ExportLoc)

Definition Decl.cpp:6024

static ExportDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:6029

This represents one expression.

bool isValueDependent() const

Determines whether the value of this expression depends on.

bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const

HasSideEffects - This routine returns true for all those expressions which have any effect other than...

static ExternCContextDecl * Create(const ASTContext &C, TranslationUnitDecl *TU)

Definition Decl.cpp:5482

RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing.

Abstract interface for external sources of AST nodes.

Represents a member of a struct/union/class.

Expr * getInClassInitializer() const

Get the C++11 default member initializer for this member, or null if one has not been set.

Definition Decl.cpp:4721

bool isBitField() const

Determines whether this field is a bitfield.

bool hasInClassInitializer() const

Determine whether this member has a C++11 default member initializer.

FieldDecl(Kind DK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)

unsigned getBitWidthValue() const

Computes the bit width of this field, if this is a bit field.

Definition Decl.cpp:4748

bool isAnonymousStructOrUnion() const

Determines whether this field is a representative for an anonymous struct or union.

Definition Decl.cpp:4711

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition Decl.cpp:4822

bool hasConstantIntegerBitWidth() const

Determines whether the bit width of this field is a constant integer.

Definition Decl.cpp:4743

static FieldDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:4705

void setInClassInitializer(Expr *NewInit)

Set the C++11 in-class initializer for this member.

Definition Decl.cpp:4731

const RecordDecl * getParent() const

Returns the parent of this field declaration, which is the struct in which this field is defined.

bool isZeroSize(const ASTContext &Ctx) const

Determine if this field is a subobject of zero size, that is, either a zero-length bit-field or a fie...

Definition Decl.cpp:4762

InitAndBitWidthStorage * InitAndBitWidth

static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)

Definition Decl.cpp:4696

FieldDecl * getCanonicalDecl() override

Retrieves the canonical declaration of this field.

static bool classofKind(Kind K)

bool isUnnamedBitField() const

Determines whether this is an unnamed bitfield.

bool isZeroLengthBitField() const

Is this a zero-length bit-field?

Definition Decl.cpp:4757

Expr * getBitWidth() const

Returns the expression that represents the bit width, if this field is a bit field.

void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override

Pretty-print the unqualified name of this declaration.

Definition Decl.cpp:4841

const FieldDecl * findCountedByField() const

Find the FieldDecl specified in a FAM's "counted_by" attribute.

Definition Decl.cpp:4851

bool isPotentiallyOverlapping() const

Determine if this field is of potentially-overlapping class type, that is, subobject with the [[no_un...

Definition Decl.cpp:4800

void setCapturedVLAType(const VariableArrayType *VLAType)

Set the captured variable length array type for this field.

Definition Decl.cpp:4831

const VariableArrayType * CapturedVLAType

std::string getAsmString() const

Definition Decl.cpp:5790

const Expr * getAsmStringExpr() const

static FileScopeAsmDecl * Create(ASTContext &C, DeclContext *DC, Expr *Str, SourceLocation AsmLoc, SourceLocation RParenLoc)

Definition Decl.cpp:5778

static FileScopeAsmDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5784

Stashed information about a defaulted/deleted function body.

static DefaultedOrDeletedFunctionInfo * Create(ASTContext &Context, ArrayRef< DeclAccessPair > Lookups, StringLiteral *DeletedMessage=nullptr)

Definition Decl.cpp:3136

void setDeletedMessage(StringLiteral *Message)

Definition Decl.cpp:3178

Represents a function declaration or definition.

unsigned getMemoryFunctionKind() const

Identify a memory copying or setting function.

Definition Decl.cpp:4549

static constexpr unsigned RequiredTypeAwareDeleteParameterCount

Count of mandatory parameters for type aware operator delete.

bool isTargetClonesMultiVersion() const

True if this function is a multiversioned dispatch function as a part of the target-clones functional...

Definition Decl.cpp:3720

bool isMultiVersion() const

True if this function is considered a multiversioned function.

static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin=false, bool isInlineSpecified=false, bool hasWrittenPrototype=true, ConstexprSpecKind ConstexprKind=ConstexprSpecKind::Unspecified, const AssociatedConstraint &TrailingRequiresClause={})

const ParmVarDecl * getParamDecl(unsigned i) const

bool hasTrivialBody() const

Returns whether the function has a trivial body that does not require any specific codegen.

Definition Decl.cpp:3206

DefaultedOrDeletedFunctionInfo * getDefaultedOrDeletedInfo() const

Definition Decl.cpp:3190

unsigned getMinRequiredArguments() const

Returns the minimum number of arguments needed to call this function.

Definition Decl.cpp:3843

bool isFunctionTemplateSpecialization() const

Determine whether this function is a function template specialization.

Definition Decl.cpp:4201

void setPreviousDeclaration(FunctionDecl *PrevDecl)

Definition Decl.cpp:3729

void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)

Definition Decl.cpp:4194

FunctionTemplateDecl * getDescribedFunctionTemplate() const

Retrieves the function template that is described by this function declaration.

Definition Decl.cpp:4189

void setIsPureVirtual(bool P=true)

Definition Decl.cpp:3294

bool isImmediateFunction() const

Definition Decl.cpp:3336

void setDefaultedOrDeletedInfo(DefaultedOrDeletedFunctionInfo *Info)

Definition Decl.cpp:3156

SourceLocation getEllipsisLoc() const

Returns the location of the ellipsis of a variadic function.

SourceRange getReturnTypeSourceRange() const

Attempt to compute an informative source range covering the function return type.

Definition Decl.cpp:4020

bool isDestroyingOperatorDelete() const

Determine whether this is a destroying operator delete.

Definition Decl.cpp:3547

static FunctionDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5567

unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const

Returns a value indicating whether this function corresponds to a builtin function.

Definition Decl.cpp:3758

SourceLocation getPointOfInstantiation() const

Retrieve the (first) point of instantiation of a function template specialization or a member of a cl...

Definition Decl.cpp:4510

bool isMemberLikeConstrainedFriend() const

Determine whether a function is a friend function that cannot be redeclared outside of its class,...

Definition Decl.cpp:3662

bool hasCXXExplicitFunctionObjectParameter() const

Definition Decl.cpp:3861

bool isInlined() const

Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...

bool UsesFPIntrin() const

Determine whether the function was declared in source context that requires constrained FP intrinsics...

bool isNoReturn() const

Determines whether this function is known to be 'noreturn', through an attribute on its declaration o...

Definition Decl.cpp:3647

ArrayRef< ParmVarDecl * > parameters() const

bool isCPUSpecificMultiVersion() const

True if this function is a multiversioned processor specific function as a part of the cpu_specific/c...

Definition Decl.cpp:3702

FunctionDecl * getTemplateInstantiationPattern(bool ForDefinition=true) const

Retrieve the function declaration from which this function could be instantiated, if it is an instant...

Definition Decl.cpp:4260

bool isMSExternInline() const

The combination of the extern and inline keywords under MSVC forces the function to be required.

Definition Decl.cpp:3887

unsigned getMinRequiredExplicitArguments() const

Returns the minimum number of non-object arguments needed to call this function.

Definition Decl.cpp:3870

bool BodyContainsImmediateEscalatingExpressions() const

LanguageLinkage getLanguageLinkage() const

Compute the language linkage.

Definition Decl.cpp:3610

FunctionTemplateDecl * getPrimaryTemplate() const

Retrieve the primary template that this function template specialization either specializes or was in...

Definition Decl.cpp:4309

bool hasWrittenPrototype() const

Whether this function has a written prototype.

MemberSpecializationInfo * getMemberSpecializationInfo() const

If this function is an instantiation of a member function of a class template specialization,...

Definition Decl.cpp:4168

FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const

If this function is actually a function template specialization, retrieve information about this func...

Definition Decl.cpp:4319

FunctionDecl * getCanonicalDecl() override

Retrieves the "canonical" declaration of the given declaration.

Definition Decl.cpp:3743

FunctionTypeLoc getFunctionTypeLoc() const

Find the source location information for how the type of this function was written.

Definition Decl.cpp:3997

bool isVariadic() const

Whether this function is variadic.

Definition Decl.cpp:3129

bool doesThisDeclarationHaveABody() const

Returns whether this specific declaration of the function has a body.

bool isConstexprSpecified() const

DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const

Definition Decl.cpp:4385

const TemplateArgumentList * getTemplateSpecializationArgs() const

Retrieve the template arguments used to produce this function template specialization from the primar...

Definition Decl.cpp:4325

SourceRange getExceptionSpecSourceRange() const

Attempt to compute an informative source range covering the function exception specification,...

Definition Decl.cpp:4052

bool hasBody() const override

Returns true if this Decl represents a declaration for a body of code, such as a function or method d...

bool isMSVCRTEntryPoint() const

Determines whether this function is a MSVCRT user defined entry point.

Definition Decl.cpp:3371

unsigned getODRHash()

Returns ODRHash of the function.

Definition Decl.cpp:4675

TemplateSpecializationKind getTemplateSpecializationKindForInstantiation() const

Determine the kind of template specialization this function represents for the purpose of template in...

Definition Decl.cpp:4437

FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass S, bool UsesFPIntrin, bool isInlineSpecified, ConstexprSpecKind ConstexprKind, const AssociatedConstraint &TrailingRequiresClause)

Definition Decl.cpp:3075

bool isTemplateInstantiation() const

Determines if the given function was instantiated from a function template.

Definition Decl.cpp:4253

unsigned getNumNonObjectParams() const

Definition Decl.cpp:3865

TemplatedKind

The kind of templated function a FunctionDecl can be.

@ TK_MemberSpecialization

@ TK_DependentNonTemplate

@ TK_FunctionTemplateSpecialization

@ TK_DependentFunctionTemplateSpecialization

UsualDeleteParams getUsualDeleteParams() const

Definition Decl.cpp:3563

StorageClass getStorageClass() const

Returns the storage class as written in the source.

bool isOutOfLine() const override

Determine whether this is or was instantiated from an out-of-line definition of a member function.

Definition Decl.cpp:4522

bool isInlineBuiltinDeclaration() const

Determine if this function provides an inline implementation of a builtin.

Definition Decl.cpp:3522

bool FriendConstraintRefersToEnclosingTemplate() const

TemplatedKind getTemplatedKind() const

What kind of templated function this is.

Definition Decl.cpp:4140

void setInstantiatedFromDecl(FunctionDecl *FD)

Specify that this function declaration was instantiated from a FunctionDecl FD.

Definition Decl.cpp:4207

bool isDeletedAsWritten() const

bool isReservedGlobalPlacementOperator() const

Determines whether this operator new or delete is one of the reserved global placement operators: voi...

Definition Decl.cpp:3399

void setDependentTemplateSpecialization(ASTContext &Context, const UnresolvedSetImpl &Templates, const TemplateArgumentListInfo *TemplateArgs)

Specifies that this function declaration is actually a dependent function template specialization.

Definition Decl.cpp:4374

bool isInExternCContext() const

Determines whether this function's context is, or is nested within, a C++ extern "C" linkage spec.

Definition Decl.cpp:3618

static constexpr unsigned RequiredTypeAwareNewParameterCount

Count of mandatory parameters for type aware operator new.

bool isImplicitlyInstantiable() const

Determines whether this function is a function template specialization or a member of a class templat...

Definition Decl.cpp:4218

bool isExternC() const

Determines whether this function is a function with external, C linkage.

Definition Decl.cpp:3614

Stmt * getBody() const override

getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...

FunctionDecl * getMostRecentDecl()

Returns the most recent (re)declaration of this declaration.

redecl_range redecls() const

Returns an iterator range for all the redeclarations of the same decl.

LazyDeclStmtPtr Body

The body of the function.

bool isImmediateEscalating() const

Definition Decl.cpp:3307

void setIsDestroyingOperatorDelete(bool IsDestroyingDelete)

Definition Decl.cpp:3551

bool isUsableAsGlobalAllocationFunctionInConstantEvaluation(UnsignedOrNone *AlignmentParam=nullptr, bool *IsNothrow=nullptr) const

Determines whether this function is one of the replaceable global allocation functions described in i...

Definition Decl.cpp:3422

DefaultedOrDeletedFunctionInfo * DefaultedOrDeletedInfo

Information about a future defaulted function definition.

bool isTypeAwareOperatorNewOrDelete() const

Determine whether this is a type aware operator new or delete.

Definition Decl.cpp:3555

bool isInExternCXXContext() const

Determines whether this function's context is, or is nested within, a C++ extern "C++" linkage spec.

Definition Decl.cpp:3624

bool isMain() const

Determines whether this function is "main", which is the entry point into an executable program.

Definition Decl.cpp:3364

void setImplicitlyInline(bool I=true)

Flag that this function is implicitly inline.

bool isTargetVersionMultiVersion() const

True if this function is a multiversioned dispatch function as a part of the target-version functiona...

Definition Decl.cpp:3724

void setIsTypeAwareOperatorNewOrDelete(bool IsTypeAwareOperator=true)

Definition Decl.cpp:3559

bool isThisDeclarationInstantiatedFromAFriendDefinition() const

Determine whether this specific declaration of the function is a friend declaration that was instanti...

Definition Decl.cpp:3219

bool isCPUDispatchMultiVersion() const

True if this function is a multiversioned dispatch function as a part of the cpu_specific/cpu_dispatc...

Definition Decl.cpp:3698

bool isDefaulted() const

Whether this function is defaulted.

bool isReferenceableKernel() const

Definition Decl.cpp:5574

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition Decl.cpp:4545

FunctionDecl * getInstantiatedFromDecl() const

Definition Decl.cpp:4213

void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())

Determine what kind of template instantiation this function represents.

Definition Decl.cpp:4482

const IdentifierInfo * getLiteralIdentifier() const

getLiteralIdentifier - The literal suffix identifier this function represents, if any.

Definition Decl.cpp:4134

OverloadedOperatorKind getOverloadedOperator() const

getOverloadedOperator - Which C++ overloaded operator this function represents, if any.

Definition Decl.cpp:4126

TemplateSpecializationKind getTemplateSpecializationKind() const

Determine what kind of template instantiation this function represents.

Definition Decl.cpp:4413

bool doesDeclarationForceExternallyVisibleDefinition() const

For a function declaration in C or C++, determine whether this declaration causes the definition to b...

Definition Decl.cpp:3937

bool isTargetMultiVersion() const

True if this function is a multiversioned dispatch function as a part of the target functionality.

Definition Decl.cpp:3706

bool isAnalyzerNoReturn() const

Determines whether this function is known to be 'noreturn' for analyzer, through an analyzer_noreturn...

Definition Decl.cpp:3658

void setBody(Stmt *B)

Definition Decl.cpp:3287

bool isGlobal() const

Determines whether this is a global function.

Definition Decl.cpp:3628

bool hasOneParamOrDefaultArgs() const

Determine whether this function has a single parameter, or multiple parameters where all but the firs...

Definition Decl.cpp:3875

void setDeletedAsWritten(bool D=true, StringLiteral *Message=nullptr)

Definition Decl.cpp:3165

bool isTargetMultiVersionDefault() const

True if this function is the default version of a multiversioned dispatch function as a part of the t...

Definition Decl.cpp:3711

FunctionDecl * getInstantiatedFromMemberFunction() const

If this function is an instantiation of a member function of a class template specialization,...

Definition Decl.cpp:4161

bool isInlineDefinitionExternallyVisible() const

For an inline function definition in C, or for a gnu_inline function in C++, determine whether the de...

Definition Decl.cpp:4074

unsigned getNumParams() const

Return the number of parameters this function must have based on its FunctionType.

Definition Decl.cpp:3822

DeclarationNameInfo getNameInfo() const

Redeclarable< FunctionDecl > redeclarable_base

bool hasBody(const FunctionDecl *&Definition) const

Returns true if the function has a body.

Definition Decl.cpp:3195

SourceRange getParametersSourceRange() const

Attempt to compute an informative source range covering the function parameters, including the ellips...

Definition Decl.cpp:4036

FunctionDecl * getPreviousDecl()

Return the previous declaration of this declaration or NULL if this is the first declaration.

bool isInlineSpecified() const

Determine whether the "inline" keyword was specified for this function.

MultiVersionKind getMultiVersionKind() const

Gets the kind of multiversioning attribute this declaration has.

Definition Decl.cpp:3684

void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const override

Appends a human-readable name for this declaration into the given stream.

Definition Decl.cpp:3121

bool willHaveBody() const

True if this function will eventually have a body, once it's fully parsed.

const ASTTemplateArgumentListInfo * getTemplateSpecializationArgsAsWritten() const

Retrieve the template argument list as written in the sources, if any.

Definition Decl.cpp:4335

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

param_type_iterator param_type_begin() const

unsigned getNumParams() const

bool isVariadic() const

Whether this function prototype is variadic.

param_type_iterator param_type_end() const

Declaration of a template function.

Provides information about a function template specialization, which is a FunctionDecl that has been ...

TemplateArgumentList * TemplateArguments

The template arguments used to produce the function template specialization from the function templat...

FunctionTemplateDecl * getTemplate() const

Retrieve the template from which this function was specialized.

static FunctionTemplateSpecializationInfo * Create(ASTContext &C, FunctionDecl *FD, FunctionTemplateDecl *Template, TemplateSpecializationKind TSK, TemplateArgumentList *TemplateArgs, const TemplateArgumentListInfo *TemplateArgsAsWritten, SourceLocation POI, MemberSpecializationInfo *MSInfo)

bool isExplicitInstantiationOrSpecialization() const

True if this declaration is an explicit specialization, explicit instantiation declaration,...

Wrapper for source info for functions.

SourceRange getExceptionSpecRange() const

TypeLoc getReturnLoc() const

FunctionType - C99 6.7.5.3 - Function Declarators.

@ SME_PStateSMEnabledMask

static ArmStateValue getArmZT0State(unsigned AttrBits)

static ArmStateValue getArmZAState(unsigned AttrBits)

static std::string ExtractStringFromGCCAsmStmtComponent(const Expr *E)

HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.

buffer_decl_iterator buffer_decls_begin() const

Definition Decl.cpp:5899

static HLSLBufferDecl * Create(ASTContext &C, DeclContext *LexicalParent, bool CBuffer, SourceLocation KwLoc, IdentifierInfo *ID, SourceLocation IDLoc, SourceLocation LBrace)

Definition Decl.cpp:5839

void addLayoutStruct(CXXRecordDecl *LS)

Definition Decl.cpp:5879

bool buffer_decls_empty()

Definition Decl.cpp:5911

llvm::concat_iterator< Decl *const, SmallVector< Decl * >::const_iterator, decl_iterator > buffer_decl_iterator

static HLSLBufferDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5873

buffer_decl_iterator buffer_decls_end() const

Definition Decl.cpp:5905

static HLSLBufferDecl * CreateDefaultCBuffer(ASTContext &C, DeclContext *LexicalParent, ArrayRef< Decl * > DefaultCBufferDecls)

Definition Decl.cpp:5862

static HLSLRootSignatureDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, IdentifierInfo *ID, llvm::dxbc::RootSignatureVersion Version, ArrayRef< llvm::hlsl::rootsig::RootElement > RootElements)

Definition Decl.cpp:5925

static HLSLRootSignatureDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5940

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

ReservedIdentifierStatus isReserved(const LangOptions &LangOpts) const

Determine whether this is a name reserved for the implementation (C99 7.1.3, C++ [lib....

bool isStr(const char(&Str)[StrLen]) const

Return true if this is the identifier for the specified string.

ImplicitParamDecl(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, const IdentifierInfo *Id, QualType Type, ImplicitParamKind ParamKind)

static ImplicitParamDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, ImplicitParamKind ParamKind)

Create implicit parameter.

Definition Decl.cpp:5536

static ImplicitParamDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5548

static ImportDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, Module *Imported, ArrayRef< SourceLocation > IdentifierLocs)

Create a new module import declaration.

Definition Decl.cpp:5980

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition Decl.cpp:6011

static ImportDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumLocations)

Create a new, deserialized module import declaration.

Definition Decl.cpp:5998

ArrayRef< SourceLocation > getIdentifierLocs() const

Retrieves the locations of each of the identifiers that make up the complete module name in the impor...

Definition Decl.cpp:6004

Module * getImportedModule() const

Retrieve the module that was imported by the import declaration.

static ImportDecl * CreateImplicit(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, Module *Imported, SourceLocation EndLoc)

Create a new module import declaration for an implicitly-generated import.

Definition Decl.cpp:5988

static bool classofKind(Kind K)

static IndirectFieldDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5680

static IndirectFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, const IdentifierInfo *Id, QualType T, MutableArrayRef< NamedDecl * > CH)

Definition Decl.cpp:5672

void setMSAsmLabel(StringRef Name)

Definition Decl.cpp:5506

static LabelDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdentL, IdentifierInfo *II)

Definition Decl.cpp:5489

static LabelDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5501

@ Microsoft

Use Microsoft C++ ABI rules for bit-field layout and fundamental types alignment.

@ Default

Use default layout rules of the target.

RegisterStaticDestructorsKind

Controls which variables have static destructors registered.

Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...

LinkageInfo getTypeLinkageAndVisibility(const Type *T)

LinkageInfo computeLVForDecl(const NamedDecl *D, LVComputationKind computation, bool IgnoreVarTypeLinkage=false)

Definition Decl.cpp:1459

LinkageInfo getLVForDecl(const NamedDecl *D, LVComputationKind computation)

getLVForDecl - Get the linkage and visibility for the given declaration.

Definition Decl.cpp:1577

LinkageInfo getDeclLinkageAndVisibility(const NamedDecl *D)

Definition Decl.cpp:1626

Visibility getVisibility() const

static LinkageInfo external()

static LinkageInfo none()

void setLinkage(Linkage L)

void mergeExternalVisibility(Linkage L)

void mergeMaybeWithVisibility(LinkageInfo other, bool withVis)

Merge linkage and conditionally merge visibility.

Linkage getLinkage() const

static LinkageInfo internal()

static LinkageInfo visible_none()

static LinkageInfo uniqueExternal()

void mergeVisibility(Visibility newVis, bool newExplicit)

Merge in the visibility 'newVis'.

bool isVisibilityExplicit() const

void merge(LinkageInfo other)

Merge both linkage and visibility.

Provides information a specialization of a member of a class template, which may be a member function...

void setTemplateSpecializationKind(TemplateSpecializationKind TSK)

Set the template specialization kind.

TemplateSpecializationKind getTemplateSpecializationKind() const

Determine what kind of template specialization this is.

SourceLocation getPointOfInstantiation() const

Retrieve the first point of instantiation of this member.

void setPointOfInstantiation(SourceLocation POI)

Set the first point of instantiation.

NamedDecl * getInstantiatedFrom() const

Retrieve the member declaration from which this member was instantiated.

Describes a module or submodule.

Module * Parent

The parent of this module.

ModuleKind Kind

The kind of this module.

@ ModuleImplementationUnit

This is a C++20 module implementation unit.

@ ModuleMapModule

This is a module that was defined by a module map and built out of header files.

@ ImplicitGlobalModuleFragment

This is an implicit fragment of the global module which contains only language linkage declarations (...

@ ModulePartitionInterface

This is a C++20 module partition interface.

@ ModuleInterfaceUnit

This is a C++20 module interface unit.

@ ModuleHeaderUnit

This is a C++20 header unit.

@ ModulePartitionImplementation

This is a C++20 module partition implementation.

@ PrivateModuleFragment

This is the private module fragment within some C++ module.

@ ExplicitGlobalModuleFragment

This is the explicit Global Module Fragment of a modular TU.

This represents a decl that may have a name.

NamedDecl * getUnderlyingDecl()

Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.

ExplicitVisibilityKind

Kinds of explicit visibility.

@ VisibilityForValue

Do an LV computation for, ultimately, a non-type declaration.

@ VisibilityForType

Do an LV computation for, ultimately, a type.

Linkage getLinkageInternal() const

Determine what kind of linkage this entity has.

Definition Decl.cpp:1182

IdentifierInfo * getIdentifier() const

Get the identifier that names this declaration, if there is one.

NamedDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N)

LinkageInfo getLinkageAndVisibility() const

Determines the linkage and visibility of this entity.

Definition Decl.cpp:1226

bool isLinkageValid() const

True if the computed linkage is valid.

Definition Decl.cpp:1085

StringRef getName() const

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

bool isPlaceholderVar(const LangOptions &LangOpts) const

Definition Decl.cpp:1095

DeclarationName getDeclName() const

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

std::string getQualifiedNameAsString() const

Definition Decl.cpp:1680

std::optional< Visibility > getExplicitVisibility(ExplicitVisibilityKind kind) const

If visibility was explicitly specified for this declaration, return that visibility.

Definition Decl.cpp:1313

NamedDecl * getMostRecentDecl()

virtual void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const

Appends a human-readable name for this declaration into the given stream.

Definition Decl.cpp:1841

bool declarationReplaces(const NamedDecl *OldD, bool IsKnownNewer=true) const

Determine whether this declaration, if known to be well-formed within its context,...

Definition Decl.cpp:1865

ObjCStringFormatFamily getObjCFStringFormattingFamily() const

Definition Decl.cpp:1169

Linkage getFormalLinkage() const

Get the linkage from a semantic point of view.

Definition Decl.cpp:1206

void printQualifiedName(raw_ostream &OS) const

Returns a human-readable qualified name for this declaration, like A::B::i, for i being member of nam...

Definition Decl.cpp:1687

virtual void printName(raw_ostream &OS, const PrintingPolicy &Policy) const

Pretty-print the unqualified name of this declaration.

Definition Decl.cpp:1672

bool isCXXInstanceMember() const

Determine whether the given declaration is an instance member of a C++ class.

Definition Decl.cpp:1969

bool hasLinkage() const

Determine whether this declaration has linkage.

Definition Decl.cpp:1937

ReservedIdentifierStatus isReserved(const LangOptions &LangOpts) const

Determine if the declaration obeys the reserved identifier rules of the given language.

Definition Decl.cpp:1132

bool isCXXClassMember() const

Determine whether this declaration is a C++ class member.

void printNestedNameSpecifier(raw_ostream &OS) const

Print only the nested name specifier part of a fully-qualified name, including the '::' at the end.

Definition Decl.cpp:1714

Represent a C++ namespace.

A C++ nested-name-specifier augmented with source location information.

bool containsType(SanitizerMask Mask, StringRef MangledTypeName, StringRef Category=StringRef()) const

bool containsLocation(SanitizerMask Mask, SourceLocation Loc, StringRef Category=StringRef()) const

void AddEnumDecl(const EnumDecl *Enum)

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

void AddRecordDecl(const RecordDecl *Record)

Represents a partial function definition.

bool isNothrow() const

Definition Decl.cpp:5611

static OutlinedFunctionDecl * Create(ASTContext &C, DeclContext *DC, unsigned NumParams)

Definition Decl.cpp:5592

void setNothrow(bool Nothrow=true)

Definition Decl.cpp:5612

static OutlinedFunctionDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumParams)

Definition Decl.cpp:5600

Stmt * getBody() const override

getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...

Definition Decl.cpp:5606

void setBody(Stmt *B)

Definition Decl.cpp:5609

Represents a parameter to a function.

void setDefaultArg(Expr *defarg)

Definition Decl.cpp:3018

static ParmVarDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:2970

ParmVarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)

bool hasUnparsedDefaultArg() const

Determines whether this parameter has a default argument that has not yet been parsed.

SourceRange getDefaultArgRange() const

Retrieve the source range that covers the entire default argument.

Definition Decl.cpp:3023

void setUninstantiatedDefaultArg(Expr *arg)

Definition Decl.cpp:3043

bool hasUninstantiatedDefaultArg() const

bool isDestroyedInCallee() const

Determines whether this parameter is destroyed in the callee function.

Definition Decl.cpp:2991

bool hasInheritedDefaultArg() const

bool isExplicitObjectParameter() const

QualType getOriginalType() const

Definition Decl.cpp:2962

static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)

Definition Decl.cpp:2953

Expr * getDefaultArg()

Definition Decl.cpp:3006

Expr * getUninstantiatedDefaultArg()

Definition Decl.cpp:3048

bool hasDefaultArg() const

Determines whether this parameter has a default argument, either parsed or not.

Definition Decl.cpp:3054

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition Decl.cpp:2976

Represents a #pragma detect_mismatch line.

static PragmaDetectMismatchDecl * Create(const ASTContext &C, TranslationUnitDecl *DC, SourceLocation Loc, StringRef Name, StringRef Value)

Definition Decl.cpp:5459

static PragmaDetectMismatchDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NameValueSize)

Definition Decl.cpp:5474

void print(raw_ostream &OS) const override

Definition Decl.cpp:80

virtual bool isScopeVisible(const DeclContext *DC) const

When printing type to be inserted into code in specific context, this callback can be used to avoid p...

A (possibly-)qualified type.

bool isNull() const

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

const Type * getTypePtr() const

Retrieves a pointer to the underlying (unqualified) type.

void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const

DestructionKind isDestructedType() const

Returns a nonzero value if objects of this type require non-trivial work to clean up after.

unsigned getCVRQualifiers() const

Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.

Represents a struct/union/class.

bool hasLoadedFieldsFromExternalStorage() const

unsigned getODRHash()

Get precomputed ODRHash or add a new one.

Definition Decl.cpp:5352

bool isLambda() const

Determine whether this record is a class describing a lambda function object.

Definition Decl.cpp:5180

bool isMsStruct(const ASTContext &C) const

Get whether or not this is an ms_struct which can be turned on with an attribute, pragma,...

Definition Decl.cpp:5246

void setAnonymousStructOrUnion(bool Anon)

RecordDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl)

Definition Decl.cpp:5142

const FieldDecl * findFirstNamedDataMember() const

Finds the first data member which has a name.

Definition Decl.cpp:5338

field_iterator noload_field_begin() const

Definition Decl.cpp:5219

void setArgPassingRestrictions(RecordArgPassingKind Kind)

void setNonTrivialToPrimitiveCopy(bool V)

bool isCapturedRecord() const

Determine whether this record is a record for captured variables in CapturedStmt construct.

Definition Decl.cpp:5186

void setHasNonTrivialToPrimitiveCopyCUnion(bool V)

field_range fields() const

void setHasNonTrivialToPrimitiveDestructCUnion(bool V)

void setHasFlexibleArrayMember(bool V)

void setParamDestroyedInCallee(bool V)

void setNonTrivialToPrimitiveDestroy(bool V)

void setHasObjectMember(bool val)

static RecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr)

Definition Decl.cpp:5166

void setHasVolatileMember(bool val)

void setHasNonTrivialToPrimitiveDefaultInitializeCUnion(bool V)

void reorderDecls(const SmallVectorImpl< Decl * > &Decls)

Definition Decl.cpp:5257

void setIsRandomized(bool V)

static RecordDecl * CreateDeserialized(const ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5173

bool mayInsertExtraPadding(bool EmitRemark=false) const

Whether we are allowed to insert extra padding between fields.

Definition Decl.cpp:5294

static bool classof(const Decl *D)

bool isOrContainsUnion() const

Returns whether this record is a union, or contains (at any nesting level) a union member.

Definition Decl.cpp:5194

virtual void completeDefinition()

Note that the definition of this type is now complete.

Definition Decl.cpp:5225

RecordDecl * getDefinition() const

Returns the RecordDecl that actually defines this struct/union/class.

void setCapturedRecord()

Mark the record as a record for captured variables in CapturedStmt construct.

Definition Decl.cpp:5190

specific_decl_iterator< FieldDecl > field_iterator

void setHasUninitializedExplicitInitFields(bool V)

void setNonTrivialToPrimitiveDefaultInitialize(bool V)

RecordDecl * getDefinitionOrSelf() const

void setHasLoadedFieldsFromExternalStorage(bool val) const

field_iterator field_begin() const

Definition Decl.cpp:5209

Declaration of a redeclarable template.

bool isMemberSpecialization() const

Determines whether this template was a specialization of a member template.

Provides common interface for the Decls that can be redeclared.

TagDecl * getNextRedeclaration() const

void setPreviousDecl(FunctionDecl *PrevDecl)

Encodes a location in the source.

bool isValid() const

Return true if this is a valid SourceLocation object.

This class handles loading and caching of source files into memory.

A trivial tuple used to represent a source range.

SourceLocation getEnd() const

Stmt - This represents one statement.

SourceLocation getEndLoc() const LLVM_READONLY

SourceRange getSourceRange() const LLVM_READONLY

SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...

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

Represents the declaration of a struct/union/class/enum.

void setTagKind(TagKind TK)

void setCompleteDefinitionRequired(bool V=true)

True if this complete decl is required to be complete for some existing use.

SourceRange getBraceRange() const

bool isBeingDefined() const

Return true if this decl is currently being defined.

redecl_range redecls() const

Returns an iterator range for all the redeclarations of the same decl.

TagDecl * getDefinition() const

Returns the TagDecl that actually defines this struct/union/class/enum.

Definition Decl.cpp:4925

void setEmbeddedInDeclarator(bool isInDeclarator)

True if this tag declaration is "embedded" (i.e., defined or declared for the very first time) in the...

bool isCompleteDefinition() const

Return true if this decl has its body fully specified.

redeclarable_base::redecl_iterator redecl_iterator

void startDefinition()

Starts the definition of this tag declaration.

Definition Decl.cpp:4902

TagDecl * getCanonicalDecl() override

Retrieves the "canonical" declaration of the given declaration.

Definition Decl.cpp:4895

void setTypedefNameForAnonDecl(TypedefNameDecl *TDD)

Definition Decl.cpp:4897

SourceLocation getOuterLocStart() const

Return SourceLocation representing start of source range taking into account any outer template decla...

Definition Decl.cpp:4885

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition Decl.cpp:4889

void setBeingDefined(bool V=true)

True if this decl is currently being defined.

void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)

Definition Decl.cpp:4939

void setTemplateParameterListsInfo(ASTContext &Context, ArrayRef< TemplateParameterList * > TPLists)

Definition Decl.cpp:4976

void completeDefinition()

Completes the definition of this tag declaration.

Definition Decl.cpp:4913

void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override

Pretty-print the unqualified name of this declaration.

Definition Decl.cpp:4959

Redeclarable< TagDecl > redeclarable_base

void setFreeStanding(bool isFreeStanding=true)

True if this tag is free standing, e.g. "struct foo;".

redeclarable_base::redecl_range redecl_range

bool isDependentType() const

Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...

TagDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, TagDecl *PrevDecl, SourceLocation StartL)

Definition Decl.cpp:4868

void setCompleteDefinition(bool V=true)

True if this decl has its body fully specified.

bool isMicrosoft() const

Is this ABI an MSVC-compatible ABI?

const llvm::Triple & getTriple() const

Returns the target triple of the primary target.

TargetCXXABI getCXXABI() const

Get the C++ ABI currently in use.

A convenient class for passing around template argument information.

A template argument list.

ArrayRef< TemplateArgument > asArray() const

Produce this as an array ref.

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

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

static TopLevelStmtDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5806

static TopLevelStmtDecl * Create(ASTContext &C, Stmt *Statement)

Definition Decl.cpp:5796

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition Decl.cpp:5812

void setStmt(Stmt *S)

Definition Decl.cpp:5816

The top declaration context.

static TranslationUnitDecl * Create(ASTContext &C)

Definition Decl.cpp:5423

ASTContext & getASTContext() const

void setAnonymousNamespace(NamespaceDecl *D)

Definition Decl.cpp:5427

static TypeAliasDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5754

static TypeAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, TypeSourceInfo *TInfo)

Definition Decl.cpp:5746

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition Decl.cpp:5769

TypeDecl(Kind DK, DeclContext *DC, SourceLocation L, const IdentifierInfo *Id, SourceLocation StartL=SourceLocation())

SourceLocation getBeginLoc() const LLVM_READONLY

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

T getAs() const

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

SourceRange getSourceRange() const LLVM_READONLY

Get the full source range.

SourceLocation getEndLoc() const

Get the end source location.

SourceLocation getBeginLoc() const

Get the begin source location.

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.

CXXRecordDecl * getAsCXXRecordDecl() const

Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...

RecordDecl * getAsRecordDecl() const

Retrieves the RecordDecl this type refers to.

bool isIntegerType() const

isIntegerType() does not include complex integers (a GCC extension).

const T * castAs() const

Member-template castAs.

bool isReferenceType() const

bool isEnumeralType() const

QualType getPointeeType() const

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

DeducedType * getContainedDeducedType() const

Get the DeducedType whose type will be deduced for a variable with an initializer of this type.

const T * getAsCanonical() const

If this type is canonically the specified type, return its canonical type cast to that specified type...

Linkage getLinkage() const

Determine the linkage of this type.

const T * getAs() const

Member-template getAs'.

static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, TypeSourceInfo *TInfo)

Definition Decl.cpp:5695

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition Decl.cpp:5760

static TypedefDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:5741

Base class for declarations which introduce a typedef-name.

TypeSourceInfo * getTypeSourceInfo() const

QualType getUnderlyingType() const

TagDecl * getAnonDeclWithTypedefName(bool AnyRedecl=false) const

Retrieves the tag declaration for which this is the typedef name for linkage purposes,...

Definition Decl.cpp:5704

A set of unresolved declarations.

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

ValueDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T)

bool isParameterPack() const

Determine whether this value is actually a function parameter pack, init-capture pack,...

Definition Decl.cpp:5527

bool isWeak() const

Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr.

Definition Decl.cpp:5515

bool isInitCapture() const

Whether this variable is the implicit variable for a lambda init-capture.

Definition Decl.cpp:5521

Represents a variable declaration or definition.

VarTemplateDecl * getDescribedVarTemplate() const

Retrieves the variable template that is described by this variable declaration.

Definition Decl.cpp:2817

static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)

Definition Decl.cpp:2158

Stmt ** getInitAddress()

Retrieve the address of the initializer expression.

Definition Decl.cpp:2429

DefinitionKind isThisDeclarationADefinition() const

bool isConstexpr() const

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

void setInstantiationOfStaticDataMember(VarDecl *VD, TemplateSpecializationKind TSK)

Specify that this variable is an instantiation of the static data member VD.

Definition Decl.cpp:2942

TLSKind getTLSKind() const

Definition Decl.cpp:2175

bool hasInit() const

Definition Decl.cpp:2405

bool hasICEInitializer(const ASTContext &Context) const

Determine whether the initializer of this variable is an integer constant expression.

Definition Decl.cpp:2643

ParmVarDeclBitfields ParmVarDeclBits

VarDecl * getMostRecentDecl()

Returns the most recent (re)declaration of this declaration.

DefinitionKind hasDefinition() const

static const char * getStorageClassSpecifierString(StorageClass SC)

Return the string used to specify the storage class SC.

Definition Decl.cpp:2128

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition Decl.cpp:2197

bool isOutOfLine() const override

Determine whether this is or was instantiated from an out-of-line definition of a static data member.

Definition Decl.cpp:2468

VarDecl * getCanonicalDecl() override

Retrieves the "canonical" declaration of the given declaration.

Definition Decl.cpp:2264

bool hasFlexibleArrayInit(const ASTContext &Ctx) const

Whether this variable has a flexible array member initialized with one or more elements.

Definition Decl.cpp:2869

bool isNoDestroy(const ASTContext &) const

Is destruction of this variable entirely suppressed?

Definition Decl.cpp:2843

bool isInitCapture() const

Whether this variable is the implicit variable for a lambda init-capture.

void setStorageClass(StorageClass SC)

Definition Decl.cpp:2170

bool hasInitWithSideEffects() const

Checks whether this declaration has an initializer with side effects.

Definition Decl.cpp:2451

APValue * evaluateValue() const

Attempt to evaluate the value of the initializer attached to this declaration, and produce notes expl...

Definition Decl.cpp:2582

bool isStaticDataMember() const

Determines whether this is a static data member.

redecl_range redecls() const

Returns an iterator range for all the redeclarations of the same decl.

static VarDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)

Definition Decl.cpp:2164

VarDecl * getTemplateInstantiationPattern() const

Retrieve the variable declaration from which this variable could be instantiated, if it is an instant...

Definition Decl.cpp:2721

bool hasGlobalStorage() const

Returns true for all variables that do not have local storage.

VarDeclBitfields VarDeclBits

CharUnits getFlexibleArrayInitChars(const ASTContext &Ctx) const

If hasFlexibleArrayInit is true, compute the number of additional bytes necessary to store those elem...

Definition Decl.cpp:2884

bool hasConstantInitialization() const

Determine whether this variable has constant initialization.

Definition Decl.cpp:2655

LanguageLinkage getLanguageLinkage() const

Compute the language linkage.

Definition Decl.cpp:2248

EvaluatedStmt * getEvaluatedStmt() const

Definition Decl.cpp:2578

bool mightBeUsableInConstantExpressions(const ASTContext &C) const

Determine whether this variable's value might be usable in a constant expression, according to the re...

Definition Decl.cpp:2493

EvaluatedStmt * ensureEvaluatedStmt() const

Convert the initializer for this declaration to the elaborated EvaluatedStmt form,...

Definition Decl.cpp:2564

VarDecl * getInstantiatedFromStaticDataMember() const

If this variable is an instantiated static data member of a class template specialization,...

Definition Decl.cpp:2779

bool isFileVarDecl() const

Returns true for file scoped variable declaration.

void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())

For a static data member that was instantiated from a static data member of a class template,...

Definition Decl.cpp:2914

QualType::DestructionKind needsDestruction(const ASTContext &Ctx) const

Would the destruction of this variable have any effect, and if so, what kind?

Definition Decl.cpp:2858

bool checkForConstantInitialization(SmallVectorImpl< PartialDiagnosticAt > &Notes) const

Evaluate the initializer of this variable to determine whether it's a constant initializer.

Definition Decl.cpp:2671

bool isInline() const

Whether this variable is (C++1z) inline.

const Expr * getInit() const

bool isNonEscapingByref() const

Indicates the capture is a __block variable that is never captured by an escaping block.

Definition Decl.cpp:2709

bool isInExternCContext() const

Determines whether this variable's context is, or is nested within, a C++ extern "C" linkage spec.

Definition Decl.cpp:2256

NonParmVarDeclBitfields NonParmVarDeclBits

bool hasExternalStorage() const

Returns true if a variable has extern or private_extern storage.

InitType Init

The initializer for this variable or, for a ParmVarDecl, the C++ default argument.

Redeclarable< VarDecl > redeclarable_base

APValue * getEvaluatedValue() const

Return the already-evaluated value of this variable's initializer, or NULL if the value is not yet kn...

Definition Decl.cpp:2635

VarDecl * getInitializingDeclaration()

Get the initializing declaration of this variable, if any.

Definition Decl.cpp:2436

TLSKind

Kinds of thread-local storage.

@ TLS_Static

TLS with a known-constant initializer.

@ TLS_Dynamic

TLS with a dynamic initializer.

@ TLS_None

Not a TLS variable.

void setInit(Expr *I)

Definition Decl.cpp:2484

VarDecl * getActingDefinition()

Get the tentative definition that acts as the real definition in a TU.

Definition Decl.cpp:2352

@ TentativeDefinition

This declaration is a tentative definition.

@ DeclarationOnly

This declaration is only a declaration.

@ Definition

This declaration is definitely a definition.

void setDescribedVarTemplate(VarTemplateDecl *Template)

Definition Decl.cpp:2822

bool isExternC() const

Determines whether this variable is a variable with external, C linkage.

Definition Decl.cpp:2252

VarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass SC)

Definition Decl.cpp:2141

StorageDuration getStorageDuration() const

Get the storage duration of this variable, per C++ [basic.stc].

StorageClass getStorageClass() const

Returns the storage class as written in the source.

bool isEscapingByref() const

Indicates the capture is a __block variable that is captured by a block that can potentially escape (...

Definition Decl.cpp:2705

bool isThisDeclarationADemotedDefinition() const

If this definition should pretend to be a declaration.

VarDecl * getPreviousDecl()

Return the previous declaration of this declaration or NULL if this is the first declaration.

bool isUsableInConstantExpressions(const ASTContext &C) const

Determine whether this variable's value can be used in a constant expression, according to the releva...

Definition Decl.cpp:2535

bool isInExternCXXContext() const

Determines whether this variable's context is, or is nested within, a C++ extern "C++" linkage spec.

Definition Decl.cpp:2260

SourceLocation getPointOfInstantiation() const

If this variable is an instantiation of a variable template or a static data member of a class templa...

Definition Decl.cpp:2807

bool hasDependentAlignment() const

Determines if this variable's alignment is dependent.

Definition Decl.cpp:2713

TemplateSpecializationKind getTemplateSpecializationKindForInstantiation() const

Get the template specialization kind of this variable for the purposes of template instantiation.

Definition Decl.cpp:2797

VarDecl * getDefinition()

TemplateSpecializationKind getTemplateSpecializationKind() const

If this variable is an instantiation of a variable template or a static data member of a class templa...

Definition Decl.cpp:2786

const Expr * getAnyInitializer() const

Get the initializer for this variable, no matter which declaration it is attached to.

bool isKnownToBeDefined() const

Definition Decl.cpp:2826

MemberSpecializationInfo * getMemberSpecializationInfo() const

If this variable is an instantiation of a static data member of a class template specialization,...

Definition Decl.cpp:2905

Declaration of a variable template.

VarDecl * getTemplatedDecl() const

Get the underlying variable declarations of the template.

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

const TemplateArgumentList & getTemplateArgs() const

Retrieve the template arguments of the variable template specialization.

VarTemplateDecl * getSpecializedTemplate() const

Retrieve the template that this specialization specializes.

bool isExplicitInstantiationOrSpecialization() const

True if this declaration is an explicit specialization, explicit instantiation declaration,...

bool isExplicitSpecialization() const

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

Defines the Linkage enumeration and various utility functions.

Defines the clang::TargetInfo interface.

const internal::VariadicAllOfMatcher< Type > type

Matches Types in the clang AST.

const internal::VariadicAllOfMatcher< Decl > decl

Matches declarations.

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.

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

OverloadedOperatorKind

Enumeration specifying the different kinds of C++ overloaded operators.

@ OO_None

Not an overloaded operator.

bool isa(CodeGen::Address addr)

bool isTemplateInstantiation(TemplateSpecializationKind Kind)

Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...

LazyOffsetPtr< Stmt, uint64_t, &ExternalASTSource::GetExternalDeclStmt > LazyDeclStmtPtr

A lazy pointer to a statement.

@ GVA_AvailableExternally

bool isReservedInAllContexts(ReservedIdentifierStatus Status)

Determine whether an identifier is reserved in all contexts.

ConstexprSpecKind

Define the kind of constexpr specifier.

Decl * getPrimaryMergedDecl(Decl *D)

Get the primary declaration for a declaration from an AST file.

Definition Decl.cpp:76

InClassInitStyle

In-class initialization styles for non-static data members.

@ ICIS_NoInit

No in-class initializer.

Linkage getFormalLinkage(Linkage L)

nullptr

This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...

LanguageLinkage

Describes the different kinds of language linkage (C++ [dcl.link]) that an entity may have.

StorageClass

Storage classes.

@ TSCS_thread_local

C++11 thread_local.

@ TSCS__Thread_local

C11 _Thread_local.

@ TSCS___thread

GNU __thread.

Linkage

Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.

@ VisibleNone

No linkage according to the standard, but is visible from other translation units because of types de...

@ None

No linkage, which means that the entity is unique and can only be referred to from within its scope.

@ UniqueExternal

External linkage within a unique namespace.

@ Internal

Internal linkage, which indicates that the entity can be referred to from within the translation unit...

@ External

External linkage, which indicates that the entity can be referred to from other translation units.

@ Module

Module linkage, which indicates that the entity can be referred to from other translation units withi...

@ SD_Automatic

Automatic storage duration (most local variables).

bool isLambdaCallOperator(const CXXMethodDecl *MD)

@ Result

The result type of a method or function.

const FunctionProtoType * T

@ Template

We are parsing a template declaration.

bool hasArmZT0State(const FunctionDecl *FD)

Returns whether the given FunctionDecl has Arm ZT0 state.

Definition Decl.cpp:6054

TagTypeKind

The kind of a tag type.

@ Struct

The "struct" keyword.

@ Enum

The "enum" keyword.

@ VarTemplate

The name was classified as a variable template name.

bool isTypeAwareAllocation(TypeAwareAllocationMode Mode)

@ CanPassInRegs

The argument of this type can be passed directly in registers.

bool isLegalForVariable(StorageClass SC)

Checks whether the given storage class is legal for variables.

bool isReservedAtGlobalScope(ReservedIdentifierStatus Status)

Determine whether an identifier is reserved for use as a name at global scope.

bool isExternalFormalLinkage(Linkage L)

TemplateSpecializationKind

Describes the kind of template specialization that a particular template specialization declaration r...

@ TSK_ExplicitInstantiationDefinition

This template specialization was instantiated from a template due to an explicit instantiation defini...

@ TSK_ExplicitInstantiationDeclaration

This template specialization was instantiated from a template due to an explicit instantiation declar...

@ TSK_ExplicitSpecialization

This template specialization was declared or defined by an explicit specialization (C++ [temp....

@ TSK_ImplicitInstantiation

This template specialization was implicitly instantiated from a template.

@ TSK_Undeclared

This template specialization was formed from a template-id but has not yet been declared,...

U cast(CodeGen::Address addr)

@ Enum

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

bool IsArmStreamingFunction(const FunctionDecl *FD, bool IncludeLocallyStreaming)

Returns whether the given FunctionDecl has an __arm[_locally]_streaming attribute.

Definition Decl.cpp:6033

@ StartsWithUnderscoreAndIsExternC

bool isExternallyVisible(Linkage L)

ImplicitParamKind

Defines the kind of the implicit parameter: is this an implicit parameter with pointer to 'this',...

@ Other

Other implicit parameter.

Visibility

Describes the different kinds of visibility that a declaration may have.

@ HiddenVisibility

Objects with "hidden" visibility are not seen by the dynamic linker.

@ ProtectedVisibility

Objects with "protected" visibility are seen by the dynamic linker but always dynamically resolve to ...

@ DefaultVisibility

Objects with "default" visibility are seen by the dynamic linker and act like normal objects.

bool isGenericLambdaCallOperatorSpecialization(const CXXMethodDecl *MD)

bool hasArmZAState(const FunctionDecl *FD)

Returns whether the given FunctionDecl has Arm ZA state.

Definition Decl.cpp:6047

Represents an explicit template argument list in C++, e.g., the "" in "sort".

static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)

A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...

DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...

SourceLocation getBeginLoc() const

getBeginLoc - Retrieve the location of the first token.

Structure used to store a statement, the constant value to which it was evaluated (if any),...

bool HasConstantDestruction

Whether this variable is known to have constant destruction.

bool WasEvaluated

Whether this statement was already evaluated.

bool CheckedForSideEffects

bool IsEvaluating

Whether this statement is being evaluated.

bool HasConstantInitialization

Whether this variable is known to have constant initialization.

bool HasICEInit

In C++98, whether the initializer is an ICE.

bool isTypeVisibility() const

unsigned IgnoreExplicitVisibility

Whether explicit visibility attributes should be ignored.

unsigned IgnoreAllVisibility

Whether all visibility should be ignored.

static LVComputationKind forLinkageOnly()

Do an LV computation when we only care about the linkage.

bool isValueVisibility() const

bool isOffset() const

Whether this pointer is currently stored as an offset.

T * get(ExternalASTSource *Source) const

Retrieve the pointer to the AST node that this lazy pointer points to.

Describes how types, statements, expressions, and declarations should be printed.

unsigned SuppressUnwrittenScope

Suppress printing parts of scope specifiers that are never written, e.g., for anonymous namespaces.

unsigned MSVCFormatting

Use whitespace and punctuation like MSVC does.

unsigned SuppressInlineNamespace

Suppress printing parts of scope specifiers that correspond to inline namespaces.

const PrintingCallbacks * Callbacks

Callbacks to use to allow the behavior of printing to be customized.

TemplateParameterList ** TemplParamLists

A new-allocated array of size NumTemplParamLists, containing pointers to the "outer" template paramet...

unsigned NumTemplParamLists

The number of "outer" template parameter lists.

void setTemplateParameterListsInfo(ASTContext &Context, ArrayRef< TemplateParameterList * > TPLists)

Sets info about "outer" template parameter lists.

Definition Decl.cpp:2108

The parameters to pass to a usual operator delete.

TypeAwareAllocationMode TypeAwareDelete

AlignedAllocationMode Alignment