clang: include/clang/AST/DeclTemplate.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_CLANG_AST_DECLTEMPLATE_H

15#define LLVM_CLANG_AST_DECLTEMPLATE_H

16

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

30#include "llvm/ADT/FoldingSet.h"

31#include "llvm/ADT/PointerIntPair.h"

32#include "llvm/ADT/PointerUnion.h"

33#include "llvm/ADT/iterator.h"

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

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

36#include "llvm/Support/Compiler.h"

37#include "llvm/Support/TrailingObjects.h"

38#include

39#include

40#include

41#include

42#include

43#include

44

46

48class ClassTemplateDecl;

49class ClassTemplatePartialSpecializationDecl;

50class Expr;

51class FunctionTemplateDecl;

52class IdentifierInfo;

53class NonTypeTemplateParmDecl;

54class TemplateDecl;

55class TemplateTemplateParmDecl;

56class TemplateTypeParmDecl;

57class ConceptDecl;

58class UnresolvedSetImpl;

59class VarTemplateDecl;

60class VarTemplatePartialSpecializationDecl;

61

62

66

68

69

70

72 : private llvm::TrailingObjects<TemplateParameterList, NamedDecl *,

73 Expr *> {

74

76

77

79

80

82

83

84

85 unsigned NumParams : 29;

86

87

88

89 LLVM_PREFERRED_TYPE(bool)

90 unsigned ContainsUnexpandedParameterPack : 1;

91

92

93 LLVM_PREFERRED_TYPE(bool)

94 unsigned HasRequiresClause : 1;

95

96

97

98 LLVM_PREFERRED_TYPE(bool)

99 unsigned HasConstrainedParameters : 1;

100

101protected:

105

107 return NumParams;

108 }

109

111 return HasRequiresClause ? 1 : 0;

112 }

113

114public:

115 template <size_t N, bool HasRequiresClause>

118

124 Expr *RequiresClause);

125

127

128

130

131

133

134 iterator begin() { return getTrailingObjects<NamedDecl *>(); }

138

139 unsigned size() const { return NumParams; }

140 bool empty() const { return NumParams == 0; }

141

145 }

146

148 assert(Idx < size() && "Template parameter index out-of-range");

149 return begin()[Idx];

150 }

152 assert(Idx < size() && "Template parameter index out-of-range");

153 return begin()[Idx];

154 }

155

156

157

158

159

160

162

163

164

165

166

167

169

170

171

173

174

177 if (P->isParameterPack())

178 return true;

179 return false;

180 }

181

182

184 return HasRequiresClause ? getTrailingObjects<Expr *>()[0] : nullptr;

185 }

186

187

189 return HasRequiresClause ? getTrailingObjects<Expr *>()[0] : nullptr;

190 }

191

192

193

194

195

196

197

199

201

202

204

208

210 return SourceRange(TemplateLoc, RAngleLoc);

211 }

212

214 bool OmitTemplateKW = false) const;

216 const PrintingPolicy &Policy, bool OmitTemplateKW = false) const;

217

220 unsigned Idx);

221};

222

223

224

225

226template <size_t N, bool HasRequiresClause>

228 : public TemplateParameterList::FixedSizeStorageOwner {

229 typename TemplateParameterList::FixedSizeStorage<

231 N, HasRequiresClause ? 1u : 0u

233

234public:

240 Expr *RequiresClause)

241 : FixedSizeStorageOwner(

242 (assert(N == Params.size()),

243 assert(HasRequiresClause == (RequiresClause != nullptr)),

245 TemplateLoc, LAngleLoc, Params, RAngleLoc, RequiresClause))) {}

246};

247

248

250 : private llvm::TrailingObjects<TemplateArgumentList, TemplateArgument> {

251

252

253 unsigned NumArguments;

254

255

256

258

259public:

261

264

265

266

269

270

272 assert(Idx < NumArguments && "Invalid template argument index");

273 return data()[Idx];

274 }

275

276

278

279

282 }

283

284

285

286 unsigned size() const { return NumArguments; }

287

288

290 return getTrailingObjects();

291 }

292};

293

295

296

297

298

299

300

301

302

303

304template<typename ParmDecl, typename ArgType>

306

307

308

309 struct Chain {

310 ParmDecl *PrevDeclWithDefaultArg;

312 };

313 static_assert(sizeof(Chain) == sizeof(void *) * 2,

314 "non-pointer argument type?");

315

316 llvm::PointerUnion<ArgType, ParmDecl*, Chain*> ValueOrInherited;

317

318 static ParmDecl *getParmOwningDefaultArg(ParmDecl *Parm) {

320 if (auto *Prev = Storage.ValueOrInherited.template dyn_cast<ParmDecl *>())

321 Parm = Prev;

322 assert(!isa<ParmDecl *>(Parm->getDefaultArgStorage().ValueOrInherited) &&

323 "should only be one level of indirection");

324 return Parm;

325 }

326

327public:

329

330

331 bool isSet() const { return !ValueOrInherited.isNull(); }

332

333

334

335 bool isInherited() const { return isa<ParmDecl *>(ValueOrInherited); }

336

337

338

339 ArgType get() const {

341 if (const auto *Prev = ValueOrInherited.template dyn_cast<ParmDecl *>())

342 Storage = &Prev->getDefaultArgStorage();

343 if (const auto *C = Storage->ValueOrInherited.template dyn_cast<Chain *>())

344 return C->Value;

345 return cast(Storage->ValueOrInherited);

346 }

347

348

349

351 if (const auto *D = ValueOrInherited.template dyn_cast<ParmDecl *>())

352 return D;

353 if (const auto *C = ValueOrInherited.template dyn_cast<Chain *>())

354 return C->PrevDeclWithDefaultArg;

355 return nullptr;

356 }

357

358

359 void set(ArgType Arg) {

360 assert(isSet() && "default argument already set");

361 ValueOrInherited = Arg;

362 }

363

364

366 InheritedFrom = getParmOwningDefaultArg(InheritedFrom);

368 ValueOrInherited = InheritedFrom;

369 else if ([[maybe_unused]] auto *D =

370 ValueOrInherited.template dyn_cast<ParmDecl *>()) {

371 assert(C.isSameDefaultTemplateArgument(D, InheritedFrom));

372 ValueOrInherited =

374 } else if (auto *Inherited =

375 ValueOrInherited.template dyn_cast<Chain *>()) {

376 assert(C.isSameDefaultTemplateArgument(Inherited->PrevDeclWithDefaultArg,

377 InheritedFrom));

378 Inherited->PrevDeclWithDefaultArg = InheritedFrom;

379 } else

381 Chain{InheritedFrom, cast(ValueOrInherited)};

382 }

383

384

386 ValueOrInherited = ArgType();

387 }

388};

389

390

391

392

393

394

395

396

397

398

400 void anchor() override;

401

402protected:

403

406

407

408

411 : TemplateDecl(DK, DC, L, Name, Params, nullptr) {}

412

413public:

416

417

420 }

421

422

423

424

425

427

429

430

432

433

435

436

438

440 return K >= firstTemplate && K <= lastTemplate;

441 }

442

446 }

447

448protected:

451

452public:

455 }

456

457

460 assert(TemplatedDecl == NewTemplatedDecl && "Inconsistent TemplatedDecl");

461 else

463 }

464};

465

466

467

468

470 : public llvm::FoldingSetNode,

471 private llvm::TrailingObjects<FunctionTemplateSpecializationInfo,

472 MemberSpecializationInfo *> {

473

474

475 llvm::PointerIntPair<FunctionDecl *, 1, bool> Function;

476

477

478

479

480

481 llvm::PointerIntPair<FunctionTemplateDecl *, 2> Template;

482

483public:

484

485

487

488

489

491

492

493

495

496private:

502 : Function(FD, MSInfo ? true : false), Template(Template, TSK - 1),

506 if (MSInfo)

507 getTrailingObjects<MemberSpecializationInfo *>()[0] = MSInfo;

508 }

509

510 size_t numTrailingObjects(OverloadToken<MemberSpecializationInfo*>) const {

512 }

513

514public:

516

522

523

525

526

528

529

532 }

533

536 }

537

538

539

540

544 }

545

546

549 "Cannot encode TSK_Undeclared for a function template specialization");

550 Template.setInt(TSK - 1);

551 }

552

553

554

555

556

557

560 }

561

562

563

566 }

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

599 return numTrailingObjects(OverloadToken<MemberSpecializationInfo *>())

600 ? getTrailingObjects<MemberSpecializationInfo *>()[0]

601 : nullptr;

602 }

603

606 }

607

608 static void

611 ID.AddInteger(TemplateArgs.size());

614 }

615};

616

617

618

619

621

622

623 llvm::PointerIntPair<NamedDecl *, 2> MemberAndTSK;

624

625

627

628public:

629 explicit

632 : MemberAndTSK(IF, TSK - 1), PointOfInstantiation(POI) {

634 "Cannot encode undeclared template specializations for members");

635 }

636

637

638

640

641

644 }

645

648 }

649

650

653 "Cannot encode undeclared template specializations for members");

654 MemberAndTSK.setInt(TSK - 1);

