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

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

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

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

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

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

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

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

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

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

39#include

40#include

41#include

42#include

43#include

44#include

45

47

62

63

67

69

70

71

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

74 Expr *> {

75

77

78

80

81

83

84

85

86 unsigned NumParams : 29;

87

88

89

90 LLVM_PREFERRED_TYPE(bool)

91 unsigned ContainsUnexpandedParameterPack : 1;

92

93

94 LLVM_PREFERRED_TYPE(bool)

95 unsigned HasRequiresClause : 1;

96

97

98

99 LLVM_PREFERRED_TYPE(bool)

100 unsigned HasConstrainedParameters : 1;

101

102protected:

106

108 return NumParams;

109 }

110

112 return HasRequiresClause ? 1 : 0;

113 }

114

115public:

116 template <size_t N, bool HasRequiresClause>

119

125 Expr *RequiresClause);

126

128

129

131

132

134

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

139

140 unsigned size() const { return NumParams; }

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

142

145

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

148 return begin()[Idx];

149 }

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

152 return begin()[Idx];

153 }

154

155

156

157

158

159

161

162

163

164

165

166

168

169

170

172

173

176 if (P->isParameterPack())

177 return true;

178 return false;

179 }

180

181

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

184 }

185

186

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

189 }

190

191

192

193

194

195

196

199

201

202

204

208

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

249class TemplateArgumentList final

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

251

252

253 unsigned NumArguments;

254

255

256

258

259public:

261

263 TemplateArgumentList &operator=(const TemplateArgumentList &) = delete;

264

265

266

269

270

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

273 return data()[Idx];

274 }

275

276

278

279

281 return getTrailingObjects(size());

282 }

283

284

285

286 unsigned size() const { return NumArguments; }

287

288

290};

291

293

294

295

296

297

298

299

300

301

302template<typename ParmDecl, typename ArgType>

304

305

306

307 struct Chain {

308 ParmDecl *PrevDeclWithDefaultArg;

310 };

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

312 "non-pointer argument type?");

313

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

315

316 static ParmDecl *getParmOwningDefaultArg(ParmDecl *Parm) {

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

319 Parm = Prev;

320 assert(isa<ParmDecl \*>(Parm->getDefaultArgStorage().ValueOrInherited) &&

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

322 return Parm;

323 }

324

325public:

327

328

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

330

331

332

334

335

336

337 ArgType get() const {

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

340 Storage = &Prev->getDefaultArgStorage();

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

342 return C->Value;

344 }

345

346

347

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

350 return D;

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

352 return C->PrevDeclWithDefaultArg;

353 return nullptr;

354 }

355

356

357 void set(ArgType Arg) {

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

359 ValueOrInherited = Arg;

360 }

361

362

364 InheritedFrom = getParmOwningDefaultArg(InheritedFrom);

366 ValueOrInherited = InheritedFrom;

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

368 dyn_cast<ParmDecl *>(ValueOrInherited)) {

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

370 ValueOrInherited =

372 } else if (auto *Inherited = dyn_cast<Chain *>(ValueOrInherited)) {

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

374 InheritedFrom));

375 Inherited->PrevDeclWithDefaultArg = InheritedFrom;

376 } else

378 Chain{InheritedFrom, cast(ValueOrInherited)};

379 }

380

381

383 ValueOrInherited = ArgType();

384 }

385};

386

387

388

389

390

391

392

393

394

395

397 void anchor() override;

398

399protected:

400

403

404

405

409

410public:

413

414

418

419

420

421

422

425

427

428

430

431

433

434

436

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

439 }

440

445

446protected:

449

450public:

454

455

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

459 else

461 }

462};

463

464

465

466

467class FunctionTemplateSpecializationInfo final

468 : public llvm::FoldingSetNode,

469 private llvm::TrailingObjects<FunctionTemplateSpecializationInfo,

470 MemberSpecializationInfo *> {

471

472

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

474

475

476

477

478

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

480

481public:

482

483

485

486

487

489

490

491

493

494private:

495 FunctionTemplateSpecializationInfo(

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

504 if (MSInfo)

505 getTrailingObjects()[0] = MSInfo;

506 }

507

508 size_t numTrailingObjects() const { return Function.getInt(); }

509

510public:

512

513 static FunctionTemplateSpecializationInfo *

518

519

521

522

524

525

529

533

534

535

536

541

542

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

546 Template.setInt(TSK - 1);

547 }

548

549

550

551

552

553

557

558

559

563

564

565

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

595 return numTrailingObjects() ? getTrailingObjects()[0] : nullptr;

596 }

597

598 void Profile(llvm::FoldingSetNodeID &ID) {

600 }

601

602 static void

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

608 }

609};

610

611

612

613

615

616

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

618

619

621

622public:

623 explicit

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

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

629 }

630

631

632

634

635

639

643

644

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

648 MemberAndTSK.setInt(TSK - 1);

649 }

650

651

652

653

655 return PointOfInstantiation;

656 }

657

658

660 PointOfInstantiation = POI;

661 }

662};

663

664

665

666

667

668

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686class DependentFunctionTemplateSpecializationInfo final

687 : private llvm::TrailingObjects<DependentFunctionTemplateSpecializationInfo,

688 FunctionTemplateDecl *> {

689 friend TrailingObjects;

690

691

692 unsigned NumCandidates;

693

694 DependentFunctionTemplateSpecializationInfo(

697

698public:

699

701

702 static DependentFunctionTemplateSpecializationInfo *

705

706

708 return getTrailingObjects(NumCandidates);

709 }

710};

711

712

714 public Redeclarable

715{

717

720 }

721

724 }

725

728 }

729

730 void anchor() override;

731

732protected:

735

739

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

742 }

743 };

744

745 template <typename EntryType, typename SETraits = SpecEntryTraits,

746 typename DeclType = typename SETraits::DeclType>

748 : llvm::iterator_adaptor_base<

749 SpecIterator<EntryType, SETraits, DeclType>,

750 typename llvm::FoldingSetVector::iterator,

751 typename std::iterator_traits<typename llvm::FoldingSetVector<

752 EntryType>::iterator>::iterator_category,

753 DeclType *, ptrdiff_t, DeclType *, DeclType *> {

756 typename llvm::FoldingSetVector::iterator SetIter)

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

758

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

761 }

762

764 };

765

766 template

767 static SpecIterator

771

773

776

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

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

781

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

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

786

787 template <class Derived, class EntryType>

789 EntryType *Entry, void *InsertPos);

790

793

794

795

796

797

798

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

801 };

802

803

804

806

807

808

809

811

813

814

819

820public:

825

826

833

834

835

836

837

838

839

840

841

842

843

844

845

846

847

848

849

850

851

855

856

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

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

861 }

862

863

864

865

866

867

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

902

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

906 }

907

908

909

910

911

912

913

918

921

928

929

931

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

934 }

935};

936

950

951

953protected:

955

956

957

959

960

961 llvm::FoldingSetVector Specializations;

962

964 };

965

971

973

977

978

979

980 llvm::FoldingSetVector &

982

983

984

985

986

988 void *InsertPos);

989

990public:

993

994

996

997

1001

1002

1003

1007

1012

1013

1014

1015

1016

1017

1018

1019

1020

1021

1022

1027

1028

1029

1031 void *&InsertPos);

1032

1041

1042

1043

1045 return cast_or_null(

1047 }

1049 return cast_or_null(

1051 }

1052

1061

1063 return cast_or_null(

1065 }

1066

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

1069

1073

1077

1081

1082

1083

1085

1086

1087

1088

1091 }

1092

1093

1095

1096

1102

1103

1106

1107

1110};

1111

1112

1113

1114

1115

1116

1117

1118

1119

1120

1121

1122

1123

1124

1126protected:

1130

1133

1135

1136

1137 assert((D + 1) <= MaxDepth &&

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

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

1141 }

1142

1143public:

1145

1146

1149 assert((D + 1) <= MaxDepth &&

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

1152 }

1153

1154

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

1160 }

1161

1162

1164};

1165

1166

1167

1168

1169

1170

1171

1172class TemplateTypeParmDecl final : public TypeDecl,

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

1174

1176 friend TrailingObjects;

1178

1179

1180

1181

1182

1183 bool Typename : 1;

1184

1185

1186 bool HasTypeConstraint : 1;

1187

1188

1189

1190

1191 bool TypeConstraintInitialized : 1;

1192

1193

1195

1196

1197 using DefArgStorage =

1199 DefArgStorage DefaultArgument;

1200

1204 : TypeDecl(TemplateTypeParm, DC, IdLoc, Id, KeyLoc), Typename(Typename),

1205 HasTypeConstraint(HasTypeConstraint), TypeConstraintInitialized(false),

1206 NumExpanded(NumExpanded) {}

1207

1208public:

1212 bool Typename, bool ParameterPack, bool HasTypeConstraint = false,

1218 bool HasTypeConstraint);

1219

1220

1221

1222

1223

1224

1226 return Typename && !HasTypeConstraint;

1227 }

1228

1230

1231

1232

1234

1235

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

1239 }

1240

1241

1243

1244

1245

1247 return DefaultArgument.isInherited();

1248 }

1249

1250

1253

1254

1255

1257 TemplateTypeParmDecl *Prev) {

1258 DefaultArgument.setInherited(C, Prev);

1259 }

1260

1261

1263 DefaultArgument.clear();

1264 }

1265

1266

1267

1269

1270

1272

1273

1275

1276

1278

1279

1280

1281

1282

1285 return false;

1287 if (TC->hasExplicitTemplateArgs())

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

1289 if (ArgLoc.getArgument().containsUnexpandedParameterPack())

1290 return true;

1291 return false;

1292 }

1293

1294

1295

1296

1297

1298

1299

1300

1301

1302

1303

1304

1305

1306

1307

1308

1309

1310

1311

1312

1313

1314

1315

1317

1318

1319

1321 return TypeConstraintInitialized ? getTrailingObjects() : nullptr;

1322 }

1323

1325 Expr *ImmediatelyDeclaredConstraint,

1327

1328

1330 return HasTypeConstraint;

1331 }

1332

1333

1334

1335

1336

1337

1340 if (HasTypeConstraint)

1341 AC.emplace_back(getTypeConstraint()->getImmediatelyDeclaredConstraint(),

1343 }

1344

1346

1347

1350};

1351

1352

1353

1354

1355

1356

1357class NonTypeTemplateParmDecl final

1360 private llvm::TrailingObjects<NonTypeTemplateParmDecl,

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

1362 Expr *> {

1364 friend TrailingObjects;

1365

1366

1367

1368 using DefArgStorage =

1370 DefArgStorage DefaultArgument;

1371

1372

1373

1374

1375

1376 bool ParameterPack;

1377

1378

1379

1380

1381 bool ExpandedParameterPack = false;

1382

1383

1384 unsigned NumExpandedTypes = 0;

1385

1386 size_t numTrailingObjects(

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

1388 return NumExpandedTypes;

1389 }

1390

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

1397

1398 NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation StartLoc,

1399 SourceLocation IdLoc, unsigned D, unsigned P,

1400 const IdentifierInfo *Id, QualType T,

1401 TypeSourceInfo *TInfo,

1404

1405public:

1406 static NonTypeTemplateParmDecl *

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

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

1410

1411 static NonTypeTemplateParmDecl *

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

1414 QualType T, TypeSourceInfo *TInfo, ArrayRef ExpandedTypes,

1416

1417 static NonTypeTemplateParmDecl *

1420 GlobalDeclID ID,

1421 unsigned NumExpandedTypes,

1422 bool HasTypeConstraint);

1423

1429

1430 SourceRange getSourceRange() const override LLVM_READONLY;

1431

1433

1434

1435

1437

1438

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

1442 }

1443

1444

1446

1447

1448

1450 return DefaultArgument.isInherited();

1451 }

1452

1453

1454

1455

1459 NonTypeTemplateParmDecl *Parm) {

1460 DefaultArgument.setInherited(C, Parm);

1461 }

1462

1463

1465

1466

1467

1468

1469

1470

1471

1472

1473

1474

1476

1477

1478

1479

1480

1481

1483 return ParameterPack && getType()->getAs();

1484 }

1485

1486

1487

1488

1489

1490

1491

1492

1493

1494

1495

1496

1497

1498

1499

1500

1501

1502

1503

1504

1505

1506

1507

1508

1509

1511

1512

1513

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

1516 return NumExpandedTypes;

1517 }

1518

1519

1520

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

1523 auto TypesAndInfos =

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

1525 return TypesAndInfos[I].first;

1526 }

1527

1528

1529

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

1532 auto TypesAndInfos =

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

1534 return TypesAndInfos[I].second;

1535 }

1536

1537

1538

1543

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

1546 }

1547

1548

1549

1552 return AT && AT->isConstrained();

1553 }

1554

1555

1556

1557

1558

1559

1560

1564 AC.emplace_back(E);

1565 }

1566

1567

1570};

1571

1572

1573

1574

1575

1576

1577

1578

1579class TemplateTemplateParmDecl final

1582 private llvm::TrailingObjects<TemplateTemplateParmDecl,

1583 TemplateParameterList *> {

1584

1585 using DefArgStorage =

1587 DefArgStorage DefaultArgument;

1588

1590 unsigned ParameterKind : 3;

1591

1592

1593

1594

1595

1596 LLVM_PREFERRED_TYPE(bool)

1597 unsigned Typename : 1;

1598

1599

1600 LLVM_PREFERRED_TYPE(bool)

1601 unsigned ParameterPack : 1;

1602

1603

1604

1605

1606 LLVM_PREFERRED_TYPE(bool)

1607 unsigned ExpandedParameterPack : 1;

1608

1609

1610 unsigned NumExpandedParams = 0;

1611

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

1618 Typename(Typename), ParameterPack(ParameterPack),

1619 ExpandedParameterPack(false) {}

1620

1626

1627 void anchor() override;

1628

1629public:

1633

1634 static TemplateTemplateParmDecl *

1639

1640 static TemplateTemplateParmDecl *

1645

1648 static TemplateTemplateParmDecl *

1650

1656

1657

1658

1660

1661

1662

1664

1665

1666

1667

1668

1669

1670

1672

1673

1674

1675

1676

1678 return ParameterPack &&

1680 }

1681

1682

1683

1684

1685

1686

1687

1688

1689

1690

1691

1692

1693

1694

1695

1696

1697

1698

1699

1701

1702

1703

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

1706 return NumExpandedParams;

1707 }

1708

1709

1710

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

1713 return getTrailingObjects()[I];

1714 }

1715

1717

1718

1719

1721

1722

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

1726 }

1727

1728

1730

1731

1732

1734 return DefaultArgument.isInherited();

1735 }

1736

1737

1738

1739

1743 TemplateTemplateParmDecl *Prev) {

1744 DefaultArgument.setInherited(C, Prev);

1745 }

1746

1747

1749

1756

1760

1766

1767

1770};

1771

1772

1773

1774

1777

1780

1781 void anchor() override;

1782

1783public:

1784

1787

1791 return new (C, DC) BuiltinTemplateDecl(C, DC, Name, BTK);

1792 }

1793

1797

1799

1801};

1803

1804

1805

1807

1809

1810

1812

1813

1815

1817};

1818

1822

1823

1824

1825

1826

1827

1828

1829

1830

1831

1832

1833

1834

1835

1837 public llvm::FoldingSetNode {

1838

1839

1840

1841 struct SpecializedPartialSpecialization {

1842

1843

1845

1846

1847

1849 };

1850

1851

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

1853 SpecializedTemplate;

1854

1855

1856

1858

1859

1861

1862

1864

1865

1867 unsigned SpecializationKind : 3;

1868

1869

1870

1871

1872

1873

1874 LLVM_PREFERRED_TYPE(bool)

1875 unsigned StrictPackMatch : 1;

1876

1877protected:

1883 bool StrictPackMatch,

1885

1887

1888public:

1891

1900

1903

1908

1913

1914

1916

1917

1918

1920 return *TemplateArgs;

1921 }

1922

1924 TemplateArgs = Args;

1925 }

1926

1927

1928

1932

1936

1937

1938

1939

1940

1941

1942

1943

1944

1945

1950

1951

1952

1953

1958

1960 SpecializedTemplate = Specialized;

1961 }

1962

1964 SpecializationKind = TSK;

1965 }

1966

1968

1970

1971

1973 return PointOfInstantiation;

1974 }

1975

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

1978 PointOfInstantiation = Loc;

1979 }

1980

1981

1982

1983

1984

1994

1995

1996

2000 if (const auto *PartialSpec =

2001 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())

2002 return PartialSpec->PartialSpecialization;

2003

2005 }

2006

2007

2008

2009

2010

2011

2012

2013

2014

2015

2016

2017

2019 if (const auto *PartialSpec =

2020 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())

2021 return *PartialSpec->TemplateArgs;

2022

2024 }

2025

2026

2027

2028

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

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

2034 PS->PartialSpecialization = PartialSpec;

2035 PS->TemplateArgs = TemplateArgs;

2036 SpecializedTemplate = PS;

2037 }

2038

2039

2040

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

2044 SpecializedTemplate = TemplDecl;

2045 }

2046

2047

2048

2050 if (auto *Info =

2051 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))

2052 return Info->TemplateArgsAsWritten;

2054 }

2055

2056

2057 void

2059 if (auto *Info =

2060 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))