655 }

656

657

658

659

661 return PointOfInstantiation;

662 }

663

664

666 PointOfInstantiation = POI;

667 }

668};

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

688

689

690

691

693 : private llvm::TrailingObjects<DependentFunctionTemplateSpecializationInfo,

694 FunctionTemplateDecl *> {

695 friend TrailingObjects;

696

697

698 unsigned NumCandidates;

699

703

704public:

705

707

711

712

714 return {getTrailingObjects<FunctionTemplateDecl *>(), NumCandidates};

715 }

716};

717

718

720 public Redeclarable

721{

723

726 }

727

730 }

731

734 }

735

736 void anchor() override;

737

738protected:

741

743 return D;

744 }

745

747 return D->getTemplateArgs().asArray();

748 }

749 };

750

751 template <typename EntryType, typename SETraits = SpecEntryTraits,

752 typename DeclType = typename SETraits::DeclType>

754 : llvm::iterator_adaptor_base<

755 SpecIterator<EntryType, SETraits, DeclType>,

756 typename llvm::FoldingSetVector::iterator,

757 typename std::iterator_traits<typename llvm::FoldingSetVector<

758 EntryType>::iterator>::iterator_category,

759 DeclType *, ptrdiff_t, DeclType *, DeclType *> {

762 typename llvm::FoldingSetVector::iterator SetIter)

763 : SpecIterator::iterator_adaptor_base(std::move(SetIter)) {}

764

766 return SETraits::getDecl(&*this->I)->getMostRecentDecl();

767 }

768

770 };

771

772 template

773 static SpecIterator

776 }

777

779

782

783 template <class EntryType, typename ...ProfileArguments>

786 void *&InsertPos, ProfileArguments &&...ProfileArgs);

787

788 template <class EntryType, typename... ProfileArguments>

791 void *&InsertPos,

792 ProfileArguments &&...ProfileArgs);

793

794 template <class Derived, class EntryType>

796 EntryType *Entry, void *InsertPos);

797

800

801

802

803

804

805

806 llvm::PointerIntPair<RedeclarableTemplateDecl *, 1, bool>

808 };

809

810

811

813

814

815

816

818

820

821

826

827public:

832

833

836 }

839 }

840

841

842

843

844

845

846

847

848

849

850

851

852

853

854

855

856

857

858

861 }

862

863

865 assert(getCommonPtr()->InstantiatedFromMember.getPointer() &&

866 "Only member templates can be member template specializations");

868 }

869

870

871

872

873

874

875

876

877

878

879

880

881

882

883

884

885

886

887

888

889

890

891

892

893

894

895

896

897

898

899

900

901

902

903

904

905

908 }

909

911 assert(getCommonPtr()->InstantiatedFromMember.getPointer());

913 }

914

915

916

917

918

919

920

924 }

925

928

935

936

938

940 return K >= firstRedeclarableTemplate && K <= lastRedeclarableTemplate;

941 }

942};

943

947

950 }

951

955 }

956};

957

958

960protected:

962

963

964

966

967

968 llvm::FoldingSetVector Specializations;

969

971 };

972

978

980

983 }

984

985

986

987 llvm::FoldingSetVector &

989

990

991

992

993

995 void *InsertPos);

996

997public:

1000

1001

1003

1004

1007 }

1008

1009

1010

1013 }

1014

1015

1016

1018 void *&InsertPos);

1019

1021 return cast(

1023 }

1025 return cast(

1027 }

1028

1029

1030

1032 return cast_or_null(

1034 }

1036 return cast_or_null(

1038 }

1039

1041 return cast(

1044 }

1047 }

1048

1050 return cast_or_null(

1052 }

1053

1055 using spec_range = llvm::iterator_range<spec_iterator>;

1056

1059 }

1060

1063 }

1064

1067 }

1068

1069

1070

1072

1073

1074

1075

1078 }

1079

1080

1082

1083

1089

1090

1093

1094

1097};

1098

1099

1100

1101

1102

1103

1104

1105

1106

1107

1108

1109

1110

1111

1113protected:

1117

1120

1122

1123

1125 "The depth of template parmeter position is more than 2^20!");

1127 "The position of template parmeter position is more than 2^12!");

1128 }

1129

1130public:

1132

1133

1137 "The depth of template parmeter position is more than 2^20!");

1139 }

1140

1141

1145 "The position of template parmeter position is more than 2^12!");

1147 }

1148

1149

1151};

1152

1153

1154

1155

1156

1157

1158

1160 private llvm::TrailingObjects<TemplateTypeParmDecl, TypeConstraint> {

1161

1163 friend TrailingObjects;

1165

1166

1167

1168

1169

1170 bool Typename : 1;

1171

1172

1173 bool HasTypeConstraint : 1;

1174

1175

1176

1177

1178 bool TypeConstraintInitialized : 1;

1179

1180

1181

1182

1183 bool ExpandedParameterPack : 1;

1184

1185

1186 unsigned NumExpanded = 0;

1187

1188

1192

1195 bool HasTypeConstraint,

1196 std::optional NumExpanded)

1198 HasTypeConstraint(HasTypeConstraint), TypeConstraintInitialized(false),

1199 ExpandedParameterPack(NumExpanded),

1200 NumExpanded(NumExpanded.value_or(0)) {}

1201

1202public:

1206 bool Typename, bool ParameterPack, bool HasTypeConstraint = false,

1207 std::optional NumExpanded = std::nullopt);

1212 bool HasTypeConstraint);

1213

1214

1215

1216

1217

1218

1220 return Typename && !HasTypeConstraint;

1221 }

1222

1224

1225

1226

1228

1229

1232 return DefaultArgument.isSet() ? *DefaultArgument.get() : NoneLoc;

1233 }

1234

1235

1237

1238

1239

1242 }

1243

1244

1247

1248

1249

1253 }

1254

1255

1257 DefaultArgument.clear();

1258 }

1259

1260

1261

1263

1264

1266

1267

1269

1270

1272

1273

1274

1275

1276

1279 return false;

1281 if (TC->hasExplicitTemplateArgs())

1282 for (const auto &ArgLoc : TC->getTemplateArgsAsWritten()->arguments())

1283 if (ArgLoc.getArgument().containsUnexpandedParameterPack())

1284 return true;

1285 return false;

1286 }

1287

1288

1289

1290

1291

1292

1293

1294

1295

1296

1297

1298

1299

1300

1301

1302

1303

1304

1305

1306

1307

1308

1310

1311

1313 assert(ExpandedParameterPack && "Not an expansion parameter pack");

1314 return NumExpanded;

1315 }

1316

1317

1318

1320 return TypeConstraintInitialized ? getTrailingObjects() :

1321 nullptr;

1322 }

1323

1325 Expr *ImmediatelyDeclaredConstraint);

1326

1327

1329 return HasTypeConstraint;

1330 }

1331

1332

1333

1334

1335

1336

1338 if (HasTypeConstraint)

1339 AC.push_back(getTypeConstraint()->getImmediatelyDeclaredConstraint());

1340 }

1341

1343

1344

1347};

1348

1349

1350

1351

1352

1353

1357 private llvm::TrailingObjects<NonTypeTemplateParmDecl,

1358 std::pair<QualType, TypeSourceInfo *>,

1359 Expr *> {

1361 friend TrailingObjects;

1362

1363

1364

1368

1369

1370

1371

1372

1373 bool ParameterPack;

1374

1375

1376

1377

1378 bool ExpandedParameterPack = false;

1379

1380

1381 unsigned NumExpandedTypes = 0;

1382

1383 size_t numTrailingObjects(

1384 OverloadToken<std::pair<QualType, TypeSourceInfo *>>) const {

1385 return NumExpandedTypes;

1386 }

1387

1392 : DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id, T, TInfo, StartLoc),

1394

1395 NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation StartLoc,

1396 SourceLocation IdLoc, unsigned D, unsigned P,

1397 const IdentifierInfo *Id, QualType T,

1398 TypeSourceInfo *TInfo,

1399 ArrayRef ExpandedTypes,

1400 ArrayRef<TypeSourceInfo *> ExpandedTInfos);

1401

1402public:

1403 static NonTypeTemplateParmDecl *

1404 Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc,

1405 SourceLocation IdLoc, unsigned D, unsigned P, const IdentifierInfo *Id,

1406 QualType T, bool ParameterPack, TypeSourceInfo *TInfo);

1407

1408 static NonTypeTemplateParmDecl *

1409 Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc,

1410 SourceLocation IdLoc, unsigned D, unsigned P, const IdentifierInfo *Id,

1411 QualType T, TypeSourceInfo *TInfo, ArrayRef ExpandedTypes,

1412 ArrayRef<TypeSourceInfo *> ExpandedTInfos);

1413

1414 static NonTypeTemplateParmDecl *

1417 GlobalDeclID ID,

1418 unsigned NumExpandedTypes,

1419 bool HasTypeConstraint);

1420

1426

1427 SourceRange getSourceRange() const override LLVM_READONLY;

1428

1430

1431

1432

1434

1435

1438 return DefaultArgument.isSet() ? *DefaultArgument.get() : NoneLoc;