2061 Info->TemplateArgsAsWritten = ArgsWritten;

2062 else

2063 ExplicitInfo = ArgsWritten;

2064 }

2065

2066

2071

2072

2074 if (auto *Info =

2075 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))

2076 return Info->ExternKeywordLoc;

2078 }

2079

2080

2082

2083

2085 if (auto *Info =

2086 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))

2087 return Info->TemplateKeywordLoc;

2089 }

2090

2091

2093

2095

2099

2100 static void

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

2106 }

2107

2109

2111 return K >= firstClassTemplateSpecialization &&

2112 K <= lastClassTemplateSpecialization;

2113 }

2114};

2115

2116class ClassTemplatePartialSpecializationDecl

2118

2120

2121

2122

2123

2124

2125

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

2127 InstantiatedFromMember;

2128

2130

2131 ClassTemplatePartialSpecializationDecl(

2136 ClassTemplatePartialSpecializationDecl *PrevDecl);

2137

2138 ClassTemplatePartialSpecializationDecl(ASTContext &C)

2140 InstantiatedFromMember(nullptr, false) {}

2141

2142 void anchor() override;

2143

2144public:

2147

2148 static ClassTemplatePartialSpecializationDecl *

2153 ClassTemplatePartialSpecializationDecl *PrevDecl);

2154

2155 static ClassTemplatePartialSpecializationDecl *

2157

2163

2164

2166 return TemplateParams;

2167 }

2168

2169

2170

2171

2172

2173

2174

2177 TemplateParams->getAssociatedConstraints(AC);

2178 }

2179

2181 return TemplateParams->hasAssociatedConstraints();

2182 }

2183

2184

2185

2186

2187

2188

2189

2190

2191

2192

2193

2194

2195

2196

2197

2198

2199

2200

2201

2202

2203

2205 const auto *First =

2207 return First->InstantiatedFromMember.getPointer();

2208 }

2213

2215 ClassTemplatePartialSpecializationDecl *PartialSpec) {

2217 First->InstantiatedFromMember.setPointer(PartialSpec);

2218 }

2219

2220

2221

2222

2223

2224

2225

2226

2227

2228

2229

2230

2231

2232

2233

2234

2235

2237 const auto *First =

2239 return First->InstantiatedFromMember.getInt();

2240 }

2241

2242

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

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

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

2248 }

2249

2250

2251

2254

2256

2261

2262 static void

2265

2267

2269 return K == ClassTemplatePartialSpecialization;

2270 }

2271};

2272

2273

2275protected:

2276

2277

2279

2280

2281 llvm::FoldingSetVector Specializations;

2282

2283

2284

2285 llvm::FoldingSetVector

2287

2288

2290

2292 };

2293

2294

2295 llvm::FoldingSetVector &

2297

2298

2299

2300 llvm::FoldingSetVector &

2302

2307

2309

2313

2315

2316public:

2317

2321

2322

2324

2325

2329

2330

2331

2335

2336

2342

2343

2345

2346

2347

2350

2351

2352

2354

2363

2364

2365

2367 return cast_or_null(

2369 }

2371 return cast_or_null(

2374 }

2375

2383

2385 return cast_or_null(

2387 }

2388

2389

2390

2394

2395

2396

2398 void *InsertPos);

2399

2400

2403

2404

2405

2406

2407

2408

2409

2410

2411

2413

2414

2415

2416

2417

2418

2419

2420

2421

2425

2426

2427

2428

2429

2430

2431

2432

2433

2434

2435

2436

2437

2438

2439

2442

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

2445

2449

2453

2457

2458

2461};

2462

2463

2464

2465

2466

2467

2468

2469

2470

2471

2472

2473

2474

2475

2476class FriendTemplateDecl : public Decl {

2477 virtual void anchor();

2478

2479public:

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

2481

2482private:

2483

2484 unsigned NumParams = 0;

2485

2486

2488

2489

2491

2492

2494

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

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

2500

2502

2503public:

2505

2506 static FriendTemplateDecl *

2510

2512

2513

2514

2515

2519

2520

2521

2522

2524 return Friend.dyn_cast<NamedDecl*>();

2525 }

2526

2527

2529 return FriendLoc;

2530 }

2531

2533 assert(i <= NumParams);

2534 return Params[i];

2535 }

2536

2538 return NumParams;

2539 }

2540

2541

2544};

2545

2546

2547

2548

2549

2550

2551

2553protected:

2555

2561

2563

2567

2568public:

2571

2572

2576

2577

2586

2587

2588

2590 return cast_or_null(

2592 }

2594 return cast_or_null(

2597 }

2598

2600 return cast_or_null(

2602 }

2603

2604

2610

2611

2614

2615

2618};

2619

2620

2621

2622

2623

2624

2625

2626

2627

2628

2629

2630

2631

2632

2634 public llvm::FoldingSetNode {

2635

2636

2637

2638

2639 struct SpecializedPartialSpecialization {

2640

2641

2643

2644

2645

2647 };

2648

2649

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

2651 SpecializedTemplate;

2652

2653

2654

2656

2657

2659

2660

2662

2663

2665 unsigned SpecializationKind : 3;

2666

2667

2668

2669

2670

2671 LLVM_PREFERRED_TYPE(bool)

2672 unsigned IsCompleteDefinition : 1;

2673

2674protected:

2681

2683

2684public:

2688

2696

2699

2704

2705

2707

2708

2709

2711

2712

2713

2717

2721

2726

2727

2728

2729

2734

2736 SpecializationKind = TSK;

2737 }

2738

2739

2741 return PointOfInstantiation;

2742 }

2743

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

2746 PointOfInstantiation = Loc;

2747 }

2748

2750

2751

2752

2753

2754

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

2763

2764

2765

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

2768 if (const auto *PartialSpec =

2769 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())

2770 return PartialSpec->PartialSpecialization;

2771

2773 }

2774

2775

2776

2777

2778

2779

2780

2781

2782

2783

2784

2785

2787 if (const auto *PartialSpec =

2788 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())

2789 return *PartialSpec->TemplateArgs;

2790

2792 }

2793

2794

2795

2796

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

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

2802 PS->PartialSpecialization = PartialSpec;

2803 PS->TemplateArgs = TemplateArgs;

2804 SpecializedTemplate = PS;

2805 }

2806

2807

2808

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

2812 SpecializedTemplate = TemplDecl;

2813 }

2814

2815

2816

2818 if (auto *Info =

2819 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))

2820 return Info->TemplateArgsAsWritten;

2822 }

2823

2824

2825 void

2827 if (auto *Info =

2828 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))

2829 Info->TemplateArgsAsWritten = ArgsWritten;

2830 else

2831 ExplicitInfo = ArgsWritten;

2832 }

2833

2834

2839

2840

2842 if (auto *Info =

2843 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))

2844 return Info->ExternKeywordLoc;

2846 }

2847

2848

2850

2851

2853 if (auto *Info =

2854 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))

2855 return Info->TemplateKeywordLoc;

2857 }

2858

2859

2861

2863

2867

2868 static void Profile(llvm::FoldingSetNodeID &ID,

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

2874 }

2875

2877

2879 return K >= firstVarTemplateSpecialization &&

2880 K <= lastVarTemplateSpecialization;

2881 }

2882};

2883

2884class VarTemplatePartialSpecializationDecl

2886

2888

2889

2890

2891

2892

2893

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

2895 InstantiatedFromMember;

2896

2897 VarTemplatePartialSpecializationDecl(

2902

2903 VarTemplatePartialSpecializationDecl(ASTContext &Context)

2905 Context),

2906 InstantiatedFromMember(nullptr, false) {}

2907

2908 void anchor() override;

2909

2910public:

2913

2914 static VarTemplatePartialSpecializationDecl *

2920

2921 static VarTemplatePartialSpecializationDecl *

2923

2929

2930

2932 return TemplateParams;

2933 }

2934

2935

2940

2941

2942

2943

2944

2945

2946

2949 TemplateParams->getAssociatedConstraints(AC);

2950 }

2951

2953 return TemplateParams->hasAssociatedConstraints();

2954 }

2955

2956

2957

2958

2959

2960

2961

2962

2963

2964

2965

2966

2967

2968

2969

2970

2971

2972

2973

2974

2975

2977 const auto *First =

2979 return First->InstantiatedFromMember.getPointer();

2980 }

2981

2982 void

2985 First->InstantiatedFromMember.setPointer(PartialSpec);

2986 }

2987

2988

2989

2990

2991

2992

2993

2994

2995

2996

2997

2998

2999

3000

3001

3002

3003

3005 const auto *First =

3007 return First->InstantiatedFromMember.getInt();

3008 }

3009

3010

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

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

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

3016 }

3017

3019

3024

3025 static void

3028

3030

3032 return K == VarTemplatePartialSpecialization;

3033 }

3034};

3035

3036

3038protected:

3039

3040

3042

3043

3045

3046

3047

3048 llvm::FoldingSetVector

3050

3052 };

3053

3054

3055 llvm::FoldingSetVector &

3057

3058

3059

3060 llvm::FoldingSetVector &

3062

3067

3069

3073

3074public:

3077

3078

3080

3081

3085

3086

3087

3091

3093

3094

3099

3100

3102

3103

3104

3107

3108

3109

3111

3118

3119

3120

3122 return cast_or_null(

3124 }

3126 return cast_or_null(

3129 }

3130

3138

3140 return cast_or_null(

3142 }

3143

3144

3145

3149

3150

3151

3153 void *InsertPos);

3154

3155

3158

3159

3160

3161

3162

3163

3164

3165

3166

3167

3168

3171

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

3174

3178

3182

3186

3187

3190};

3191

3192

3194protected:

3196

3201public:

3207

3211

3213

3215

3221

3225

3232

3233

3236

3240};

3241

3242

3243

3244

3245class ImplicitConceptSpecializationDecl final

3246 : public Decl,

3247 private llvm::TrailingObjects<ImplicitConceptSpecializationDecl,

3248 TemplateArgument> {

3249 unsigned NumTemplateArgs;

3250

3253 ImplicitConceptSpecializationDecl(EmptyShell Empty, unsigned NumTemplateArgs);

3254

3255public:

3256 static ImplicitConceptSpecializationDecl *

3259 static ImplicitConceptSpecializationDecl *

3261 unsigned NumTemplateArgs);

3262

3264 return getTrailingObjects(NumTemplateArgs);

3265 }

3267

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

3270

3273};

3274

3275

3276

3277

3278

3279

3280

3281

3282

3283

3284

3285

3286

3287class TemplateParamObjectDecl : public ValueDecl,

3288 public Mergeable,

3289 public llvm::FoldingSetNode {

3290private:

3291

3293

3296 T),

3298

3301 static TemplateParamObjectDecl *CreateDeserialized(ASTContext &C,

3303

3304

3305

3309

3310public:

3311

3312 void printName(llvm::raw_ostream &OS,

3314

3315

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

3318

3319

3320

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

3323

3325

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

3329 V.Profile(ID);

3330 }

3334

3341

3344};

3345

3348 return PD;

3350 return PD;

3352}

3353

3355 auto *TD = dyn_cast(D);

3359 [&]() {

3360 if (const auto *TTP = dyn_cast(TD))

3362 return false;

3363 }())

3364 ? TD

3365 : nullptr;

3366}

3367

3368

3369

3370

3371

3372

3373

3374

3375

3376

3377

3378

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

3382 return Num;

3383 }

3384

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

3386 if (NTTP->isExpandedParameterPack())

3387 return NTTP->getNumExpansionTypes();

3388 }

3389

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

3391 if (TTP->isExpandedParameterPack())

3392 return TTP->getNumExpansionTemplateParameters();

3393 }

3394

3395 return std::nullopt;

3396}

3397

3398

3399

3400std::tuple<NamedDecl *, TemplateArgument>

3402

3403

3404

3405

3407

3408}

3409

3410#endif

This file provides AST data structures related to concepts.

Defines the clang::ASTContext interface.

#define BuiltinTemplate(BTName)

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.

Defines the clang::TemplateNameKind enum.

C Language Family Type Representation.

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

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

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition DeclTemplate.h:1794

BuiltinTemplateKind getBuiltinTemplateKind() const

Definition DeclTemplate.h:1798

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

Definition DeclTemplate.h:1788

static bool classof(const Decl *D)

Definition DeclTemplate.h:1785

static bool classofKind(Kind K)

Definition DeclTemplate.h:1786

bool isPackProducingBuiltinTemplate() const

Represents a C++ struct/union/class.

CXXRecordDecl * getMostRecentDecl()

TemplateSpecializationKind getTemplateSpecializationKind() const

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

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

CXXRecordDecl * getDefinitionOrSelf() const

Declaration of a class template.

Definition DeclTemplate.h:2274

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()

Definition DeclTemplate.h:2376

spec_iterator spec_begin() const

Definition DeclTemplate.h:2450

spec_iterator spec_end() const

Definition DeclTemplate.h:2454

CXXRecordDecl * getTemplatedDecl() const

Get the underlying class declarations of the template.

Definition DeclTemplate.h:2326

static bool classofKind(Kind K)

Definition DeclTemplate.h:2460

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)

Definition DeclTemplate.h:2303

CommonBase * newCommon(ASTContext &C) const override

friend class ASTDeclReader

Definition DeclTemplate.h:2318

llvm::iterator_range< spec_iterator > spec_range

Definition DeclTemplate.h:2444

static bool classof(const Decl *D)

Definition DeclTemplate.h:2459

const ClassTemplateDecl * getMostRecentDecl() const

Definition DeclTemplate.h:2380

ClassTemplateDecl * getCanonicalDecl() override

Retrieves the "canonical" declaration of the given declaration.

Definition DeclTemplate.h:2355

ClassTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *D)

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

const ClassTemplateDecl * getCanonicalDecl() const

Definition DeclTemplate.h:2359

bool isThisDeclarationADefinition() const

Returns whether this template declaration defines the primary class pattern.

Definition DeclTemplate.h:2332

friend class ASTDeclWriter

Definition DeclTemplate.h:2319

ClassTemplateDecl * getPreviousDecl()

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

Definition DeclTemplate.h:2366

SpecIterator< ClassTemplateSpecializationDecl > spec_iterator

Definition DeclTemplate.h:2443

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

Definition DeclTemplate.h:2370

ClassTemplateDecl * getInstantiatedFromMemberTemplate() const

Definition DeclTemplate.h:2384

CanQualType getCanonicalInjectedSpecializationType(const ASTContext &Ctx) const

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

void setCommonPtr(Common *C)

Definition DeclTemplate.h:2314

spec_range specializations() const

Definition DeclTemplate.h:2446

friend class TemplateDeclInstantiator

Definition DeclTemplate.h:2320

Common * getCommonPtr() const

Definition DeclTemplate.h:2310

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.

Definition DeclTemplate.h:2117

ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const

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

Definition DeclTemplate.h:2204

ClassTemplatePartialSpecializationDecl * getInstantiatedFromMemberTemplate() const

Definition DeclTemplate.h:2210

ClassTemplatePartialSpecializationDecl * getMostRecentDecl()

Definition DeclTemplate.h:2158

CanQualType getCanonicalInjectedSpecializationType(const ASTContext &Ctx) const

Retrieves the canonical injected specialization type for this partial specialization.

void setInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *PartialSpec)

Definition DeclTemplate.h:2214

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

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

Definition DeclTemplate.h:2175

bool hasAssociatedConstraints() const

Definition DeclTemplate.h:2180

void Profile(llvm::FoldingSetNodeID &ID) const

Definition DeclTemplate.h:2257

bool isMemberSpecialization() const

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

Definition DeclTemplate.h:2236

friend class ASTDeclReader

Definition DeclTemplate.h:2145

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

void setMemberSpecialization()

Note that this member template is a specialization.

Definition DeclTemplate.h:2243

friend class ASTDeclWriter

Definition DeclTemplate.h:2146

static bool classofKind(Kind K)

Definition DeclTemplate.h:2268

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

TemplateParameterList * getTemplateParameters() const

Get the list of template parameters.

Definition DeclTemplate.h:2165

static bool classof(const Decl *D)

Definition DeclTemplate.h:2266

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

Definition DeclTemplate.h:1837

TemplateSpecializationKind getSpecializationKind() const

Determine the kind of specialization that this declaration represents.

Definition DeclTemplate.h:1929

const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const

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

Definition DeclTemplate.h:2049

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)?

Definition DeclTemplate.h:1946

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

ClassTemplateSpecializationDecl * getMostRecentDecl()

Definition DeclTemplate.h:1904

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

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

Definition DeclTemplate.h:1999

void setTemplateArgs(TemplateArgumentList *Args)

Definition DeclTemplate.h:1923

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)

Definition DeclTemplate.h:1976

SourceLocation getPointOfInstantiation() const

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

Definition DeclTemplate.h:1972

friend class ASTDeclReader

Definition DeclTemplate.h:1889

void setStrictPackMatch(bool Val)

Definition DeclTemplate.h:1969

static bool classof(const Decl *D)

Definition DeclTemplate.h:2108

void setExternKeywordLoc(SourceLocation Loc)

Sets the location of the extern keyword.

void setSpecializationKind(TemplateSpecializationKind TSK)

Definition DeclTemplate.h:1963

const TemplateArgumentList & getTemplateArgs() const

Retrieve the template arguments of the class template specialization.

Definition DeclTemplate.h:1919