1439 }

1440

1441

1443

1444

1445

1448 }

1449

1450

1451

1452

1458 }

1459

1460

1462

1463

1464

1465

1466

1467

1468

1469

1470

1471

1473

1474

1475

1476

1477

1478

1481 }

1482

1483

1484

1485

1486

1487

1488

1489

1490

1491

1492

1493

1494

1495

1496

1497

1498

1499

1500

1501

1502

1503

1504

1505

1506

1508

1509

1510

1512 assert(ExpandedParameterPack && "Not an expansion parameter pack");

1513 return NumExpandedTypes;

1514 }

1515

1516

1517

1519 assert(I < NumExpandedTypes && "Out-of-range expansion type index");

1520 auto TypesAndInfos =

1521 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();

1522 return TypesAndInfos[I].first;

1523 }

1524

1525

1526

1528 assert(I < NumExpandedTypes && "Out-of-range expansion type index");

1529 auto TypesAndInfos =

1530 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();

1531 return TypesAndInfos[I].second;

1532 }

1533

1534

1535

1538 nullptr;

1539 }

1540

1542 *getTrailingObjects<Expr *>() = E;

1543 }

1544

1545

1546

1550 }

1551

1552

1553

1554

1555

1556

1557

1560 AC.push_back(E);

1561 }

1562

1563

1566};

1567

1568

1569

1570

1571

1572

1573

1574

1578 private llvm::TrailingObjects<TemplateTemplateParmDecl,

1579 TemplateParameterList *> {

1580

1584

1585

1586

1587

1588

1589 LLVM_PREFERRED_TYPE(bool)

1590 unsigned Typename : 1;

1591

1592

1593 LLVM_PREFERRED_TYPE(bool)

1594 unsigned ParameterPack : 1;

1595

1596

1597

1598

1599 LLVM_PREFERRED_TYPE(bool)

1600 unsigned ExpandedParameterPack : 1;

1601

1602

1603 unsigned NumExpandedParams = 0;

1604

1608 : TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),

1610 ParameterPack(ParameterPack), ExpandedParameterPack(false) {}

1611

1616

1617 void anchor() override;

1618

1619public:

1623

1626 unsigned P, bool ParameterPack,

1634

1639

1645

1646

1647

1649

1650

1651

1653

1654

1655

1656

1657

1658

1659

1661

1662

1663

1664

1665

1667 return ParameterPack &&

1669 }

1670

1671

1672

1673

1674

1675

1676

1677

1678

1679

1680

1681

1682

1683

1684

1685

1686

1687

1688

1690

1691

1692

1694 assert(ExpandedParameterPack && "Not an expansion parameter pack");

1695 return NumExpandedParams;

1696 }

1697

1698

1699

1701 assert(I < NumExpandedParams && "Out-of-range expansion type index");

1702 return getTrailingObjects<TemplateParameterList *>()[I];

1703 }

1704

1706

1707

1708

1710

1711

1714 return DefaultArgument.isSet() ? *DefaultArgument.get() : NoneLoc;

1715 }

1716

1717

1719

1720

1721

1724 }

1725

1726

1727

1728

1734 }

1735

1736

1738

1744 }

1745

1746

1749};

1750

1751

1752

1753

1756

1759

1760 void anchor() override;

1761

1762public:

1763

1766

1771 }

1772

1774 return {};

1775 }

1776

1778};

1779

1780

1781

1783

1785

1786

1788

1789

1791

1793};

1794

1798

1799

1800

1801

1802

1803

1804

1805

1806

1807

1808

1809

1810

1811

1813 public llvm::FoldingSetNode {

1814

1815

1816

1817 struct SpecializedPartialSpecialization {

1818

1819

1821

1822

1823

1825 };

1826

1827

1828 llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>

1829 SpecializedTemplate;

1830

1831

1832

1834

1835

1837

1838

1840

1841

1843 unsigned SpecializationKind : 3;

1844

1845protected:

1852

1854

1855public:

1858

1867

1870

1871

1872

1873

1874

1875

1877 return cast(

1879 }

1880

1881

1883

1884

1885

1887 return *TemplateArgs;

1888 }

1889

1891 TemplateArgs = Args;

1892 }

1893

1894

1895

1898 }

1899

1902 }

1903

1904

1905

1906

1907

1908

1909

1910

1911

1912

1916 }

1917

1918

1919

1920

1924 }

1925

1927 SpecializedTemplate = Specialized;

1928 }

1929

1931 SpecializationKind = TSK;

1932 }

1933

1934

1936 return PointOfInstantiation;

1937 }

1938

1940 assert(Loc.isValid() && "point of instantiation must be valid!");

1941 PointOfInstantiation = Loc;

1942 }

1943

1944

1945

1946

1947

1954

1956 }

1957

1958

1959

1963 if (const auto *PartialSpec =

1964 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())

1965 return PartialSpec->PartialSpecialization;

1966

1967 return cast<ClassTemplateDecl *>(SpecializedTemplate);

1968 }

1969

1970

1971

1972

1973

1974

1975

1976

1977

1978

1979

1980

1982 if (const auto *PartialSpec =

1983 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())

1984 return *PartialSpec->TemplateArgs;

1985

1987 }

1988

1989

1990

1991

1994 assert(!isa<SpecializedPartialSpecialization *>(SpecializedTemplate) &&

1995 "Already set to a class template partial specialization!");

1996 auto *PS = new (getASTContext()) SpecializedPartialSpecialization();

1997 PS->PartialSpecialization = PartialSpec;

1998 PS->TemplateArgs = TemplateArgs;

1999 SpecializedTemplate = PS;

2000 }

2001

2002

2003

2005 assert(!isa<SpecializedPartialSpecialization *>(SpecializedTemplate) &&

2006 "Previously set to a class template partial specialization!");

2007 SpecializedTemplate = TemplDecl;

2008 }

2009

2010

2011

2014 return Info->TemplateArgsAsWritten;

2015 return cast<const ASTTemplateArgumentListInfo *>(ExplicitInfo);

2016 }

2017

2018

2019 void

2022 Info->TemplateArgsAsWritten = ArgsWritten;

2023 else

2024 ExplicitInfo = ArgsWritten;

2025 }

2026

2027

2031 }

2032

2033

2036 return Info->ExternKeywordLoc;

2038 }

2039

2040

2042

2043

2046 return Info->TemplateKeywordLoc;

2048 }

2049

2050

2052

2054

2057 }

2058

2059 static void

2062 ID.AddInteger(TemplateArgs.size());

2065 }

2066

2068

2070 return K >= firstClassTemplateSpecialization &&

2071 K <= lastClassTemplateSpecialization;

2072 }

2073};

2074

2077

2079

2080

2081

2082

2083

2084

2085 llvm::PointerIntPair<ClassTemplatePartialSpecializationDecl *, 1, bool>

2086 InstantiatedFromMember;

2087

2093

2096 InstantiatedFromMember(nullptr, false) {}

2097

2098 void anchor() override;

2099

2100public:

2103

2110

2113

2115 return cast(

2118 }

2119

2120

2122 return TemplateParams;

2123 }

2124

2125

2129 }

2130

2131

2132

2133

2134

2135

2136

2139 }

2140

2143 }

2144

2145

2146

2147

2148

2149

2150

2151

2152

2153

2154

2155

2156

2157

2158

2159

2160

2161

2162

2163

2164

2166 const auto *First =

2167 cast(getFirstDecl());

2168 return First->InstantiatedFromMember.getPointer();

2169 }

2173 }

2174

2177 auto *First = cast(getFirstDecl());

2178 First->InstantiatedFromMember.setPointer(PartialSpec);

2179 }

2180

2181

2182

2183

2184

2185

2186

2187

2188

2189

2190

2191

2192

2193

2194

2195

2196

2198 const auto *First =

2199 cast(getFirstDecl());

2200 return First->InstantiatedFromMember.getInt();

2201 }

2202

2203

2205 auto *First = cast(getFirstDecl());

2206 assert(First->InstantiatedFromMember.getPointer() &&

2207 "Only member templates can be member template specializations");

2208 return First->InstantiatedFromMember.setInt(true);

2209 }

2210

2211

2212

2213

2215 assert(getTypeForDecl() && "partial specialization has no type set!");

2216 return cast(getTypeForDecl())

2217 ->getInjectedSpecializationType();

2218 }

2219

2221

2225 }

2226

2227 static void

2230

2232

2234 return K == ClassTemplatePartialSpecialization;

2235 }

2236};

2237

2238

2240protected:

2241

2242

2244

2245

2246 llvm::FoldingSetVector Specializations;

2247

2248

2249

2250 llvm::FoldingSetVector

2252

2253

2255

2257 };

2258

2259

2260 llvm::FoldingSetVector &

2262

2263

2264

2265 llvm::FoldingSetVector &

2267

2272

2274

2277 }

2278

2280

2281public:

2282

2286

2287

2289

2290

2293 }

2294

2295

2296

2299 }

2300

2301

2307

2308

2310

2311

2312

2315

2316

2317

2319

2321 return cast(

2323 }

2325 return cast(

2327 }

2328

2329