SourceLocation getExternKeywordLoc() const

Gets the location of the extern keyword, if present.

Definition DeclTemplate.h:2073

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

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

Definition DeclTemplate.h:2101

void setInstantiationOf(ClassTemplateDecl *TemplDecl)

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

Definition DeclTemplate.h:2041

friend class ASTDeclWriter

Definition DeclTemplate.h:1890

SourceLocation getTemplateKeywordLoc() const

Gets the location of the template keyword, if present.

Definition DeclTemplate.h:2084

ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, bool StrictPackMatch, ClassTemplateSpecializationDecl *PrevDecl)

void setTemplateArgsAsWritten(const TemplateArgumentListInfo &ArgsInfo)

Set the template argument list as written in the sources.

Definition DeclTemplate.h:2067

bool isExplicitSpecialization() const

Definition DeclTemplate.h:1933

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

Definition DeclTemplate.h:2018

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

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

Definition DeclTemplate.h:1987

bool hasStrictPackMatch() const

Definition DeclTemplate.h:1967

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

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

Definition DeclTemplate.h:2029

bool isExplicitInstantiationOrSpecialization() const

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

Definition DeclTemplate.h:1954

void setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten)

Set the template argument list as written in the sources.

Definition DeclTemplate.h:2058

ClassTemplateSpecializationDecl * getDefinitionOrSelf() const

Definition DeclTemplate.h:1909

void Profile(llvm::FoldingSetNodeID &ID) const

Definition DeclTemplate.h:2096

void setSpecializedTemplate(ClassTemplateDecl *Specialized)

Definition DeclTemplate.h:1959

static bool classofKind(Kind K)

Definition DeclTemplate.h:2110

Declaration of a C++20 concept.

Definition DeclTemplate.h:3193

void setDefinition(Expr *E)

Definition DeclTemplate.h:3214

Expr * getConstraintExpr() const

Definition DeclTemplate.h:3208

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition DeclTemplate.h:3216

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

Definition DeclTemplate.h:3197

Expr * ConstraintExpr

Definition DeclTemplate.h:3195

friend class ASTReader

Definition DeclTemplate.h:3237

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

friend class ASTDeclReader

Definition DeclTemplate.h:3238

bool isTypeConcept() const

Definition DeclTemplate.h:3222

ConceptDecl * getCanonicalDecl() override

Retrieves the "canonical" declaration of the given declaration.

Definition DeclTemplate.h:3226

bool hasDefinition() const

Definition DeclTemplate.h:3212

static bool classof(const Decl *D)

Definition DeclTemplate.h:3234

friend class ASTDeclWriter

Definition DeclTemplate.h:3239

const ConceptDecl * getCanonicalDecl() const

Definition DeclTemplate.h:3229

static bool classofKind(Kind K)

Definition DeclTemplate.h:3235

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.

virtual Decl * getPreviousDeclImpl()

Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain.

Kind

Lists the kind of concrete classes of Decl.

virtual Decl * getNextRedeclarationImpl()

Returns the next redeclaration or itself if this is the only decl.

SourceLocation getLocation() const

virtual Decl * getMostRecentDeclImpl()

Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...

DeclContext * getLexicalDeclContext()

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

The name of a declaration.

Represents a ValueDecl that came out of a declarator.

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

Storage for a default argument.

Definition DeclTemplate.h:303

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

Set that the default argument was inherited from another parameter.

Definition DeclTemplate.h:363

bool isSet() const

Determine whether there is a default argument for this parameter.

Definition DeclTemplate.h:329

DefaultArgStorage()

Definition DeclTemplate.h:326

ArgType get() const

Get the default argument's value.

Definition DeclTemplate.h:337

void set(ArgType Arg)

Set the default argument.

Definition DeclTemplate.h:357

void clear()

Remove the default argument, even if it was inherited.

Definition DeclTemplate.h:382

const ParmDecl * getInheritedFrom() const

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

Definition DeclTemplate.h:348

bool isInherited() const

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

Definition DeclTemplate.h:333

ArrayRef< FunctionTemplateDecl * > getCandidates() const

Returns the candidates for the primary function template.

Definition DeclTemplate.h:707

const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten

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

Definition DeclTemplate.h:700

This represents one expression.

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

Definition DeclTemplate.h:235

Declaration of a friend template.

Definition DeclTemplate.h:2476

static bool classof(const Decl *D)

Definition DeclTemplate.h:2542

SourceLocation getFriendLoc() const

Retrieves the location of the 'friend' keyword.

Definition DeclTemplate.h:2528

NamedDecl * getFriendDecl() const

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

Definition DeclTemplate.h:2523

friend class ASTDeclReader

Definition DeclTemplate.h:2504

TemplateParameterList * getTemplateParameterList(unsigned i) const

Definition DeclTemplate.h:2532

static bool classofKind(Kind K)

Definition DeclTemplate.h:2543

unsigned getNumTemplateParameters() const

Definition DeclTemplate.h:2537

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

Definition DeclTemplate.h:2480

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

Definition DeclTemplate.h:2516

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

void setInstantiatedFromMemberTemplate(bool Val=true)

bool isInstantiatedFromMemberTemplate() const

Declaration of a template function.

Definition DeclTemplate.h:952

FunctionTemplateDecl * getCanonicalDecl() override

Retrieves the "canonical" declaration of the given declaration.

Definition DeclTemplate.h:1033

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

Definition DeclTemplate.h:1078

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.

Definition DeclTemplate.h:998

FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const

Definition DeclTemplate.h:1062

Common * getCommonPtr() const

Definition DeclTemplate.h:974

bool isThisDeclarationADefinition() const

Returns whether this template declaration defines the primary pattern.

Definition DeclTemplate.h:1004

const FunctionTemplateDecl * getPreviousDecl() const

Definition DeclTemplate.h:1048

bool isAbbreviated() const

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

Definition DeclTemplate.h:1084

void setInstantiatedFromMemberTemplate(FunctionTemplateDecl *D)

Definition DeclTemplate.h:1023

FunctionTemplateDecl * getMostRecentDecl()

Definition DeclTemplate.h:1053

friend class ASTDeclReader

Definition DeclTemplate.h:991

FunctionTemplateDecl * getPreviousDecl()

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

Definition DeclTemplate.h:1044

const FunctionTemplateDecl * getCanonicalDecl() const

Definition DeclTemplate.h:1037

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

Create an empty function template node.

spec_range specializations() const

Definition DeclTemplate.h:1070

SpecIterator< FunctionTemplateSpecializationInfo > spec_iterator

Definition DeclTemplate.h:1067

friend class FunctionDecl

Definition DeclTemplate.h:954

spec_iterator spec_begin() const

Definition DeclTemplate.h:1074

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

Definition DeclTemplate.h:966

bool isCompatibleWithDefinition() const

Definition DeclTemplate.h:1008

const FunctionTemplateDecl * getMostRecentDecl() const

Definition DeclTemplate.h:1058

friend class ASTDeclWriter

Definition DeclTemplate.h:992

llvm::iterator_range< spec_iterator > spec_range

Definition DeclTemplate.h:1068

static bool classofKind(Kind K)

Definition DeclTemplate.h:1109

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)

Definition DeclTemplate.h:1108

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

Definition DeclTemplate.h:470

bool isExplicitSpecialization() const

Definition DeclTemplate.h:530

TemplateArgumentList * TemplateArguments

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

Definition DeclTemplate.h:484

void setTemplateSpecializationKind(TemplateSpecializationKind TSK)

Set the template specialization kind.

Definition DeclTemplate.h:543

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

Definition DeclTemplate.h:603

FunctionTemplateDecl * getTemplate() const

Retrieve the template from which this function was specialized.

Definition DeclTemplate.h:523

MemberSpecializationInfo * getMemberSpecializationInfo() const

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

Definition DeclTemplate.h:594

const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten

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

Definition DeclTemplate.h:488

SourceLocation getPointOfInstantiation() const

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

Definition DeclTemplate.h:554

void Profile(llvm::FoldingSetNodeID &ID)

Definition DeclTemplate.h:598

SourceLocation PointOfInstantiation

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

Definition DeclTemplate.h:492

friend TrailingObjects

Definition DeclTemplate.h:511

FunctionDecl * getFunction() const

Retrieve the declaration of the function template specialization.

Definition DeclTemplate.h:520

TemplateSpecializationKind getTemplateSpecializationKind() const

Determine what kind of template specialization this is.

Definition DeclTemplate.h:526

void setPointOfInstantiation(SourceLocation POI)

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

Definition DeclTemplate.h:560

bool isExplicitInstantiationOrSpecialization() const

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

Definition DeclTemplate.h:537

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

void setTemplateArguments(ArrayRef< TemplateArgument > Converted)

static bool classofKind(Kind K)

Definition DeclTemplate.h:3268

friend TrailingObjects

Definition DeclTemplate.h:3271

friend class ASTDeclReader

Definition DeclTemplate.h:3272

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

ArrayRef< TemplateArgument > getTemplateArguments() const

Definition DeclTemplate.h:3263

static bool classof(const Decl *D)

Definition DeclTemplate.h:3269

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

Definition DeclTemplate.h:614

void setTemplateSpecializationKind(TemplateSpecializationKind TSK)

Set the template specialization kind.

Definition DeclTemplate.h:645

TemplateSpecializationKind getTemplateSpecializationKind() const

Determine what kind of template specialization this is.

Definition DeclTemplate.h:636

bool isExplicitSpecialization() const

Definition DeclTemplate.h:640

SourceLocation getPointOfInstantiation() const

Retrieve the first point of instantiation of this member.

Definition DeclTemplate.h:654

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

Definition DeclTemplate.h:624

void setPointOfInstantiation(SourceLocation POI)

Set the first point of instantiation.

Definition DeclTemplate.h:659

NamedDecl * getInstantiatedFrom() const

Retrieve the member declaration from which this member was instantiated.

Definition DeclTemplate.h:633

TemplateParamObjectDecl * getFirstDecl()

This represents a decl that may have a name.

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

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

Definition DeclTemplate.h:1362

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.

Definition DeclTemplate.h:1482

const DefArgStorage & getDefaultArgStorage() const

Definition DeclTemplate.h:1432

QualType getExpansionType(unsigned I) const

Retrieve a particular expansion type within an expanded parameter pack.

Definition DeclTemplate.h:1521

static bool classofKind(Kind K)

Definition DeclTemplate.h:1569

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

Get the associated-constraints of this template parameter.

Definition DeclTemplate.h:1561

bool hasDefaultArgument() const

Determine whether this template parameter has a default argument.

Definition DeclTemplate.h:1436

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.

Definition DeclTemplate.h:1449

TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const

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

Definition DeclTemplate.h:1530

static bool classof(const Decl *D)

Definition DeclTemplate.h:1568

unsigned getNumExpansionTypes() const

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

Definition DeclTemplate.h:1514

friend class ASTDeclReader

Definition DeclTemplate.h:1363

const TemplateArgumentLoc & getDefaultArgument() const

Retrieve the default argument, if any.

Definition DeclTemplate.h:1439

bool isExpandedParameterPack() const

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

Definition DeclTemplate.h:1510

bool isParameterPack() const

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

Definition DeclTemplate.h:1475

bool hasPlaceholderTypeConstraint() const

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

Definition DeclTemplate.h:1550

Expr * getPlaceholderTypeConstraint() const

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

Definition DeclTemplate.h:1539

void setPlaceholderTypeConstraint(Expr *E)

Definition DeclTemplate.h:1544

void removeDefaultArgument()

Removes the default argument of this template parameter.

Definition DeclTemplate.h:1464

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

Definition DeclTemplate.h:1458

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

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

A (possibly-)qualified type.

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

Definition DeclTemplate.h:768

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

Definition DeclTemplate.h:815

redeclarable_base::redecl_iterator redecl_iterator

Definition DeclTemplate.h:920

void loadLazySpecializationsImpl(bool OnlyPartial=false) const

RedeclarableTemplateDecl * getMostRecentDecl()

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

friend class ASTReader

Definition DeclTemplate.h:823

bool isMemberSpecialization() const

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

Definition DeclTemplate.h:852

CommonBase * getCommonPtr() const

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

friend class ASTDeclReader

Definition DeclTemplate.h:821

const RedeclarableTemplateDecl * getCanonicalDecl() const

Definition DeclTemplate.h:830

RedeclarableTemplateDecl * getPreviousDecl()

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

redeclarable_base::redecl_range redecl_range

Definition DeclTemplate.h:919

CommonBase * Common

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

Definition DeclTemplate.h:805

static bool classof(const Decl *D)

Definition DeclTemplate.h:930

RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const

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

Definition DeclTemplate.h:899

static bool classofKind(Kind K)

Definition DeclTemplate.h:932

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

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

RedeclarableTemplateDecl * getCanonicalDecl() override

Retrieves the canonical declaration of this template.

Definition DeclTemplate.h:827

friend class ASTDeclWriter

Definition DeclTemplate.h:822

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

friend class RedeclarableTemplate

Definition DeclTemplate.h:824

void setMemberSpecialization()

Note that this member template is a specialization.

Definition DeclTemplate.h:857

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

void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)

Definition DeclTemplate.h:903

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

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

Definition DeclTemplate.h:915

RedeclarableTemplateDecl * getFirstDecl()

RedeclarableTemplateDecl * getNextRedeclaration() const

Redeclarable(const ASTContext &Ctx)

RedeclarableTemplateDecl * getPreviousDecl()

redecl_iterator redecls_end() const

llvm::iterator_range< redecl_iterator > redecl_range

RedeclarableTemplateDecl * getMostRecentDecl()

redecl_iterator redecls_begin() const

redecl_range redecls() const

Encodes a location in the source.

A trivial tuple used to represent a source range.

SourceLocation getEnd() const

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.

Definition DeclTemplate.h:250

TemplateArgumentList(const TemplateArgumentList &)=delete

friend TrailingObjects

Definition DeclTemplate.h:260

const TemplateArgument * data() const

Retrieve a pointer to the template argument list.

Definition DeclTemplate.h:289

const TemplateArgument & operator[](unsigned Idx) const

Retrieve the template argument at a given index.

Definition DeclTemplate.h:277

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.

Definition DeclTemplate.h:286

const TemplateArgument & get(unsigned Idx) const

Retrieve the template argument at a given index.

Definition DeclTemplate.h:271

TemplateArgumentList & operator=(const TemplateArgumentList &)=delete

ArrayRef< TemplateArgument > asArray() const

Produce this as an array ref.

Definition DeclTemplate.h:280

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

Definition DeclTemplate.h:396

NamedDecl * TemplatedDecl

Definition DeclTemplate.h:447

TemplateParameterList * TemplateParams

Definition DeclTemplate.h:448

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

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

bool hasAssociatedConstraints() const

void init(NamedDecl *NewTemplatedDecl)

Initialize the underlying templated declaration.

Definition DeclTemplate.h:456

NamedDecl * getTemplatedDecl() const

Get the underlying, templated declaration.

Definition DeclTemplate.h:429

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition DeclTemplate.h:441

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

Definition DeclTemplate.h:406

friend class ASTDeclReader

Definition DeclTemplate.h:411

void setTemplateParameters(TemplateParameterList *TParams)

Definition DeclTemplate.h:451

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

static bool classof(const Decl *D)

Definition DeclTemplate.h:435

friend class ASTDeclWriter

Definition DeclTemplate.h:412

TemplateParameterList * getTemplateParameters() const

Get the list of template parameters.

Definition DeclTemplate.h:415

static bool classofKind(Kind K)

Definition DeclTemplate.h:437

TemplateParamObjectDecl * getCanonicalDecl() override

Retrieves the "canonical" declaration of the given declaration.

Definition DeclTemplate.h:3335

void printAsExpr(llvm::raw_ostream &OS) const

Print this object as an equivalent expression.

const TemplateParamObjectDecl * getCanonicalDecl() const

Definition DeclTemplate.h:3338

void Profile(llvm::FoldingSetNodeID &ID)

Definition DeclTemplate.h:3331

const APValue & getValue() const

Definition DeclTemplate.h:3324

friend class ASTReader

Definition DeclTemplate.h:3307

friend class ASTDeclReader

Definition DeclTemplate.h:3308

static bool classof(const Decl *D)

Definition DeclTemplate.h:3342

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

Definition DeclTemplate.h:3326

friend class ASTContext

Only ASTContext::getTemplateParamObjectDecl and deserialization create these.

Definition DeclTemplate.h:3306

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)

Definition DeclTemplate.h:3343

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

Definition DeclTemplate.h:74

const_iterator end() const

Definition DeclTemplate.h:138

NamedDecl * getParam(unsigned Idx)

Definition DeclTemplate.h:146

SourceRange getSourceRange() const LLVM_READONLY

Definition DeclTemplate.h:209

const_iterator begin() const

Definition DeclTemplate.h:136

ArrayRef< TemplateArgument > getInjectedTemplateArgs(const ASTContext &Context)

Get the template argument list of the template parameter list.

friend class FixedSizeTemplateParameterListStorage

Definition DeclTemplate.h:117

iterator end()

Definition DeclTemplate.h:137

unsigned getDepth() const

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

iterator begin()

Definition DeclTemplate.h:135

const Expr * getRequiresClause() const

The constraint-expression of the associated requires-clause.

Definition DeclTemplate.h:187

unsigned size() const