2330

2332 return cast_or_null(

2334 }

2336 return cast_or_null(

2339 }

2340

2342 return cast(

2344 }

2347 }

2348

2350 return cast_or_null(

2352 }

2353

2354

2355

2359

2360

2361

2363 void *InsertPos);

2364

2365

2368

2369

2370

2371

2372

2373

2374

2375

2376

2378

2379

2380

2381

2382

2383

2384

2385

2386

2390

2391

2392

2393

2394

2395

2396

2397

2398

2399

2400

2401

2402

2403

2404

2406

2408 using spec_range = llvm::iterator_range<spec_iterator>;

2409

2412 }

2413

2416 }

2417

2420 }

2421

2422

2425};

2426

2427

2428

2429

2430

2431

2432

2433

2434

2435

2436

2437

2438

2439

2441 virtual void anchor();

2442

2443public:

2444 using FriendUnion = llvm::PointerUnion<NamedDecl *,TypeSourceInfo *>;

2445

2446private:

2447

2448 unsigned NumParams = 0;

2449

2450

2452

2453

2455

2456

2458

2462 : Decl(Decl::FriendTemplate, DC, Loc), NumParams(NumParams),

2463 Params(Params), Friend(Friend), FriendLoc(FriendLoc) {}

2464

2466

2467public:

2469

2474

2476

2477

2478

2479

2482 }

2483

2484

2485

2486

2489 }

2490

2491

2493 return FriendLoc;

2494 }

2495

2497 assert(i <= NumParams);

2498 return Params[i];

2499 }

2500

2502 return NumParams;

2503 }

2504

2505

2508};

2509

2510

2511

2512

2513

2514

2515

2517protected:

2519

2525

2527

2530 }

2531

2532public:

2535

2536

2539 }

2540

2541

2543 return cast(

2545 }

2547 return cast(

2549 }

2550

2551

2552

2554 return cast_or_null(

2556 }

2558 return cast_or_null(

2561 }

2562

2564 return cast_or_null(

2566 }

2567

2568

2574

2575

2578

2579

2582};

2583

2584

2585

2586

2587

2588

2589

2590

2591

2592

2593

2594

2595

2596

2598 public llvm::FoldingSetNode {

2599

2600

2601

2602

2603 struct SpecializedPartialSpecialization {

2604

2605

2607

2608

2609

2611 };

2612

2613

2614 llvm::PointerUnion<VarTemplateDecl *, SpecializedPartialSpecialization *>

2615 SpecializedTemplate;

2616

2617

2618

2620

2621

2623

2624

2626

2627

2629 unsigned SpecializationKind : 3;

2630

2631

2632

2633

2634

2635 LLVM_PREFERRED_TYPE(bool)

2636 unsigned IsCompleteDefinition : 1;

2637

2638protected:

2645

2647

2648public:

2652

2660

2663

2666 return cast(Recent);

2667 }

2668

2669

2671

2672

2673

2675

2676

2677

2680 }

2681

2684 }

2685

2689 }

2690

2691

2692

2693

2697 }

2698

2700 SpecializationKind = TSK;

2701 }

2702

2703

2705 return PointOfInstantiation;

2706 }

2707

2709 assert(Loc.isValid() && "point of instantiation must be valid!");

2710 PointOfInstantiation = Loc;

2711 }

2712

2714

2715

2716

2717

2718

2719 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>

2724

2726 }

2727

2728

2729

2730 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>

2732 if (const auto *PartialSpec =

2733 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())

2734 return PartialSpec->PartialSpecialization;

2735

2736 return cast<VarTemplateDecl *>(SpecializedTemplate);

2737 }

2738

2739

2740

2741

2742

2743

2744

2745

2746

2747

2748

2749

2751 if (const auto *PartialSpec =

2752 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())

2753 return *PartialSpec->TemplateArgs;

2754

2756 }

2757

2758

2759

2760

2763 assert(!isa<SpecializedPartialSpecialization *>(SpecializedTemplate) &&

2764 "Already set to a variable template partial specialization!");

2765 auto *PS = new (getASTContext()) SpecializedPartialSpecialization();

2766 PS->PartialSpecialization = PartialSpec;

2767 PS->TemplateArgs = TemplateArgs;

2768 SpecializedTemplate = PS;

2769 }

2770

2771

2772

2774 assert(!isa<SpecializedPartialSpecialization *>(SpecializedTemplate) &&

2775 "Previously set to a variable template partial specialization!");

2776 SpecializedTemplate = TemplDecl;

2777 }

2778

2779

2780

2783 return Info->TemplateArgsAsWritten;

2784 return cast<const ASTTemplateArgumentListInfo *>(ExplicitInfo);

2785 }

2786

2787

2788 void

2791 Info->TemplateArgsAsWritten = ArgsWritten;

2792 else

2793 ExplicitInfo = ArgsWritten;

2794 }

2795

2796

2800 }

2801

2802

2805 return Info->ExternKeywordLoc;

2807 }

2808

2809

2811

2812

2815 return Info->TemplateKeywordLoc;

2817 }

2818

2819

2821

2823

2826 }

2827

2831 ID.AddInteger(TemplateArgs.size());

2834 }

2835

2837

2839 return K >= firstVarTemplateSpecialization &&

2840 K <= lastVarTemplateSpecialization;

2841 }

2842};

2843

2846

2848

2849

2850

2851

2852

2853

2854 llvm::PointerIntPair<VarTemplatePartialSpecializationDecl *, 1, bool>

2855 InstantiatedFromMember;

2856

2862

2865 Context),

2866 InstantiatedFromMember(nullptr, false) {}

2867

2868 void anchor() override;

2869

2870public:

2873

2880

2883

2885 return cast(

2888 }

2889

2890

2892 return TemplateParams;

2893 }

2894

2895

2899 }

2900

2901

2902

2903

2904

2905

2906

2909 }

2910

2913 }

2914

2915

2916

2917

2918

2919

2920

2921

2922

2923

2924

2925

2926

2927

2928

2929

2930

2931

2932

2933

2934

2936 const auto *First =

2937 cast(getFirstDecl());

2938 return First->InstantiatedFromMember.getPointer();

2939 }

2940

2941 void

2943 auto *First = cast(getFirstDecl());

2944 First->InstantiatedFromMember.setPointer(PartialSpec);

2945 }

2946

2947

2948

2949

2950

2951

2952

2953

2954

2955

2956

2957

2958

2959

2960

2961

2962

2964 const auto *First =

2965 cast(getFirstDecl());

2966 return First->InstantiatedFromMember.getInt();

2967 }

2968

2969

2971 auto *First = cast(getFirstDecl());

2972 assert(First->InstantiatedFromMember.getPointer() &&

2973 "Only member templates can be member template specializations");

2974 return First->InstantiatedFromMember.setInt(true);

2975 }

2976

2978

2982 }

2983

2984 static void

2987

2989

2991 return K == VarTemplatePartialSpecialization;

2992 }

2993};

2994

2995

2997protected:

2998

2999

3001

3002

3004

3005

3006

3007 llvm::FoldingSetVector

3009

3011 };

3012

3013

3014 llvm::FoldingSetVector &

3016

3017

3018

3019 llvm::FoldingSetVector &

3021

3026

3028

3031 }

3032

3033public:

3036

3037

3039

3040

3043 }

3044

3045

3046

3049 }

3050

3052

3053

3058

3059

3061

3062

3063

3066

3067

3068

3070

3073 }

3076 }

3077

3078

3079

3081 return cast_or_null(

3083 }

3085 return cast_or_null(

3088 }

3089

3091 return cast(

3093 }

3096 }

3097

3099 return cast_or_null(

3101 }

3102

3103

3104

3108

3109

3110

3112 void *InsertPos);

3113

3114

3117

3118

3119

3120

3121

3122

3123

3124

3125

3126

3127

3130

3132 using spec_range = llvm::iterator_range<spec_iterator>;

3133

3136 }

3137

3140 }

3141

3144 }

3145

3146

3149};

3150

3151

3153protected:

3155

3158 : TemplateDecl(Concept, DC, L, Name, Params),

3160public:

3166

3169 }

3170

3172

3174

3179 }

3180

3183 }

3184

3187 }

3190 }

3191

3192

3195

3199};

3200

3201

3202

3203

3205 : public Decl,

3206 private llvm::TrailingObjects<ImplicitConceptSpecializationDecl,

3207 TemplateArgument> {

3208 unsigned NumTemplateArgs;

3209

3213

3214public:

3220 unsigned NumTemplateArgs);

3221

3224 NumTemplateArgs);

3225 }

3227

3228 static bool classofKind(Kind K) { return K == ImplicitConceptSpecialization; }

3230

3233};

3234

3235

3236

3237

3238

3239

3240

3241

3242

3243

3244

3245

3246

3248 public Mergeable,

3249 public llvm::FoldingSetNode {

3250private:

3251

3253

3256 T),

3258

3263

3264

3265

3269

3270public:

3271

3272 void printName(llvm::raw_ostream &OS,

3274

3275

3276 void printAsExpr(llvm::raw_ostream &OS) const;

3278

3279

3280

3281 void printAsInit(llvm::raw_ostream &OS) const;

3283

3285

3288 ID.AddPointer(T.getCanonicalType().getAsOpaquePtr());

3289 V.Profile(ID);

3290 }

3293 }

3294

3297 }

3300 }

3301

3304};

3305

3308 return PD;

3310 return PD;

3311 return cast<TemplateTemplateParmDecl *>(P);

3312}

3313

3315 auto *TD = dyn_cast(D);

3316 return TD && (isa(TD) ||

3317 isa(TD) ||

3318 isa(TD) ||

3319 isa(TD))

3320 ? TD

3321 : nullptr;

3322}

3323

3324

3325

3326

3327

3328

3329

3330

3331

3332

3333

3334

3336 if (const auto *TTP = dyn_cast(Param)) {

3337 if (TTP->isExpandedParameterPack())

3338 return TTP->getNumExpansionParameters();

3339 }

3340

3341 if (const auto *NTTP = dyn_cast(Param)) {

3342 if (NTTP->isExpandedParameterPack())

3343 return NTTP->getNumExpansionTypes();

3344 }

3345

3346 if (const auto *TTP = dyn_cast(Param)) {

3347 if (TTP->isExpandedParameterPack())

3348 return TTP->getNumExpansionTemplateParameters();

3349 }

3350

3351 return std::nullopt;

3352}

3353

3354

3355

3357

3358}

3359

3360#endif

This file provides AST data structures related to concepts.

Defines the clang::ASTContext interface.

enum clang::sema::@1725::IndirectLocalPathEntry::EntryKind Kind

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

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

Defines the clang::SourceLocation class and associated facilities.

Defines various enumerations that describe declaration and type specifiers.

C Language Family Type Representation.

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

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

Reads an AST files chain containing the contents of a translation unit.

bool isConstrained() const

Represents the builtin template declaration which is used to implement __make_integer_seq and other b...

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

BuiltinTemplateKind getBuiltinTemplateKind() const

static BuiltinTemplateDecl * Create(const ASTContext &C, DeclContext *DC, DeclarationName Name, BuiltinTemplateKind BTK)

static bool classof(const Decl *D)

static bool classofKind(Kind K)

Represents a C++ struct/union/class.

CXXRecordDecl * getMostRecentNonInjectedDecl()

TemplateSpecializationKind getTemplateSpecializationKind() const

Determine whether this particular class is a specialization or instantiation of a class template or m...

Declaration of a class template.

void AddPartialSpecialization(ClassTemplatePartialSpecializationDecl *D, void *InsertPos)

Insert the specified partial specialization knowing that it is not already in.

llvm::FoldingSetVector< ClassTemplateSpecializationDecl > & getSpecializations() const

Retrieve the set of specializations of this class template.

ClassTemplateDecl * getMostRecentDecl()

spec_iterator spec_begin() const

spec_iterator spec_end() const

CXXRecordDecl * getTemplatedDecl() const

Get the underlying class declarations of the template.

static bool classofKind(Kind K)

llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > & getPartialSpecializations() const

Retrieve the set of partial specializations of this class template.

ClassTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, TemplateParameterList *TPL, void *&InsertPos)

Return the partial specialization with the provided arguments if it exists, otherwise return the inse...

ClassTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)

CommonBase * newCommon(ASTContext &C) const override

llvm::iterator_range< spec_iterator > spec_range

static bool classof(const Decl *D)

const ClassTemplateDecl * getMostRecentDecl() const

ClassTemplateDecl * getCanonicalDecl() override

Retrieves the canonical declaration of this template.

ClassTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *D)

Find a class template partial specialization which was instantiated from the given member partial spe...

const ClassTemplateDecl * getCanonicalDecl() const

bool isThisDeclarationADefinition() const

Returns whether this template declaration defines the primary class pattern.

ClassTemplateDecl * getPreviousDecl()

Retrieve the previous declaration of this class template, or nullptr if no such declaration exists.

void LoadLazySpecializations(bool OnlyPartial=false) const

Load any lazily-loaded specializations from the external source.

void AddSpecialization(ClassTemplateSpecializationDecl *D, void *InsertPos)

Insert the specified specialization knowing that it is not already in.

const ClassTemplateDecl * getPreviousDecl() const

ClassTemplateDecl * getInstantiatedFromMemberTemplate() const

void setCommonPtr(Common *C)

spec_range specializations() const

QualType getInjectedClassNameSpecialization()

Retrieve the template specialization type of the injected-class-name for this class template.

Common * getCommonPtr() const

ClassTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)

Return the specialization with the provided arguments if it exists, otherwise return the insertion po...

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

Create an empty class template node.

ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const

Retrieve the member class template partial specialization from which this particular class template p...

ClassTemplatePartialSpecializationDecl * getInstantiatedFromMemberTemplate() const

ClassTemplatePartialSpecializationDecl * getMostRecentDecl()

void setInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *PartialSpec)

void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const

All associated constraints of this partial specialization, including the requires clause and any cons...

bool hasAssociatedConstraints() const

void Profile(llvm::FoldingSetNodeID &ID) const

bool isMemberSpecialization() const

Determines whether this class template partial specialization template was a specialization of a memb...

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

ArrayRef< TemplateArgument > getInjectedTemplateArgs(const ASTContext &Context) const

Get the template argument list of the template parameter list.

void setMemberSpecialization()

Note that this member template is a specialization.

static bool classofKind(Kind K)

QualType getInjectedSpecializationType() const

Retrieves the injected specialization type for this partial specialization.

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

TemplateParameterList * getTemplateParameters() const

Get the list of template parameters.

static bool classof(const Decl *D)

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

TemplateSpecializationKind getSpecializationKind() const

Determine the kind of specialization that this declaration represents.

const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const

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

ClassTemplateDecl * getSpecializedTemplate() const

Retrieve the template that this specialization specializes.

bool isClassScopeExplicitSpecialization() const

Is this an explicit specialization at class scope (within the class that owns the primary template)?...

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

ClassTemplateSpecializationDecl * getMostRecentDecl()

llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const

Retrieve the class template or class template partial specialization which was specialized by this.

void setTemplateArgs(TemplateArgumentList *Args)

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

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

void setPointOfInstantiation(SourceLocation Loc)

SourceLocation getPointOfInstantiation() const

Get the point of instantiation (if any), or null if none.

static bool classof(const Decl *D)

void setExternKeywordLoc(SourceLocation Loc)

Sets the location of the extern keyword.

void setSpecializationKind(TemplateSpecializationKind TSK)

const TemplateArgumentList & getTemplateArgs() const

Retrieve the template arguments of the class template specialization.

SourceLocation getExternKeywordLoc() const

Gets the location of the extern keyword, if present.

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, const ASTContext &Context)

void setInstantiationOf(ClassTemplateDecl *TemplDecl)

Note that this class template specialization is an instantiation of the given class template.

SourceLocation getTemplateKeywordLoc() const

Gets the location of the template keyword, if present.

void setTemplateArgsAsWritten(const TemplateArgumentListInfo &ArgsInfo)

Set the template argument list as written in the sources.

bool isExplicitSpecialization() const

void setTemplateKeywordLoc(SourceLocation Loc)

Sets the location of the template keyword.

const TemplateArgumentList & getTemplateInstantiationArgs() const

Retrieve the set of template arguments that should be used to instantiate members of the class templa...

llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getInstantiatedFrom() const

If this class template specialization is an instantiation of a template (rather than an explicit spec...

void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec, const TemplateArgumentList *TemplateArgs)

Note that this class template specialization is actually an instantiation of the given class template...

bool isExplicitInstantiationOrSpecialization() const

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

void setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten)

Set the template argument list as written in the sources.

void Profile(llvm::FoldingSetNodeID &ID) const

void setSpecializedTemplate(ClassTemplateDecl *Specialized)

static bool classofKind(Kind K)

Declaration of a C++20 concept.

void setDefinition(Expr *E)

Expr * getConstraintExpr() const

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

ConceptDecl(DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, Expr *ConstraintExpr)

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

bool isTypeConcept() const

ConceptDecl * getCanonicalDecl() override

Retrieves the "canonical" declaration of the given declaration.

bool hasDefinition() const

static bool classof(const Decl *D)

const ConceptDecl * getCanonicalDecl() const

static bool classofKind(Kind K)

A reference to a concept and its template args, as it appears in the code.

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

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

ASTContext & getASTContext() const LLVM_READONLY

bool isImplicit() const

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

Kind

Lists the kind of concrete classes of Decl.

SourceLocation getLocation() const

DeclContext * getLexicalDeclContext()

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

virtual SourceRange getSourceRange() const LLVM_READONLY

Source range that this declaration covers.

The name of a declaration.

Represents a ValueDecl that came out of a declarator.

Storage for a default argument.

void setInherited(const ASTContext &C, ParmDecl *InheritedFrom)

Set that the default argument was inherited from another parameter.

bool isSet() const

Determine whether there is a default argument for this parameter.

ArgType get() const

Get the default argument's value.

void set(ArgType Arg)

Set the default argument.

void clear()

Remove the default argument, even if it was inherited.