Definition DeclTemplate.h:140

NamedDecl ** iterator

Iterates through the template parameters in this list.

Definition DeclTemplate.h:130

bool hasAssociatedConstraints() const

unsigned getMinRequiredArguments() const

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

size_t numTrailingObjects(OverloadToken< Expr * >) const

Definition DeclTemplate.h:111

bool hasParameterPack() const

Determine whether this template parameter list contains a parameter pack.

Definition DeclTemplate.h:174

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.

Definition DeclTemplate.h:133

Expr * getRequiresClause()

The constraint-expression of the associated requires-clause.

Definition DeclTemplate.h:182

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

SourceLocation getRAngleLoc() const

Definition DeclTemplate.h:207

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

const NamedDecl * getParam(unsigned Idx) const

Definition DeclTemplate.h:150

bool containsUnexpandedParameterPack() const

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

SourceLocation getLAngleLoc() const

Definition DeclTemplate.h:206

size_t numTrailingObjects(OverloadToken< NamedDecl * >) const

Definition DeclTemplate.h:107

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< AssociatedConstraint > &AC) const

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

ArrayRef< NamedDecl * > asArray()

Definition DeclTemplate.h:143

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

SourceLocation getTemplateLoc() const

Definition DeclTemplate.h:205

friend TrailingObjects

Definition DeclTemplate.h:118

ArrayRef< const NamedDecl * > asArray() const

Definition DeclTemplate.h:144

bool empty() const

Definition DeclTemplate.h:141

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

Definition DeclTemplate.h:1125

unsigned Depth

Definition DeclTemplate.h:1128

static constexpr unsigned MaxPosition

Definition DeclTemplate.h:1132

static constexpr unsigned MaxDepth

Definition DeclTemplate.h:1131

unsigned getPosition() const

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

Definition DeclTemplate.h:1155

void setPosition(unsigned P)

Definition DeclTemplate.h:1156

unsigned getIndex() const

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

Definition DeclTemplate.h:1163

@ DepthWidth

Definition DeclTemplate.h:1127

@ PositionWidth

Definition DeclTemplate.h:1127

TemplateParmPosition(unsigned D, unsigned P)

Definition DeclTemplate.h:1134

void setDepth(unsigned D)

Definition DeclTemplate.h:1148

unsigned getDepth() const

Get the nesting depth of the template parameter.

Definition DeclTemplate.h:1147

unsigned Position

Definition DeclTemplate.h:1129

TemplateParmPosition()=delete

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

Definition DeclTemplate.h:1583

bool wasDeclaredWithTypename() const

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

Definition DeclTemplate.h:1659

TemplateParameterList * getExpansionTemplateParameters(unsigned I) const

Retrieve a particular expansion type within an expanded parameter pack.

Definition DeclTemplate.h:1711

bool isPackExpansion() const

Whether this parameter pack is a pack expansion.

Definition DeclTemplate.h:1677

unsigned getNumExpansionTemplateParameters() const

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

Definition DeclTemplate.h:1704

const DefArgStorage & getDefaultArgStorage() const

Definition DeclTemplate.h:1716

TemplateNameKind templateParameterKind() const

Definition DeclTemplate.h:1757

static bool classof(const Decl *D)

Definition DeclTemplate.h:1768

const TemplateArgumentLoc & getDefaultArgument() const

Retrieve the default argument, if any.

Definition DeclTemplate.h:1723

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

Definition DeclTemplate.h:1742

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

friend class ASTDeclReader

Definition DeclTemplate.h:1630

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.

Definition DeclTemplate.h:1671

static bool classofKind(Kind K)

Definition DeclTemplate.h:1769

friend class ASTDeclWriter

Definition DeclTemplate.h:1631

bool defaultArgumentWasInherited() const

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

Definition DeclTemplate.h:1733

bool isTypeConceptTemplateParam() const

Definition DeclTemplate.h:1761

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

Definition DeclTemplate.h:1750

void setDeclaredWithTypename(bool withTypename)

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

Definition DeclTemplate.h:1663

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

Definition DeclTemplate.h:1700

friend TrailingObjects

Definition DeclTemplate.h:1632

void removeDefaultArgument()

Removes the default argument of this template parameter.

Definition DeclTemplate.h:1748

bool hasDefaultArgument() const

Determine whether this template parameter has a default argument.

Definition DeclTemplate.h:1720

Declaration of a template type parameter.

Definition DeclTemplate.h:1173

bool wasDeclaredWithTypename() const

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

Definition DeclTemplate.h:1225

SourceLocation getDefaultArgumentLoc() const

Retrieves the location of the default argument declaration.

const TemplateArgumentLoc & getDefaultArgument() const

Retrieve the default argument, if any.

Definition DeclTemplate.h:1236

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.

Definition DeclTemplate.h:1256

void setTypeConstraint(ConceptReference *CR, Expr *ImmediatelyDeclaredConstraint, UnsignedOrNone ArgPackSubstIndex)

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

bool hasTypeConstraint() const

Determine whether this template parameter has a type-constraint.

Definition DeclTemplate.h:1329

friend class Sema

Sema creates these on the stack during auto type deduction.

Definition DeclTemplate.h:1175

friend class ASTDeclReader

Definition DeclTemplate.h:1177

const TypeConstraint * getTypeConstraint() const

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

Definition DeclTemplate.h:1320

UnsignedOrNone getNumExpansionParameters() const

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

Definition DeclTemplate.h:1316

bool hasDefaultArgument() const

Determine whether this template parameter has a default argument.

Definition DeclTemplate.h:1233

bool defaultArgumentWasInherited() const

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

Definition DeclTemplate.h:1246

void removeDefaultArgument()

Removes the default argument of this template parameter.

Definition DeclTemplate.h:1262

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

Get the associated-constraints of this template parameter.

Definition DeclTemplate.h:1338

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

Definition DeclTemplate.h:1229

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

Set the default argument for this template parameter.

static bool classofKind(Kind K)

Definition DeclTemplate.h:1349

static bool classof(const Decl *D)

Definition DeclTemplate.h:1348

void setDeclaredWithTypename(bool withTypename)

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

Definition DeclTemplate.h:1268

bool isPackExpansion() const

Whether this parameter pack is a pack expansion.

Definition DeclTemplate.h:1283

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

Declaration of an alias template.

Definition DeclTemplate.h:2552

static bool classof(const Decl *D)

Definition DeclTemplate.h:2616

CommonBase Common

Definition DeclTemplate.h:2554

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

Definition DeclTemplate.h:2589

const TypeAliasTemplateDecl * getPreviousDecl() const

Definition DeclTemplate.h:2593

TypeAliasTemplateDecl * getInstantiatedFromMemberTemplate() const

Definition DeclTemplate.h:2599

friend class ASTDeclReader

Definition DeclTemplate.h:2569

const TypeAliasTemplateDecl * getCanonicalDecl() const

Definition DeclTemplate.h:2582

static bool classofKind(Kind K)

Definition DeclTemplate.h:2617

TypeAliasTemplateDecl * getCanonicalDecl() override

Retrieves the canonical declaration of this template.

Definition DeclTemplate.h:2578

Common * getCommonPtr()

Definition DeclTemplate.h:2564

friend class ASTDeclWriter

Definition DeclTemplate.h:2570

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

Definition DeclTemplate.h:2556

TypeAliasDecl * getTemplatedDecl() const

Get the underlying function declaration of the template.

Definition DeclTemplate.h:2573

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

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

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.

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

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.

Definition DeclTemplate.h:3037

VarTemplateDecl * getDefinition()

VarDecl * getTemplatedDecl() const

Get the underlying variable declarations of the template.

Definition DeclTemplate.h:3082

VarTemplateDecl * getCanonicalDecl() override

Retrieves the canonical declaration of this template.

Definition DeclTemplate.h:3112

void AddPartialSpecialization(VarTemplatePartialSpecializationDecl *D, void *InsertPos)

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

spec_iterator spec_begin() const

Definition DeclTemplate.h:3179

Common * getCommonPtr() const

Definition DeclTemplate.h:3070

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)

Definition DeclTemplate.h:3188

const VarTemplateDecl * getPreviousDecl() const

Definition DeclTemplate.h:3125

void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)

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

VarTemplateDecl * getInstantiatedFromMemberTemplate() const

Definition DeclTemplate.h:3139

VarTemplateDecl * getPreviousDecl()

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

Definition DeclTemplate.h:3121

CommonBase * newCommon(ASTContext &C) const override

friend class ASTDeclReader

Definition DeclTemplate.h:3075

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)

Definition DeclTemplate.h:3063

const VarTemplateDecl * getCanonicalDecl() const

Definition DeclTemplate.h:3115

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

Create an empty variable template node.

llvm::iterator_range< spec_iterator > spec_range