const ParmDecl * getInheritedFrom() const

Get the parameter from which we inherit the default argument, if any.

bool isInherited() const

Determine whether the default argument for this parameter was inherited from a previous declaration o...

Provides information about a dependent function-template specialization declaration.

ArrayRef< FunctionTemplateDecl * > getCandidates() const

Returns the candidates for the primary function template.

const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten

The template arguments as written in the sources, if provided.

This represents one expression.

Stores a list of template parameters and the associated requires-clause (if any) for a TemplateDecl a...

FixedSizeTemplateParameterListStorage(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)

Declaration of a friend template.

static bool classof(const Decl *D)

SourceLocation getFriendLoc() const

Retrieves the location of the 'friend' keyword.

NamedDecl * getFriendDecl() const

If this friend declaration names a templated function (or a member function of a templated type),...

TemplateParameterList * getTemplateParameterList(unsigned i) const

static bool classofKind(Kind K)

unsigned getNumTemplateParameters() const

llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion

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

TypeSourceInfo * getFriendType() const

If this friend declaration names a templated type (or a dependent member type of a templated type),...

Represents a function declaration or definition.

bool isThisDeclarationADefinition() const

Returns whether this specific declaration of the function is also a definition that does not contain ...

Declaration of a template function.

FunctionTemplateDecl * getCanonicalDecl() override

Retrieves the canonical declaration of this template.

FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)

Return the specialization with the provided arguments if it exists, otherwise return the insertion po...

spec_iterator spec_end() const

void addSpecialization(FunctionTemplateSpecializationInfo *Info, void *InsertPos)

Add a specialization of this function template.

CommonBase * newCommon(ASTContext &C) const override

FunctionDecl * getTemplatedDecl() const

Get the underlying function declaration of the template.

FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const

Common * getCommonPtr() const

bool isThisDeclarationADefinition() const

Returns whether this template declaration defines the primary pattern.

const FunctionTemplateDecl * getPreviousDecl() const

bool isAbbreviated() const

Return whether this function template is an abbreviated function template, e.g.

FunctionTemplateDecl * getMostRecentDecl()

FunctionTemplateDecl * getPreviousDecl()

Retrieve the previous declaration of this function template, or nullptr if no such declaration exists...

const FunctionTemplateDecl * getCanonicalDecl() const

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

Create an empty function template node.

spec_range specializations() const

spec_iterator spec_begin() const

FunctionTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)

const FunctionTemplateDecl * getMostRecentDecl() const

llvm::iterator_range< spec_iterator > spec_range

static bool classofKind(Kind K)

llvm::FoldingSetVector< FunctionTemplateSpecializationInfo > & getSpecializations() const

Retrieve the set of function template specializations of this function template.

void mergePrevDecl(FunctionTemplateDecl *Prev)

Merge Prev with our RedeclarableTemplateDecl::Common.

void LoadLazySpecializations() const

Load any lazily-loaded specializations from the external source.

static bool classof(const Decl *D)

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

bool isExplicitSpecialization() const

TemplateArgumentList * TemplateArguments

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

void setTemplateSpecializationKind(TemplateSpecializationKind TSK)

Set the template specialization kind.

static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, const ASTContext &Context)

FunctionTemplateDecl * getTemplate() const

Retrieve the template from which this function was specialized.

MemberSpecializationInfo * getMemberSpecializationInfo() const

Get the specialization info if this function template specialization is also a member specialization:

const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten

The template arguments as written in the sources, if provided.

SourceLocation getPointOfInstantiation() const

Retrieve the first point of instantiation of this function template specialization.

void Profile(llvm::FoldingSetNodeID &ID)

SourceLocation PointOfInstantiation

The point at which this function template specialization was first instantiated.

FunctionDecl * getFunction() const

Retrieve the declaration of the function template specialization.

TemplateSpecializationKind getTemplateSpecializationKind() const

Determine what kind of template specialization this is.

void setPointOfInstantiation(SourceLocation POI)

Set the (first) point of instantiation of this function template specialization.

bool isExplicitInstantiationOrSpecialization() const

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

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

void setTemplateArguments(ArrayRef< TemplateArgument > Converted)

static bool classofKind(Kind K)

static ImplicitConceptSpecializationDecl * CreateDeserialized(const ASTContext &C, GlobalDeclID ID, unsigned NumTemplateArgs)

ArrayRef< TemplateArgument > getTemplateArguments() const

static bool classof(const Decl *D)

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.

bool isExplicitSpecialization() const

SourceLocation getPointOfInstantiation() const

Retrieve the first point of instantiation of this member.

MemberSpecializationInfo(NamedDecl *IF, TemplateSpecializationKind TSK, SourceLocation POI=SourceLocation())

void setPointOfInstantiation(SourceLocation POI)

Set the first point of instantiation.

NamedDecl * getInstantiatedFrom() const

Retrieve the member declaration from which this member was instantiated.

Provides common interface for the Decls that cannot be redeclared, but can be merged if the same decl...

TemplateParamObjectDecl * getFirstDecl()

Return the first declaration of this declaration or itself if this is the only declaration.

This represents a decl that may have a name.

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

static NonTypeTemplateParmDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, bool HasTypeConstraint)

SourceLocation getDefaultArgumentLoc() const

Retrieve the location of the default argument, if any.

bool isPackExpansion() const

Whether this parameter pack is a pack expansion.

const DefArgStorage & getDefaultArgStorage() const

QualType getExpansionType(unsigned I) const

Retrieve a particular expansion type within an expanded parameter pack.

static bool classofKind(Kind K)

bool hasDefaultArgument() const

Determine whether this template parameter has a default argument.

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

bool defaultArgumentWasInherited() const

Determines whether the default argument was inherited from a previous declaration of this template.

TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const

Retrieve a particular expansion type source info within an expanded parameter pack.

static bool classof(const Decl *D)

unsigned getNumExpansionTypes() const

Retrieves the number of expansion types in an expanded parameter pack.

const TemplateArgumentLoc & getDefaultArgument() const

Retrieve the default argument, if any.

bool isExpandedParameterPack() const

Whether this parameter is a non-type template parameter pack that has a known list of different types...

bool isParameterPack() const

Whether this parameter is a non-type template parameter pack.

void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const

Get the associated-constraints of this template parameter.

bool hasPlaceholderTypeConstraint() const

Determine whether this non-type template parameter's type has a placeholder with a type-constraint.

Expr * getPlaceholderTypeConstraint() const

Return the constraint introduced by the placeholder type of this non-type template parameter (if any)...

void setPlaceholderTypeConstraint(Expr *E)

void removeDefaultArgument()

Removes the default argument of this template parameter.

void setInheritedDefaultArgument(const ASTContext &C, NonTypeTemplateParmDecl *Parm)

void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)

Set the default argument for this template parameter, and whether that default argument was inherited...

Represents a pack expansion of types.

A (possibly-)qualified type.

Declaration of a redeclarable template.

static SpecIterator< EntryType > makeSpecIterator(llvm::FoldingSetVector< EntryType > &Specs, bool isEnd)

SpecEntryTraits< EntryType >::DeclType * findSpecializationLocally(llvm::FoldingSetVector< EntryType > &Specs, void *&InsertPos, ProfileArguments &&...ProfileArgs)

RedeclarableTemplateDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)

redeclarable_base::redecl_iterator redecl_iterator

void loadLazySpecializationsImpl(bool OnlyPartial=false) const

bool isMemberSpecialization() const

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

CommonBase * getCommonPtr() const

Retrieves the "common" pointer shared by all (re-)declarations of the same template.

SpecEntryTraits< EntryType >::DeclType * findSpecializationImpl(llvm::FoldingSetVector< EntryType > &Specs, void *&InsertPos, ProfileArguments &&...ProfileArgs)

const RedeclarableTemplateDecl * getCanonicalDecl() const

redeclarable_base::redecl_range redecl_range

CommonBase * Common

Pointer to the common data shared by all declarations of this template.

static bool classof(const Decl *D)

RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const

Retrieve the member template from which this template was instantiated, or nullptr if this template w...

static bool classofKind(Kind K)

virtual CommonBase * newCommon(ASTContext &C) const =0

RedeclarableTemplateDecl * getCanonicalDecl() override

Retrieves the canonical declaration of this template.

void addSpecializationImpl(llvm::FoldingSetVector< EntryType > &Specs, EntryType *Entry, void *InsertPos)

friend class RedeclarableTemplate

void setMemberSpecialization()

Note that this member template is a specialization.

void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)

ArrayRef< TemplateArgument > getInjectedTemplateArgs(const ASTContext &Context) const

Retrieve the "injected" template arguments that correspond to the template parameters of this templat...

Provides common interface for the Decls that can be redeclared.

RedeclarableTemplateDecl * getFirstDecl()

Return the first declaration of this declaration or itself if this is the only declaration.

RedeclarableTemplateDecl * getNextRedeclaration() const

RedeclarableTemplateDecl * getPreviousDecl()

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

redecl_iterator redecls_end() const

llvm::iterator_range< redecl_iterator > redecl_range

RedeclarableTemplateDecl * getMostRecentDecl()

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