Definition DeclTemplate.h:3173

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)

Definition DeclTemplate.h:3189

const VarTemplateDecl * getMostRecentDecl() const

Definition DeclTemplate.h:3135

friend class ASTDeclWriter

Definition DeclTemplate.h:3076

bool isThisDeclarationADefinition() const

Returns whether this template declaration defines the primary variable pattern.

Definition DeclTemplate.h:3088

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

SpecIterator< VarTemplateSpecializationDecl > spec_iterator

Definition DeclTemplate.h:3172

spec_iterator spec_end() const

Definition DeclTemplate.h:3183

VarTemplateDecl * getMostRecentDecl()

Definition DeclTemplate.h:3131

spec_range specializations() const

Definition DeclTemplate.h:3175

Definition DeclTemplate.h:2885

void setMemberSpecialization()

Note that this member template is a specialization.

Definition DeclTemplate.h:3011

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

TemplateParameterList * getTemplateParameters() const

Get the list of template parameters.

Definition DeclTemplate.h:2931

VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const

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

Definition DeclTemplate.h:2976

friend class ASTDeclReader

Definition DeclTemplate.h:2911

bool isMemberSpecialization() const

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

Definition DeclTemplate.h:3004

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

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

Definition DeclTemplate.h:2947

void Profile(llvm::FoldingSetNodeID &ID) const

Definition DeclTemplate.h:3020

static bool classof(const Decl *D)

Definition DeclTemplate.h:3029

friend class ASTDeclWriter

Definition DeclTemplate.h:2912

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

Get the template argument list of the template parameter list.

Definition DeclTemplate.h:2937

void setInstantiatedFromMember(VarTemplatePartialSpecializationDecl *PartialSpec)

Definition DeclTemplate.h:2983

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

VarTemplatePartialSpecializationDecl * getMostRecentDecl()

Definition DeclTemplate.h:2924

static bool classofKind(Kind K)

Definition DeclTemplate.h:3031

bool hasAssociatedConstraints() const

Definition DeclTemplate.h:2952

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

Definition DeclTemplate.h:2634

SourceLocation getPointOfInstantiation() const

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

Definition DeclTemplate.h:2740

VarTemplateSpecializationDecl(Kind DK, ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)

void setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten)

Set the template argument list as written in the sources.

Definition DeclTemplate.h:2826

const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const

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

Definition DeclTemplate.h:2817

void setTemplateKeywordLoc(SourceLocation Loc)

Sets the location of the template keyword.

void setSpecializationKind(TemplateSpecializationKind TSK)

Definition DeclTemplate.h:2735

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

Definition DeclTemplate.h:2868

const TemplateArgumentList & getTemplateArgs() const

Retrieve the template arguments of the variable template specialization.

Definition DeclTemplate.h:2710

const TemplateArgumentList & getTemplateInstantiationArgs() const

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

Definition DeclTemplate.h:2786

static bool classof(const Decl *D)

Definition DeclTemplate.h:2876

bool isClassScopeExplicitSpecialization() const

Definition DeclTemplate.h:2722

SourceLocation getTemplateKeywordLoc() const

Gets the location of the template keyword, if present.

Definition DeclTemplate.h:2852

SourceRange getSourceRange() const override LLVM_READONLY

Source range that this declaration covers.

friend class ASTDeclReader

Definition DeclTemplate.h:2685

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

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

Definition DeclTemplate.h:2797

void Profile(llvm::FoldingSetNodeID &ID) const

Definition DeclTemplate.h:2864

void setPointOfInstantiation(SourceLocation Loc)

Definition DeclTemplate.h:2744

void setTemplateArgsAsWritten(const TemplateArgumentListInfo &ArgsInfo)

Set the template argument list as written in the sources.

Definition DeclTemplate.h:2835

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

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

Definition DeclTemplate.h:2767

TemplateSpecializationKind getSpecializationKind() const

Determine the kind of specialization that this declaration represents.

Definition DeclTemplate.h:2714

void setInstantiationOf(VarTemplateDecl *TemplDecl)

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

Definition DeclTemplate.h:2809

friend class VarDecl

Definition DeclTemplate.h:2687

VarTemplateDecl * getSpecializedTemplate() const

Retrieve the template that this specialization specializes.

bool isExplicitInstantiationOrSpecialization() const

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

Definition DeclTemplate.h:2730

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

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

Definition DeclTemplate.h:2756

friend class ASTDeclWriter

Definition DeclTemplate.h:2686

bool isExplicitSpecialization() const

Definition DeclTemplate.h:2718

SourceLocation getExternKeywordLoc() const

Gets the location of the extern keyword, if present.

Definition DeclTemplate.h:2841

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

void setExternKeywordLoc(SourceLocation Loc)

Sets the location of the extern keyword.

void setCompleteDefinition()

Definition DeclTemplate.h:2749

VarTemplateSpecializationDecl * getMostRecentDecl()

Definition DeclTemplate.h:2700

static bool classofKind(Kind K)

Definition DeclTemplate.h:2878

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.

CanQual< Type > CanQualType

Represents a canonical, potentially-qualified type.

bool isa(CodeGen::Address addr)

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.

@ TemplateName

The identifier is a template name. FIXME: Add an annotation for that.

NamedDecl * getAsNamedDecl(TemplateParameter P)

Definition DeclTemplate.h:3346

bool isPackProducingBuiltinTemplateName(TemplateName N)

@ Create

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

nullptr

This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...

StorageClass

Storage classes.

UnsignedOrNone getExpandedPackSize(const NamedDecl *Param)

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

Definition DeclTemplate.h:3379

void * allocateDefaultArgStorageChain(const ASTContext &C)

TemplateDecl * getAsTypeTemplateDecl(Decl *D)

Definition DeclTemplate.h:3354

const FunctionProtoType * T

BuiltinTemplateKind

Kinds of BuiltinTemplateDecl.

@ FunctionTemplate

The name was classified as a function template name.

@ Concept

The name was classified as a concept name.

@ VarTemplate

The name was classified as a variable template name.

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

Definition DeclTemplate.h:1819

std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)

Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...

TemplateNameKind

Specifies the kind of template name that an identifier refers to.

@ TNK_Type_template

The name refers to a template whose specialization produces a type.

@ TNK_Concept_template

The name refers to a concept.

const Decl & adjustDeclToTemplate(const Decl &D)

If we have a 'templated' declaration for a template, adjust 'D' to refer to the actual template.

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

Stores a template parameter of any kind.

Definition DeclTemplate.h:64

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

U cast(CodeGen::Address addr)

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

Definition DeclTemplate.h:2278

CanQualType CanonInjectedTST

The Injected Template Specialization Type for this declaration.

Definition DeclTemplate.h:2289

llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > PartialSpecializations

The class template partial specializations for this class template.

Definition DeclTemplate.h:2286

llvm::FoldingSetVector< ClassTemplateSpecializationDecl > Specializations

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

Definition DeclTemplate.h:2281

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.

Definition DeclTemplate.h:1806

ExplicitInstantiationInfo()=default

SourceLocation ExternKeywordLoc

The location of the extern keyword.

Definition DeclTemplate.h:1811

const ASTTemplateArgumentListInfo * TemplateArgsAsWritten

The template arguments as written..

Definition DeclTemplate.h:1808

SourceLocation TemplateKeywordLoc

The location of the template keyword.

Definition DeclTemplate.h:1814

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

Definition DeclTemplate.h:958

llvm::FoldingSetVector< FunctionTemplateSpecializationInfo > Specializations

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

Definition DeclTemplate.h:961

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

Definition DeclTemplate.h:791

CommonBase()

Definition DeclTemplate.h:792

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

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

Definition DeclTemplate.h:800

FunctionDecl DeclType

Definition DeclTemplate.h:939

static ArrayRef< TemplateArgument > getTemplateArgs(FunctionTemplateSpecializationInfo *I)

Definition DeclTemplate.h:946

static DeclType * getDecl(FunctionTemplateSpecializationInfo *I)

Definition DeclTemplate.h:941

Definition DeclTemplate.h:733

EntryType DeclType

Definition DeclTemplate.h:734

static ArrayRef< TemplateArgument > getTemplateArgs(EntryType *D)

Definition DeclTemplate.h:740

static DeclType * getDecl(EntryType *D)

Definition DeclTemplate.h:736

Definition DeclTemplate.h:753

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

Definition DeclTemplate.h:755

DeclType * operator->() const

Definition DeclTemplate.h:763

DeclType * operator*() const

Definition DeclTemplate.h:759

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

Definition DeclTemplate.h:3041

llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > PartialSpecializations

The variable template partial specializations for this variable template.

Definition DeclTemplate.h:3049

llvm::FoldingSetVector< VarTemplateSpecializationDecl > Specializations

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

Definition DeclTemplate.h:3044