bool isFirstDecl() const

True if this is the first declaration in its redeclaration chain.

redecl_iterator redecls_begin() const

redecl_range redecls() const

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

Sema - This implements semantic analysis and AST building for C.

Encodes a location in the source.

A trivial tuple used to represent a source range.

SourceLocation getEnd() const

SourceLocation getEndLoc() const LLVM_READONLY

bool isThisDeclarationADefinition() const

Return true if this declaration is a completion definition of the type.

A convenient class for passing around template argument information.

A template argument list.

TemplateArgumentList(const TemplateArgumentList &)=delete

const TemplateArgument * data() const

Retrieve a pointer to the template argument list.

const TemplateArgument & operator[](unsigned Idx) const

Retrieve the template argument at a given index.

static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)

Create a new template argument list that copies the given set of template arguments.

unsigned size() const

Retrieve the number of template arguments in this template argument list.

const TemplateArgument & get(unsigned Idx) const

Retrieve the template argument at a given index.

TemplateArgumentList & operator=(const TemplateArgumentList &)=delete

ArrayRef< TemplateArgument > asArray() const

Produce this as an array ref.

Location wrapper for a TemplateArgument.

SourceRange getSourceRange() const LLVM_READONLY

Represents a template argument.

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

NamedDecl * TemplatedDecl

TemplateParameterList * TemplateParams

bool hasAssociatedConstraints() const

void init(NamedDecl *NewTemplatedDecl)

Initialize the underlying templated declaration.

NamedDecl * getTemplatedDecl() const

Get the underlying, templated declaration.

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params)

void setTemplateParameters(TemplateParameterList *TParams)

void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const

Get the total constraint-expression associated with this template, including constraint-expressions d...

static bool classof(const Decl *D)

TemplateParameterList * getTemplateParameters() const

Get the list of template parameters.

static bool classofKind(Kind K)

A template parameter object.

TemplateParamObjectDecl * getCanonicalDecl() override

Retrieves the "canonical" declaration of the given declaration.

void printAsExpr(llvm::raw_ostream &OS) const

Print this object as an equivalent expression.

const TemplateParamObjectDecl * getCanonicalDecl() const

void Profile(llvm::FoldingSetNodeID &ID)

const APValue & getValue() const

static bool classof(const Decl *D)

static void Profile(llvm::FoldingSetNodeID &ID, QualType T, const APValue &V)

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

Print this template parameter object in a human-readable format.

void printAsInit(llvm::raw_ostream &OS) const

Print this object as an initializer suitable for a variable of the object's type.

static bool classofKind(Kind K)

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

const_iterator end() const

NamedDecl * getParam(unsigned Idx)

SourceRange getSourceRange() const LLVM_READONLY

const_iterator begin() const

ArrayRef< TemplateArgument > getInjectedTemplateArgs(const ASTContext &Context)

Get the template argument list of the template parameter list.

unsigned getDepth() const

Get the depth of this template parameter list in the set of template parameter lists.

const Expr * getRequiresClause() const

The constraint-expression of the associated requires-clause.

bool hasAssociatedConstraints() const

unsigned getMinRequiredArguments() const

Returns the minimum number of arguments needed to form a template specialization.

size_t numTrailingObjects(OverloadToken< Expr * >) const

bool hasParameterPack() const

Determine whether this template parameter list contains a parameter pack.

static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)

NamedDecl *const * const_iterator

Iterates through the template parameters in this list.

Expr * getRequiresClause()

The constraint-expression of the associated requires-clause.

void print(raw_ostream &Out, const ASTContext &Context, const PrintingPolicy &Policy, bool OmitTemplateKW=false) const

SourceLocation getRAngleLoc() const

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

const NamedDecl * getParam(unsigned Idx) const

bool containsUnexpandedParameterPack() const

Determine whether this template parameter list contains an unexpanded parameter pack.

SourceLocation getLAngleLoc() const

size_t numTrailingObjects(OverloadToken< NamedDecl * >) const

TemplateParameterList(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)

void print(raw_ostream &Out, const ASTContext &Context, bool OmitTemplateKW=false) const

void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const

All associated constraints derived from this template parameter list, including the requires clause a...

ArrayRef< NamedDecl * > asArray()

static bool shouldIncludeTypeForArgument(const PrintingPolicy &Policy, const TemplateParameterList *TPL, unsigned Idx)

SourceLocation getTemplateLoc() const

ArrayRef< const NamedDecl * > asArray() const

Defines the position of a template parameter within a template parameter list.

static constexpr unsigned MaxPosition

static constexpr unsigned MaxDepth

unsigned getPosition() const

Get the position of the template parameter within its parameter list.

void setPosition(unsigned P)

unsigned getIndex() const

Get the index of the template parameter within its parameter list.

TemplateParmPosition(unsigned D, unsigned P)

void setDepth(unsigned D)

unsigned getDepth() const

Get the nesting depth of the template parameter.

TemplateParmPosition()=delete

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

bool wasDeclaredWithTypename() const

Whether this template template parameter was declared with the 'typename' keyword.

TemplateParameterList * getExpansionTemplateParameters(unsigned I) const

Retrieve a particular expansion type within an expanded parameter pack.

bool isPackExpansion() const

Whether this parameter pack is a pack expansion.

unsigned getNumExpansionTemplateParameters() const

Retrieves the number of expansion template parameters in an expanded parameter pack.

const DefArgStorage & getDefaultArgStorage() const

static bool classof(const Decl *D)

const TemplateArgumentLoc & getDefaultArgument() const

Retrieve the default argument, if any.

void setInheritedDefaultArgument(const ASTContext &C, TemplateTemplateParmDecl *Prev)

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

SourceLocation getDefaultArgumentLoc() const

Retrieve the location of the default argument, if any.

bool isParameterPack() const

Whether this template template parameter is a template parameter pack.

static bool classofKind(Kind K)

bool defaultArgumentWasInherited() const

Determines whether the default argument was inherited from a previous declaration of this template.

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

void setDeclaredWithTypename(bool withTypename)

Set whether this template template parameter was declared with the 'typename' or 'class' keyword.

void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)

Set the default argument for this template parameter, and whether that default argument was inherited...

bool isExpandedParameterPack() const

Whether this parameter is a template template parameter pack that has a known list of different templ...

void removeDefaultArgument()

Removes the default argument of this template parameter.

bool hasDefaultArgument() const

Determine whether this template parameter has a default argument.

Declaration of a template type parameter.

bool wasDeclaredWithTypename() const

Whether this template type parameter was declared with the 'typename' keyword.

SourceLocation getDefaultArgumentLoc() const

Retrieves the location of the default argument declaration.

const TemplateArgumentLoc & getDefaultArgument() const

Retrieve the default argument, if any.

unsigned getIndex() const

Retrieve the index of the template parameter.

void setInheritedDefaultArgument(const ASTContext &C, TemplateTypeParmDecl *Prev)

Set that this default argument was inherited from another parameter.

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

bool hasTypeConstraint() const

Determine whether this template parameter has a type-constraint.

const TypeConstraint * getTypeConstraint() const

Returns the type constraint associated with this template parameter (if any).

bool hasDefaultArgument() const

Determine whether this template parameter has a default argument.

bool defaultArgumentWasInherited() const

Determines whether the default argument was inherited from a previous declaration of this template.

bool isExpandedParameterPack() const

Whether this parameter is a template type parameter pack that has a known list of different type-cons...

void removeDefaultArgument()

Removes the default argument of this template parameter.

bool isParameterPack() const

Returns whether this is a parameter pack.

unsigned getDepth() const

Retrieve the depth of the template parameter.

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

const DefArgStorage & getDefaultArgStorage() const

void setTypeConstraint(ConceptReference *CR, Expr *ImmediatelyDeclaredConstraint)

void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)

Set the default argument for this template parameter.

unsigned getNumExpansionParameters() const

Retrieves the number of parameters in an expanded parameter pack.

static bool classofKind(Kind K)

static bool classof(const Decl *D)

void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const

Get the associated-constraints of this template parameter.

void setDeclaredWithTypename(bool withTypename)

Set whether this template type parameter was declared with the 'typename' or 'class' keyword.

bool isPackExpansion() const

Whether this parameter pack is a pack expansion.

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

Declaration of an alias template.

static bool classof(const Decl *D)

CommonBase * newCommon(ASTContext &C) const override

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

Create an empty alias template node.

TypeAliasTemplateDecl * getPreviousDecl()

Retrieve the previous declaration of this function template, or nullptr if no such declaration exists...

const TypeAliasTemplateDecl * getPreviousDecl() const

TypeAliasTemplateDecl * getInstantiatedFromMemberTemplate() const

const TypeAliasTemplateDecl * getCanonicalDecl() const

static bool classofKind(Kind K)

TypeAliasTemplateDecl * getCanonicalDecl() override

Retrieves the canonical declaration of this template.

TypeAliasTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)

TypeAliasDecl * getTemplatedDecl() const

Get the underlying function declaration of the template.

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

Represents a declaration of a type.

const Type * getTypeForDecl() const

A container of type source information.

AutoType * getContainedAutoType() const

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

const T * getAs() const

Member-template getAs'.

A set of unresolved declarations.

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

Represents a variable declaration or definition.

DefinitionKind isThisDeclarationADefinition(ASTContext &) const

Check whether this declaration is a definition.

TemplateSpecializationKind getTemplateSpecializationKind() const

If this variable is an instantiation of a variable template or a static data member of a class templa...

Declaration of a variable template.

VarTemplateDecl * getDefinition()

VarDecl * getTemplatedDecl() const

Get the underlying variable declarations of the template.

VarTemplateDecl * getCanonicalDecl() override

Retrieves the canonical declaration of this template.

void AddPartialSpecialization(VarTemplatePartialSpecializationDecl *D, void *InsertPos)

Insert the specified partial specialization knowing that it is not already in.

spec_iterator spec_begin() const

Common * getCommonPtr() const

VarTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, TemplateParameterList *TPL, void *&InsertPos)

Return the partial specialization with the provided arguments if it exists, otherwise return the inse...

static bool classof(const Decl *D)

const VarTemplateDecl * getPreviousDecl() const

void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)

Insert the specified specialization knowing that it is not already in.

VarTemplateDecl * getInstantiatedFromMemberTemplate() const

VarTemplateDecl * getPreviousDecl()

Retrieve the previous declaration of this variable template, or nullptr if no such declaration exists...

CommonBase * newCommon(ASTContext &C) const override

void LoadLazySpecializations(bool OnlyPartial=false) const

Load any lazily-loaded specializations from the external source.

VarTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)

const VarTemplateDecl * getCanonicalDecl() const

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

Create an empty variable template node.

llvm::iterator_range< spec_iterator > spec_range

llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > & getPartialSpecializations() const

Retrieve the set of partial specializations of this class template.

llvm::FoldingSetVector< VarTemplateSpecializationDecl > & getSpecializations() const

Retrieve the set of specializations of this variable template.

static bool classofKind(Kind K)

const VarTemplateDecl * getMostRecentDecl() const

bool isThisDeclarationADefinition() const

Returns whether this template declaration defines the primary variable pattern.

VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)

Return the specialization with the provided arguments if it exists, otherwise return the insertion po...

VarTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(VarTemplatePartialSpecializationDecl *D)

Find a variable template partial specialization which was instantiated from the given member partial ...

spec_iterator spec_end() const

VarTemplateDecl * getMostRecentDecl()

spec_range specializations() const

void setMemberSpecialization()

Note that this member template is a specialization.

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

TemplateParameterList * getTemplateParameters() const

Get the list of template parameters.

VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const

Retrieve the member variable template partial specialization from which this particular variable temp...

bool isMemberSpecialization() const

Determines whether this variable template partial specialization was a specialization of a member par...

void Profile(llvm::FoldingSetNodeID &ID) const

static bool classof(const Decl *D)

ArrayRef< TemplateArgument > getInjectedTemplateArgs(const ASTContext &Context) const

Get the template argument list of the template parameter list.

void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const

All associated constraints of this partial specialization, including the requires clause and any cons...

void setInstantiatedFromMember(VarTemplatePartialSpecializationDecl *PartialSpec)

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

VarTemplatePartialSpecializationDecl * getMostRecentDecl()

static bool classofKind(Kind K)

bool hasAssociatedConstraints() const

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

SourceLocation getPointOfInstantiation() const

Get the point of instantiation (if any), or null if none.

void setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten)

Set the template argument list as written in the sources.

const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const

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

void setTemplateKeywordLoc(SourceLocation Loc)

Sets the location of the template keyword.

void setSpecializationKind(TemplateSpecializationKind TSK)

static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, const ASTContext &Context)

const TemplateArgumentList & getTemplateArgs() const

Retrieve the template arguments of the variable template specialization.

const TemplateArgumentList & getTemplateInstantiationArgs() const

Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...

static bool classof(const Decl *D)

bool isClassScopeExplicitSpecialization() const

SourceLocation getTemplateKeywordLoc() const

Gets the location of the template keyword, if present.

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

void setInstantiationOf(VarTemplatePartialSpecializationDecl *PartialSpec, const TemplateArgumentList *TemplateArgs)

Note that this variable template specialization is actually an instantiation of the given variable te...

void Profile(llvm::FoldingSetNodeID &ID) const

void setPointOfInstantiation(SourceLocation Loc)

void setTemplateArgsAsWritten(const TemplateArgumentListInfo &ArgsInfo)

Set the template argument list as written in the sources.

llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const

Retrieve the variable template or variable template partial specialization which was specialized by t...

TemplateSpecializationKind getSpecializationKind() const

Determine the kind of specialization that this declaration represents.

void setInstantiationOf(VarTemplateDecl *TemplDecl)

Note that this variable template specialization is an instantiation of the given variable template.

VarTemplateDecl * getSpecializedTemplate() const

Retrieve the template that this specialization specializes.

bool isExplicitInstantiationOrSpecialization() const

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

llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getInstantiatedFrom() const

If this variable template specialization is an instantiation of a template (rather than an explicit s...

bool isExplicitSpecialization() const

SourceLocation getExternKeywordLoc() const

Gets the location of the extern keyword, if present.

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

void setExternKeywordLoc(SourceLocation Loc)

Sets the location of the extern keyword.

void setCompleteDefinition()

VarTemplateSpecializationDecl * getMostRecentDecl()

static bool classofKind(Kind K)

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

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

const internal::VariadicAllOfMatcher< Type > type

Matches Types in the clang AST.

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

bool isTemplateInstantiation(TemplateSpecializationKind Kind)

Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...

Decl * getPrimaryMergedDecl(Decl *D)

Get the primary declaration for a declaration from an AST file.

NamedDecl * getAsNamedDecl(TemplateParameter P)

@ Create

'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...

StorageClass

Storage classes.

void * allocateDefaultArgStorageChain(const ASTContext &C)

TemplateDecl * getAsTypeTemplateDecl(Decl *D)

llvm::PointerUnion< const ASTTemplateArgumentListInfo *, ExplicitInstantiationInfo * > SpecializationOrInstantiationInfo

TemplateParameterList * getReplacedTemplateParameterList(Decl *D)

Internal helper used by Subst* nodes to retrieve the parameter list for their AssociatedDecl.

TagTypeKind

The kind of a tag type.

BuiltinTemplateKind

Kinds of BuiltinTemplateDecl.

llvm::PointerUnion< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter

Stores a template parameter of any kind.

std::optional< unsigned > getExpandedPackSize(const NamedDecl *Param)

Check whether the template parameter is a pack expansion, and if so, determine the number of paramete...

const FunctionProtoType * T

TemplateSpecializationKind

Describes the kind of template specialization that a particular template specialization declaration r...

@ TSK_ExplicitSpecialization

This template specialization was declared or defined by an explicit specialization (C++ [temp....

@ TSK_Undeclared

This template specialization was formed from a template-id but has not yet been declared,...

@ Typename

The "typename" keyword precedes the qualified type name, e.g., typename T::type.

bool isTemplateExplicitInstantiationOrSpecialization(TemplateSpecializationKind Kind)

True if this template specialization kind is an explicit specialization, explicit instantiation decla...

Diagnostic wrappers for TextAPI types for error reporting.

Represents an explicit template argument list in C++, e.g., the "" in "sort".

static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)

Data that is common to all of the declarations of a given class template.

llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > PartialSpecializations

The class template partial specializations for this class template.

llvm::FoldingSetVector< ClassTemplateSpecializationDecl > Specializations

The class template specializations for this class template, including explicit specializations and in...

QualType InjectedClassNameType

The injected-class-name type for this class template.

A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...

Provides information about an explicit instantiation of a variable or class template.

ExplicitInstantiationInfo()=default

SourceLocation ExternKeywordLoc

The location of the extern keyword.

const ASTTemplateArgumentListInfo * TemplateArgsAsWritten

The template arguments as written..

SourceLocation TemplateKeywordLoc

The location of the template keyword.

Data that is common to all of the declarations of a given function template.

llvm::FoldingSetVector< FunctionTemplateSpecializationInfo > Specializations

The function template specializations for this function template, including explicit specializations ...

Describes how types, statements, expressions, and declarations should be printed.

llvm::PointerIntPair< RedeclarableTemplateDecl *, 1, bool > InstantiatedFromMember

The template from which this was most directly instantiated (or null).

static ArrayRef< TemplateArgument > getTemplateArgs(FunctionTemplateSpecializationInfo *I)

static DeclType * getDecl(FunctionTemplateSpecializationInfo *I)

static ArrayRef< TemplateArgument > getTemplateArgs(EntryType *D)

static DeclType * getDecl(EntryType *D)

SpecIterator(typename llvm::FoldingSetVector< EntryType >::iterator SetIter)

DeclType * operator->() const

DeclType * operator*() const

Data that is common to all of the declarations of a given variable template.

llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > PartialSpecializations

The variable template partial specializations for this variable template.

llvm::FoldingSetVector< VarTemplateSpecializationDecl > Specializations

The variable template specializations for this variable template, including explicit specializations ...