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

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_CLANG_AST_DECLBASE_H

14#define LLVM_CLANG_AST_DECLBASE_H

15

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

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

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

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

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

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

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

33#include "llvm/Support/PrettyStackTrace.h"

34#include "llvm/Support/VersionTuple.h"

35#include

36#include

37#include

38#include

39#include

40#include <type_traits>

41#include

42

44

45class ASTContext;

46class ASTMutationListener;

47class Attr;

48class BlockDecl;

49class DeclContext;

50class ExternalSourceSymbolAttr;

51class FunctionDecl;

52class FunctionType;

53class IdentifierInfo;

54enum class Linkage : unsigned char;

55class LinkageSpecDecl;

57class NamedDecl;

58class ObjCContainerDecl;

59class ObjCMethodDecl;

60struct PrintingPolicy;

61class RecordDecl;

62class SourceManager;

63class Stmt;

64class StoredDeclsMap;

65class TemplateDecl;

66class TemplateParameterList;

67class TranslationUnitDecl;

68class UsingDirectiveDecl;

69

70

71

78

79

80

81

82

83

84

85

86class alignas(8) Decl {

87public:

88

90#define DECL(DERIVED, BASE) DERIVED,

91#define ABSTRACT_DECL(DECL)

92#define DECL_RANGE(BASE, START, END) \

93 first##BASE = START, last##BASE = END,

94#define LAST_DECL_RANGE(BASE, START, END) \

95 first##BASE = START, last##BASE = END

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

97 };

98

99

100

101

103

104

105

106

107

108

109

110

111

112

113

114

116

118

119

120

121

122

123

124

126

127

128

129

131

132

133

134

135

137

138

139

141

142

143

145

146

148

149

150

151

153

154

155

156

158

159

160

161

162

164

165

166

167

169

170

171

172

173

174

176

177

179

180

182 };

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

206

207

208

209

212

213

214

215

217

219

220

221

222

223

224

226

227

228

230

231

232

233

235

236

237

238

239

241 };

242

243protected:

244

245

246

247

248

250

251private:

253

254 struct MultipleDC {

257 };

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272 llvm::PointerUnion<DeclContext*, MultipleDC*> DeclCtx;

273

274 bool isInSemaDC() const { return isa<DeclContext *>(DeclCtx); }

275 bool isOutOfSemaDC() const { return isa<MultipleDC *>(DeclCtx); }

276

277 MultipleDC *getMultipleDC() const { return cast<MultipleDC *>(DeclCtx); }

278

279 DeclContext *getSemanticDC() const { return cast<DeclContext *>(DeclCtx); }

280

281

282 SourceLocation Loc;

283

284

285 LLVM_PREFERRED_TYPE(Kind)

286 unsigned DeclKind : 7;

287

288

289 LLVM_PREFERRED_TYPE(bool)

290 unsigned InvalidDecl : 1;

291

292

293 LLVM_PREFERRED_TYPE(bool)

294 unsigned HasAttrs : 1;

295

296

297

298 LLVM_PREFERRED_TYPE(bool)

299 unsigned Implicit : 1;

300

301

302

303 LLVM_PREFERRED_TYPE(bool)

304 unsigned Used : 1;

305

306

307

308

309

310 LLVM_PREFERRED_TYPE(bool)

311 unsigned Referenced : 1;

312

313

314

315

316 LLVM_PREFERRED_TYPE(bool)

317 unsigned TopLevelDeclInObjCContainer : 1;

318

319

320 static bool StatisticsEnabled;

321

322protected:

332

333

334

337

338

339 LLVM_PREFERRED_TYPE(bool)

341

342

345

346

347 LLVM_PREFERRED_TYPE(Linkage)

349

350

351

352

353

354

355

356

357

358

360 std::size_t Extra = 0);

361

362

363 void *operator new(std::size_t Size, const ASTContext &Ctx,

365

366private:

367 bool AccessDeclContextCheck() const;

368

369

370

372 if (DC) {

373 auto *D = cast(DC);

374 auto MOK = D->getModuleOwnershipKind();

376 (D->isFromASTFile() || D->hasLocalOwningModuleStorage()))

377 return MOK;

378

379

380 }

382 }

383

384public:

390

391protected:

394 DeclCtx(DC), Loc(L), DeclKind(DK), InvalidDecl(false), HasAttrs(false),

399 if (StatisticsEnabled) add(DK);

400 }

401

403 : DeclKind(DK), InvalidDecl(false), HasAttrs(false), Implicit(false),

408 if (StatisticsEnabled) add(DK);

409 }

410

412

413

415

418 }

419

422 }

423

426 }

427

428public:

429

432 }

433

436 }

437

440 }

441

444

447

450

452 if (isInSemaDC())

453 return getSemanticDC();

454 return getMultipleDC()->SemanticDC;

455 }

458 }

459

460

461

462

466 }

467

468

469

470

471

472

476 }

477

481 }

482

484

486

487

489

490

491

492

493

497 bool IgnoreTemplateOrMacroSubstitution);

498

500

501

502

504

507 assert(AccessDeclContextCheck());

508 }

509

511 assert(AccessDeclContextCheck());

513 }

514

515

516

519 }

520

521 bool hasAttrs() const { return HasAttrs; }

522

525 }

526

529 }

530

534

536 using attr_range = llvm::iterator_range<attr_iterator>;

537

540 }

541

544 }

547 }

548

550 if (!HasAttrs) return;

551

553 llvm::erase_if(Vec, [](Attr *A) { return isa<Ts...>(A); });

554

555 if (Vec.empty())

556 HasAttrs = false;

557 }

558

559 template void dropAttr() { dropAttrs(); }

560

561 template

562 llvm::iterator_range<specific_attr_iterator> specific_attrs() const {

563 return llvm::make_range(specific_attr_begin(), specific_attr_end());

564 }

565

566 template

569 }

570

571 template

574 }

575

576 template T *getAttr() const {

577 return hasAttrs() ? getSpecificAttr(getAttrs()) : nullptr;

578 }

579

580 template bool hasAttr() const {

582 }

583

584

585

587

588

589

592

593

594

595

598

599

600

601

602

603

604

605 bool isUsed(bool CheckUsedAttr = true) const;

606

607

608

609

610

612

613

614

615

616

618

619

621

622

623

625

627

628

629

630

632 return TopLevelDeclInObjCContainer;

633 }

634

636 TopLevelDeclInObjCContainer = V;

637 }

638

639

640

642

643

644

647 }

648

649

650

651

652

653

654

655

656

657

658

659

660

662

665 }

666

667

669

670

672

673

674

676

677

679

680

682

683

685

686

688

689

690

692

693

695

696protected:

697

698

700

701

703 return;

705 }

706

707public:

708

709

710

713 }

714

715

716

718

719public:

720

721

722

723

724

725

726

727

728

729

730

731

732

733

734

735

736

739 VersionTuple EnclosingVersion = VersionTuple(),

740 StringRef *RealizedPlatform = nullptr) const;

741

742

743

744

745

746

747

749

750

751

752

753

754

755 bool isDeprecated(std::string *Message = nullptr) const {

757 }

758

759

760

761

762

763

766 }

767

768

769

770

771

772

773

775

776

777

778

779

780

781

783

784

785

787

788

789

791

792

793

795

796private:

797 Module *getOwningModuleSlow() const;

798

799protected:

801

802public:

803

804

807 return nullptr;

808

809 return getOwningModuleSlow();

810 }

811

812

813

816 return nullptr;

817

819 "owned local decl but no local module storage");

820 return reinterpret_cast<Module *const *>(this)[-1];

821 }

825 "should not have a cached owning module");

826 reinterpret_cast<Module **>(this)[-1] = M;

827 }

828

829

832 }

833

834

837 }

838

839

840

842

843

844

846

847

848

849

850

851

854 }

855

859 }

860

861

862

866 }

867

868

871 }

872

873

878 "no storage available for owning module for this declaration");

880 }

881

884 }

885

888 }

889

891

894 }

895

897

899 }

900

901

902

903

904

905

906

907

908

909

910

912 if (isInSemaDC())

913 return getSemanticDC();

914 return getMultipleDC()->LexicalDC;

915 }

918 }

919

920

921

923

924

925

927

929

930

931

933

934

935

937

938

939

940

941

944 }

945

946

947

948

949

950

951

952

953

954

955

956

957

959

960

961

967 LexicalParent));

968 }

969

970

974 }

975

976

978

979protected:

980

981

982

983

985

986

987

989

990

991

993

994public:

995

997

998 Decl *Current = nullptr;

999 Decl *Starter;

1000

1001 public:

1007

1010

1013

1015 assert(Current && "Advancing while iterator has reached end");

1016

1017 Decl *Next = Current->getNextRedeclarationImpl();

1018 assert(Next && "Should return next redeclaration or itself, never null!");

1019 Current = (Next != Starter) ? Next : nullptr;

1020 return *this;

1021 }

1022

1025 ++(*this);

1026 return tmp;

1027 }

1028

1030 return x.Current == y.Current;

1031 }

1032

1034 return x.Current != y.Current;

1035 }

1036 };

1037

1039

1040

1041

1044 }

1045

1048 }

1049

1051

1052

1053

1055

1056

1057

1060 }

1061

1062

1065 }

1066

1067

1068

1070

1071

1072

1075 }

1076

1077

1078

1079

1081

1082

1083

1084

1085

1087

1088

1089

1091

1092

1093 static void add(Kind k);

1096

1097

1098

1100

1101

1102

1104

1105

1107

1108

1110

1111

1113 return (DeclKind >= Decl::firstFunction &&

1114 DeclKind <= Decl::lastFunction) ||

1115 DeclKind == FunctionTemplate;

1116 }

1117

1118

1119

1120

1121

1122

1123

1125

1126

1127

1129

1130

1131

1133

1136 }

1137

1138

1139

1140

1141

1142

1143

1147

1148

1149

1150

1152 "namespace is not ordinary");

1153

1157 }

1158

1159

1160

1161

1164 }

1165

1166

1167

1168

1169

1170

1171

1172

1178 "namespace includes neither ordinary nor tag");

1182 "namespace includes other than ordinary or tag");

1183

1186

1189 if (PerformFriendInjection ||

1192 }

1193

1197 if (PerformFriendInjection ||

1200 }

1201 }

1202

1203

1204

1205

1206

1208

1211 FOK_Declared,

1212 FOK_Undeclared

1214

1215

1216

1217

1218

1220 unsigned mask =

1225 }

1226

1227

1231 "visible non-member operators should be in ordinary namespace");

1233 }

1234

1238

1239 void print(raw_ostream &Out, unsigned Indentation = 0,

1240 bool PrintInstantiation = false) const;

1242 unsigned Indentation = 0, bool PrintInstantiation = false) const;

1245 unsigned Indentation = 0);

1246

1247

1248 void dump() const;

1249

1250

1252

1253 void dump(raw_ostream &Out, bool Deserialize = false,

1255

1256

1257 int64_t getID() const;

1258

1259

1260

1261

1263

1264

1265

1267

1268private:

1272

1273protected:

1275};

1276

1277

1279 if (!D1 || !D2)

1280 return false;

1281

1282 if (D1 == D2)

1283 return true;

1284

1286}

1287

1288

1289

1291 const Decl *TheDecl;

1294 const char *Message;

1295

1296public:

1299 : TheDecl(theDecl), Loc(L), SM(sm), Message(Msg) {}

1300

1301 void print(raw_ostream &OS) const override;

1302};

1303}

1304

1305

1306

1307namespace llvm {

1312 }

1313 static constexpr int NumLowBitsAvailable = 3;

1314 };

1315}

1316

1317namespace clang {

1318

1320 friend class ASTContext;

1322public:

1323 using Decls = llvm::PointerUnion<NamedDecl*, DeclListNode*>;

1327

1330 public:

1336

1338

1340 assert(Ptr && "dereferencing end() iterator");

1341 if (DeclListNode *CurNode = dyn_cast<DeclListNode *>(Ptr))

1342 return CurNode->D;

1343 return cast<NamedDecl *>(Ptr);

1344 }

1349 assert(!Ptr.isNull() && "Advancing empty iterator");

1350

1351 if (DeclListNode *CurNode = dyn_cast<DeclListNode *>(Ptr))

1352 Ptr = CurNode->Rest;

1353 else

1354 Ptr = nullptr;

1355 return *this;

1356 }

1359 ++(*this);

1360 return temp;

1361 }

1362

1364 };

1365private:

1367 Decls Rest = nullptr;

1369};

1370

1371

1374

1375

1376 Decls Result;

1377

1378public:

1381

1385

1390 }

1392

1393 bool empty() const { return Result.isNull(); }

1396

1397

1398

1399

1400

1402 for (auto *D : *this)

1403 if (T *Decl = dyn_cast(D))

1404 return Decl;

1405

1406 return nullptr;

1407 }

1408};

1409

1410

1415};

1416

1421

1422

1423

1424

1425

1426

1427

1428

1429

1430

1431

1432

1433

1434

1435

1436

1437

1438

1440

1442

1444

1445

1447

1449

1450

1452

1453protected:

1455

1456

1457

1458

1459

1460

1461

1464

1466 uint64_t DeclKind : 7;

1467

1468

1469

1470

1471 LLVM_PREFERRED_TYPE(bool)

1472 mutable uint64_t ExternalLexicalStorage : 1;

1473

1474

1475

1476

1477 LLVM_PREFERRED_TYPE(bool)

1478 mutable uint64_t ExternalVisibleStorage : 1;

1479

1480

1481

1482

1483

1484 LLVM_PREFERRED_TYPE(bool)

1485 mutable uint64_t NeedToReconcileExternalVisibleStorage : 1;

1486

1487

1488

1489 LLVM_PREFERRED_TYPE(bool)

1490 mutable uint64_t HasLazyLocalLexicalLookups : 1;

1491

1492

1493

1494 LLVM_PREFERRED_TYPE(bool)

1495 mutable uint64_t HasLazyExternalLexicalLookups : 1;

1496

1497

1498

1499

1500 LLVM_PREFERRED_TYPE(bool)

1501 mutable uint64_t UseQualifiedLookup : 1;

1502 };

1503

1504

1506

1507

1508

1509

1512

1515

1516

1517 LLVM_PREFERRED_TYPE(bool)

1518 uint64_t IsInline : 1;

1519

1520

1521 LLVM_PREFERRED_TYPE(bool)

1522 uint64_t IsNested : 1;

1523 };

1524

1525

1527

1528

1529

1530

1533

1536

1537

1539 uint64_t TagDeclKind : 3;

1540

1541

1542

1543

1544 LLVM_PREFERRED_TYPE(bool)

1545 uint64_t IsCompleteDefinition : 1;

1546

1547

1548 LLVM_PREFERRED_TYPE(bool)

1549 uint64_t IsBeingDefined : 1;

1550

1551

1552

1553 LLVM_PREFERRED_TYPE(bool)

1554 uint64_t IsEmbeddedInDeclarator : 1;

1555

1556

1557 LLVM_PREFERRED_TYPE(bool)

1558 uint64_t IsFreeStanding : 1;

1559

1560

1561

1562

1563

1564 LLVM_PREFERRED_TYPE(bool)

1565 uint64_t MayHaveOutOfDateDef : 1;

1566

1567

1568

1569 LLVM_PREFERRED_TYPE(bool)

1570 uint64_t IsCompleteDefinitionRequired : 1;

1571

1572

1573

1574 LLVM_PREFERRED_TYPE(bool)

1575 uint64_t IsThisDeclarationADemotedDefinition : 1;

1576 };

1577

1578

1580

1581

1582

1583

1586

1589

1590

1591

1592 uint64_t NumPositiveBits : 8;

1593

1594

1595

1596 uint64_t NumNegativeBits : 8;

1597

1598

1599

1600 LLVM_PREFERRED_TYPE(bool)

1601 uint64_t IsScoped : 1;

1602

1603

1604

1605

1606

1607 LLVM_PREFERRED_TYPE(bool)

1608 uint64_t IsScopedUsingClassTag : 1;

1609

1610

1611

1612 LLVM_PREFERRED_TYPE(bool)

1613 uint64_t IsFixed : 1;

1614

1615

1616 LLVM_PREFERRED_TYPE(bool)

1617 uint64_t HasODRHash : 1;

1618 };

1619

1620

1622

1623

1624

1625

1628

1631

1632

1633

1634

1635 LLVM_PREFERRED_TYPE(bool)

1636 uint64_t HasFlexibleArrayMember : 1;

1637

1638

1639 LLVM_PREFERRED_TYPE(bool)

1640 uint64_t AnonymousStructOrUnion : 1;

1641

1642

1643

1644 LLVM_PREFERRED_TYPE(bool)

1645 uint64_t HasObjectMember : 1;

1646

1647

1648

1649 LLVM_PREFERRED_TYPE(bool)

1650 uint64_t HasVolatileMember : 1;

1651

1652

1653

1654

1655

1656 LLVM_PREFERRED_TYPE(bool)

1657 mutable uint64_t LoadedFieldsFromExternalStorage : 1;

1658

1659

1660 LLVM_PREFERRED_TYPE(bool)

1661 uint64_t NonTrivialToPrimitiveDefaultInitialize : 1;

1662 LLVM_PREFERRED_TYPE(bool)

1663 uint64_t NonTrivialToPrimitiveCopy : 1;

1664 LLVM_PREFERRED_TYPE(bool)

1665 uint64_t NonTrivialToPrimitiveDestroy : 1;

1666

1667

1668

1669

1670 LLVM_PREFERRED_TYPE(bool)

1671 uint64_t HasNonTrivialToPrimitiveDefaultInitializeCUnion : 1;

1672 LLVM_PREFERRED_TYPE(bool)

1673 uint64_t HasNonTrivialToPrimitiveDestructCUnion : 1;

1674 LLVM_PREFERRED_TYPE(bool)

1675 uint64_t HasNonTrivialToPrimitiveCopyCUnion : 1;

1676

1677

1678

1679

1680

1681

1682 LLVM_PREFERRED_TYPE(bool)

1683 uint64_t HasUninitializedExplicitInitFields : 1;

1684

1685

1686 LLVM_PREFERRED_TYPE(bool)

1687 uint64_t ParamDestroyedInCallee : 1;

1688

1689

1691 uint64_t ArgPassingRestrictions : 2;

1692

1693

1694 LLVM_PREFERRED_TYPE(bool)

1695 uint64_t IsRandomized : 1;

1696

1697

1698

1700 };

1701

1702

1704

1705

1706

1707

1710

1713

1714

1715

1717 uint64_t InitializerKind : 2;

1718 };

1719

1720

1721

1723

1724

1725

1726

1727

1730

1732

1735

1737 uint64_t SClass : 3;

1738 LLVM_PREFERRED_TYPE(bool)

1739 uint64_t IsInline : 1;

1740 LLVM_PREFERRED_TYPE(bool)

1741 uint64_t IsInlineSpecified : 1;

1742

1743 LLVM_PREFERRED_TYPE(bool)

1744 uint64_t IsVirtualAsWritten : 1;

1745 LLVM_PREFERRED_TYPE(bool)

1746 uint64_t IsPureVirtual : 1;

1747 LLVM_PREFERRED_TYPE(bool)

1748 uint64_t HasInheritedPrototype : 1;

1749 LLVM_PREFERRED_TYPE(bool)

1750 uint64_t HasWrittenPrototype : 1;

1751 LLVM_PREFERRED_TYPE(bool)

1752 uint64_t IsDeleted : 1;

1753

1754 LLVM_PREFERRED_TYPE(bool)

1755 uint64_t IsTrivial : 1;

1756

1757

1758

1759

1760 LLVM_PREFERRED_TYPE(bool)

1761 uint64_t IsTrivialForCall : 1;

1762

1763 LLVM_PREFERRED_TYPE(bool)

1764 uint64_t IsDefaulted : 1;

1765 LLVM_PREFERRED_TYPE(bool)

1766 uint64_t IsExplicitlyDefaulted : 1;

1767 LLVM_PREFERRED_TYPE(bool)

1768 uint64_t HasDefaultedOrDeletedInfo : 1;

1769

1770

1771

1772

1773 LLVM_PREFERRED_TYPE(bool)

1774 uint64_t IsIneligibleOrNotSelected : 1;

1775

1776 LLVM_PREFERRED_TYPE(bool)

1777 uint64_t HasImplicitReturnZero : 1;

1778 LLVM_PREFERRED_TYPE(bool)

1779 uint64_t IsLateTemplateParsed : 1;

1780

1781

1783 uint64_t ConstexprKind : 2;

1784 LLVM_PREFERRED_TYPE(bool)

1785 uint64_t BodyContainsImmediateEscalatingExpression : 1;

1786

1787 LLVM_PREFERRED_TYPE(bool)

1788 uint64_t InstantiationIsPending : 1;

1789

1790

1791 LLVM_PREFERRED_TYPE(bool)

1792 uint64_t UsesSEHTry : 1;

1793

1794

1795

1796 LLVM_PREFERRED_TYPE(bool)

1797 uint64_t HasSkippedBody : 1;

1798

1799

1800

1801 LLVM_PREFERRED_TYPE(bool)

1802 uint64_t WillHaveBody : 1;

1803

1804

1805

1806 LLVM_PREFERRED_TYPE(bool)

1807 uint64_t IsMultiVersion : 1;

1808

1809

1810

1811

1813 uint64_t DeductionCandidateKind : 2;

1814

1815

1816 LLVM_PREFERRED_TYPE(bool)

1817 uint64_t HasODRHash : 1;

1818

1819

1820 LLVM_PREFERRED_TYPE(bool)

1821 uint64_t UsesFPIntrin : 1;

1822

1823

1824

1825 LLVM_PREFERRED_TYPE(bool)

1826 uint64_t FriendConstraintRefersToEnclosingTemplate : 1;

1827 };

1828

1829

1831

1832

1833

1834

1837

1840

1841

1842

1843

1844

1845

1846 uint64_t NumCtorInitializers : 17;

1847 LLVM_PREFERRED_TYPE(bool)

1848 uint64_t IsInheritingConstructor : 1;

1849

1850

1851 LLVM_PREFERRED_TYPE(bool)

1852 uint64_t HasTrailingExplicitSpecifier : 1;

1853

1854

1855 LLVM_PREFERRED_TYPE(bool)

1856 uint64_t IsSimpleExplicit : 1;

1857 };

1858

1859

1861

1862

1863

1864

1867

1868

1871

1872

1873

1874

1877

1878

1879 LLVM_PREFERRED_TYPE(bool)

1880 uint64_t IsInstance : 1;

1881 LLVM_PREFERRED_TYPE(bool)

1882 uint64_t IsVariadic : 1;

1883

1884

1885 LLVM_PREFERRED_TYPE(bool)

1886 uint64_t IsPropertyAccessor : 1;

1887

1888

1889 LLVM_PREFERRED_TYPE(bool)

1890 uint64_t IsSynthesizedAccessorStub : 1;

1891

1892

1893 LLVM_PREFERRED_TYPE(bool)

1894 uint64_t IsDefined : 1;

1895

1896

1897 LLVM_PREFERRED_TYPE(bool)

1898 uint64_t IsRedeclaration : 1;

1899

1900

1901 LLVM_PREFERRED_TYPE(bool)

1902 mutable uint64_t HasRedeclaration : 1;

1903

1904

1906 uint64_t DeclImplementation : 2;

1907

1908

1910 uint64_t objcDeclQualifier : 7;

1911

1912

1913 LLVM_PREFERRED_TYPE(bool)

1914 uint64_t RelatedResultType : 1;

1915

1916

1917

1919 uint64_t SelLocsKind : 2;

1920

1921

1922

1923

1924

1925

1926

1927

1928 LLVM_PREFERRED_TYPE(bool)

1929 uint64_t IsOverriding : 1;

1930

1931

1932 LLVM_PREFERRED_TYPE(bool)

1933 uint64_t HasSkippedBody : 1;

1934 };

1935

1936

1938

1939

1940

1941

1944

1947

1948

1949

1951 };

1952

1953

1954

1955

1957

1958

1959

1960

1963

1966

1967

1970

1971

1972

1973

1974

1975 LLVM_PREFERRED_TYPE(bool)

1976 uint64_t HasBraces : 1;

1977 };

1978

1979

1981

1982

1983

1984

1987

1990

1991 LLVM_PREFERRED_TYPE(bool)

1992 uint64_t IsVariadic : 1;

1993 LLVM_PREFERRED_TYPE(bool)

1994 uint64_t CapturesCXXThis : 1;

1995 LLVM_PREFERRED_TYPE(bool)

1996 uint64_t BlockMissingReturnType : 1;

1997 LLVM_PREFERRED_TYPE(bool)

1998 uint64_t IsConversionFromLambda : 1;

1999

2000

2001

2002 LLVM_PREFERRED_TYPE(bool)

2003 uint64_t DoesNotEscape : 1;

2004

2005

2006

2007

2008 LLVM_PREFERRED_TYPE(bool)

2009 uint64_t CanAvoidCopyToHeap : 1;

2010 };

2011

2012

2014

2015

2016

2017

2018

2019

2020

2022

2023protected:

2024

2025

2026

2027

2028

2029

2030

2031

2032 union {

2045

2047 "DeclContextBitfields is larger than 8 bytes!");

2049 "NamespaceDeclBitfields is larger than 8 bytes!");

2051 "TagDeclBitfields is larger than 8 bytes!");

2053 "EnumDeclBitfields is larger than 8 bytes!");

2055 "RecordDeclBitfields is larger than 8 bytes!");

2057 "OMPDeclareReductionDeclBitfields is larger than 8 bytes!");

2059 "FunctionDeclBitfields is larger than 8 bytes!");

2061 "CXXConstructorDeclBitfields is larger than 8 bytes!");

2063 "ObjCMethodDeclBitfields is larger than 8 bytes!");

2065 "ObjCContainerDeclBitfields is larger than 8 bytes!");

2067 "LinkageSpecDeclBitfields is larger than 8 bytes!");

2069 "BlockDeclBitfields is larger than 8 bytes!");

2070 };

2071

2072

2073

2075

2076

2077

2078

2079

2081

2082

2083

2084

2085 static std::pair<Decl *, Decl *>

2087

2089

2090public:

2092

2093

2094

2096

2099 }

2100

2102

2103

2105 return cast(this)->getDeclContext();

2106 }

2109 }

2110

2111

2112

2113

2114

2115

2116

2117

2118

2119

2121 return cast(this)->getLexicalDeclContext();

2122 }

2125 }

2126

2128

2131 }

2132

2134 return cast(this)->getASTContext();

2135 }

2136

2138

2139

2140

2142

2145 case Decl::ObjCCategory:

2146 case Decl::ObjCCategoryImpl:

2147 case Decl::ObjCImplementation:

2148 case Decl::ObjCInterface:

2149 case Decl::ObjCProtocol:

2150 return true;

2151 default:

2152 return false;

2153 }

2154 }

2155

2158 case Decl::Block:

2159 case Decl::Captured:

2160 case Decl::ObjCMethod:

2161 case Decl::TopLevelStmt:

2162 return true;

2163 default:

2164 return getDeclKind() >= Decl::firstFunction &&

2166 }

2167 }

2168

2169

2173 }

2174

2176 return getDeclKind() == Decl::TranslationUnit ||

2178 }

2179

2181 return getDeclKind() == Decl::TranslationUnit;

2182 }

2183

2185 return getDeclKind() >= Decl::firstRecord &&

2187 }

2188

2190 return getDeclKind() == Decl::RequiresExprBody;

2191 }

2192

2194

2196

2198

2199

2200

2202

2203

2204

2205

2206

2207

2208

2209

2210

2211

2212

2213

2214

2215

2216

2217

2219

2220

2221

2223

2224

2226

2227

2228

2230

2231

2232

2235 }

2236

2237

2238

2240

2241

2242

2243

2247 }

2248

2249

2253 }

2254

2255

2256

2257

2258

2259

2260

2264 }

2265

2266

2267

2268

2272 }

2273

2274

2278 }

2279

2280

2284 }

2285

2286

2287

2288

2289

2290

2291

2293

2294

2295

2296

2297

2298

2299

2300

2301

2302

2303

2304

2305

2306

2307

2308

2309

2310

2311

2312

2313

2314

2315

2316

2318

2319

2320

2322

2323 Decl *Current = nullptr;

2324

2325 public:

2331

2334

2336

2337

2339

2341 Current = Current->getNextDeclInContext();

2342 return *this;

2343 }

2344

2347 ++(*this);

2348 return tmp;

2349 }

2350

2352 return x.Current == y.Current;

2353 }

2354

2356 return x.Current != y.Current;

2357 }

2358 };

2359

2360 using decl_range = llvm::iterator_range<decl_iterator>;

2361

2362

2363

2368

2369

2370

2371

2374 }

2377

2378

2379

2380

2381

2382

2383 template

2385

2386

2387

2389

2390

2391

2392

2393 void SkipToNextDecl() {

2394 while (*Current && !isa(*Current))

2395 ++Current;

2396 }

2397

2398 public:

2400

2401

2405 std::iterator_traitsDeclContext::decl\_iterator::difference_type;

2407

2409

2410

2411

2412

2413

2414

2415

2416

2417

2419 SkipToNextDecl();

2420 }

2421

2423

2424

2426

2428 ++Current;

2429 SkipToNextDecl();

2430 return *this;

2431 }

2432

2435 ++(*this);

2436 return tmp;

2437 }

2438

2441 return x.Current == y.Current;

2442 }

2443

2446 return x.Current != y.Current;

2447 }

2448 };

2449

2450

2451

2452

2453

2454

2455

2456

2457

2458

2459 template<typename SpecificDecl, bool (SpecificDecl::*Acceptable)() const>

2461

2462

2463

2465

2466

2467

2468

2469 void SkipToNextDecl() {

2470 while (*Current &&

2471 (!isa(*Current) ||

2472 (Acceptable && !(cast(*Current)->*Acceptable)())))

2473 ++Current;

2474 }

2475

2476 public:

2478

2479

2483 std::iterator_traitsDeclContext::decl\_iterator::difference_type;

2485

2487

2488

2489

2490

2491

2492

2493

2494

2495

2497 SkipToNextDecl();

2498 }

2499

2502

2504 ++Current;

2505 SkipToNextDecl();

2506 return *this;

2507 }

2508

2511 ++(*this);

2512 return tmp;

2513 }

2514

2517 return x.Current == y.Current;

2518 }

2519

2522 return x.Current != y.Current;

2523 }

2524 };

2525

2526

2527

2528

2529

2530

2531

2532

2533

2534

2535

2536

2537

2539

2540

2541

2542

2543

2544

2545

2546

2547

2549

2550

2551

2552

2553

2554

2555

2557

2558

2560

2561

2563

2564

2565

2567

2570

2571

2572

2573

2574

2575

2577

2578

2579

2580

2582

2583

2584

2585

2586

2587

2588

2589

2590

2591

2594

2595

2596

2597

2598

2599

2600

2601

2602

2603

2604

2605

2606

2607

2608

2610

2611

2612

2614

2615 using lookups_range = llvm::iterator_range<all_lookups_iterator>;

2616

2618

2619

2621

2622

2625

2626

2627

2628

2631

2633

2638

2641

2643 };

2644

2645 using udir_range = llvm::iterator_range<udir_iterator>;

2646

2648

2649

2651

2652 using ddiag_range = llvm::iterator_rangeDeclContext::ddiag\_iterator;

2653

2655

2656

2657

2658

2659

2660

2661

2662

2663

2666 "should only be called on primary context");

2668 }

2669

2670

2671

2673

2674

2676

2677

2678

2681 }

2682

2683

2684

2687 }

2688

2689

2690

2693 }

2694

2695

2696

2700 DeclContextBits.NeedToReconcileExternalVisibleStorage = true;

2701 }

2702

2703

2704

2706 return D && (D->NextInContextAndBits.getPointer() || D == FirstDecl ||

2708 }

2709

2712 }

2713

2716 }

2717

2720

2725 void dumpLookups(llvm::raw_ostream &OS, bool DumpDecls = false,

2726 bool Deserialize = false) const;

2727

2728private:

2730 const DeclContext *OriginalLookupDC) const;

2731

2732

2733

2734

2735

2736 bool hasNeedToReconcileExternalVisibleStorage() const {

2737 return DeclContextBits.NeedToReconcileExternalVisibleStorage;

2738 }

2739

2740

2741

2742

2743

2744 void setNeedToReconcileExternalVisibleStorage(bool Need = true) const {

2745 DeclContextBits.NeedToReconcileExternalVisibleStorage = Need;

2746 }

2747

2748

2749

2750 bool hasLazyLocalLexicalLookups() const {

2752 }

2753

2754

2755

2756 void setHasLazyLocalLexicalLookups(bool HasLLLL = true) const {

2758 }

2759

2760

2761

2762 bool hasLazyExternalLexicalLookups() const {

2764 }

2765

2766

2767

2768 void setHasLazyExternalLexicalLookups(bool HasLELL = true) const {

2769 DeclContextBits.HasLazyExternalLexicalLookups = HasLELL;

2770 }

2771

2772 void reconcileExternalVisibleStorage() const;

2773 bool LoadLexicalDeclsFromExternalStorage() const;

2774

2775 StoredDeclsMap *CreateStoredDeclsMap(ASTContext &C) const;

2776

2777 void loadLazyLocalLexicalLookups();

2778 void buildLookupImpl(DeclContext *DCtx, bool Internal);

2779 void makeDeclVisibleInContextWithFlags(NamedDecl *D, bool Internal,

2780 bool Rediscoverable);

2781 void makeDeclVisibleInContextImpl(NamedDecl *D, bool Internal);

2782};

2783

2785 return getKind() == TemplateTypeParm || getKind() == NonTypeTemplateParm ||

2786 getKind() == TemplateTemplateParm;

2787}

2788

2789

2790template <class ToTy,

2791 bool IsKnownSubtype = ::std::is_base_of<DeclContext, ToTy>::value>

2795 }

2796

2799 }

2800};

2801

2802

2803template

2806 return static_cast<const ToTy*>(Val);

2807 }

2808

2810 return static_cast<ToTy*>(Val);

2811 }

2812};

2813

2814}

2815

2816namespace llvm {

2817

2818

2819template

2821 static bool doit(const ::clang::DeclContext &Val) {

2822 return To::classofKind(Val.getDeclKind());

2823 }

2824};

2825

2826

2827template

2828struct cast_convert_val<ToTy,

2830 static const ToTy &doit(const ::clang::DeclContext &Val) {

2832 }

2833};

2834

2835template

2839 }

2840};

2841

2842template

2843struct cast_convert_val<ToTy,

2845 static const ToTy *doit(const ::clang::DeclContext *Val) {

2846 return ::clang::cast_convert_decl_context::doit(Val);

2847 }

2848};

2849

2850template

2853 return ::clang::cast_convert_decl_context::doit(Val);

2854 }

2855};

2856

2857

2858template

2860 static ::clang::DeclContext &doit(const FromTy &Val) {

2861 return *FromTy::castToDeclContext(&Val);

2862 }

2863};

2864

2865template

2867 static ::clang::DeclContext *doit(const FromTy *Val) {

2868 return FromTy::castToDeclContext(Val);

2869 }

2870};

2871

2872template

2874 static const ::clang::DeclContext &doit(const FromTy &Val) {

2875 return *FromTy::castToDeclContext(&Val);

2876 }

2877};

2878

2879template

2881 static const ::clang::DeclContext *doit(const FromTy *Val) {

2882 return FromTy::castToDeclContext(Val);

2883 }

2884};

2885

2886}

2887

2888#endif

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

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

Defines the clang::LangOptions interface.

Defines the clang::SourceLocation class and associated facilities.

Defines various enumerations that describe declaration and type specifiers.

__PTRDIFF_TYPE__ ptrdiff_t

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

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

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

Writes an AST file containing the contents of a translation unit.

Attr - This represents one attribute.

Represents a block literal declaration, which is like an unnamed FunctionDecl.

Represents a C++ constructor within a class.

Represents a C++ deduction guide declaration.

The results of name lookup within a DeclContext.

DeclContextLookupResult(Decls Result)

DeclContextLookupResult()=default

const_iterator begin() const

DeclListNode::iterator iterator

const_iterator end() const

bool isSingleResult() const

Stores the bits used by BlockDecl.

Stores the bits used by CXXConstructorDecl.

Stores the bits used by DeclContext.

Stores the bits used by EnumDecl.

Stores the bits used by FunctionDecl.

Stores the bits used by LinkageSpecDecl.

Stores the bits used by NamespaceDecl.

Stores the bits used by OMPDeclareReductionDecl.

Stores the bits used by ObjCContainerDecl.

Stores the bits used by ObjCMethodDecl.

Stores the bits used by RecordDecl.

Stores the bits used by TagDecl.

all_lookups_iterator - An iterator that provides a view over the results of looking up every possible...

An iterator over the dependent diagnostics in a dependent context.

decl_iterator - Iterates through the declarations stored within this context.

std::ptrdiff_t difference_type

std::forward_iterator_tag iterator_category

decl_iterator operator++(int)

value_type operator->() const

friend bool operator!=(decl_iterator x, decl_iterator y)

friend bool operator==(decl_iterator x, decl_iterator y)

reference operator*() const

decl_iterator & operator++()

Iterates over a filtered subrange of declarations stored in a DeclContext.

std::forward_iterator_tag iterator_category

value_type operator->() const

filtered_decl_iterator(DeclContext::decl_iterator C)

filtered_decl_iterator - Construct a new iterator over a subset of the declarations the range [C,...

friend bool operator==(const filtered_decl_iterator &x, const filtered_decl_iterator &y)

value_type operator*() const

filtered_decl_iterator operator++(int)

friend bool operator!=(const filtered_decl_iterator &x, const filtered_decl_iterator &y)

std::iterator_traits< DeclContext::decl_iterator >::difference_type difference_type

SpecificDecl * value_type

filtered_decl_iterator()=default

filtered_decl_iterator & operator++()

specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...

specific_decl_iterator()=default

specific_decl_iterator(DeclContext::decl_iterator C)

specific_decl_iterator - Construct a new iterator over a subset of the declarations the range [C,...

value_type operator->() const

friend bool operator==(const specific_decl_iterator &x, const specific_decl_iterator &y)

std::forward_iterator_tag iterator_category

value_type operator*() const

SpecificDecl * value_type

specific_decl_iterator operator++(int)

friend bool operator!=(const specific_decl_iterator &x, const specific_decl_iterator &y)

specific_decl_iterator & operator++()

std::iterator_traits< DeclContext::decl_iterator >::difference_type difference_type

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

DeclContext * getParent()

getParent - Returns the containing DeclContext.

udir_range using_directives() const

Returns iterator range [First, Last) of UsingDirectiveDecls stored within this context.

bool Equals(const DeclContext *DC) const

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

lookup_result::iterator lookup_iterator

bool isRequiresExprBody() const

FunctionDeclBitfields FunctionDeclBits

bool isFileContext() const

void setHasExternalVisibleStorage(bool ES=true) const

State whether this DeclContext has external storage for declarations visible in this context.

void makeDeclVisibleInContext(NamedDecl *D)

Makes a declaration visible within this context.

all_lookups_iterator noload_lookups_begin() const

Iterators over all possible lookups within this context that are currently loaded; don't attempt to r...

void dumpLookups(llvm::raw_ostream &OS, bool DumpDecls=false, bool Deserialize=false) const

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

Build up a chain of declarations.

bool isTransparentContext() const

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

Decl * getNonClosureAncestor()

Find the nearest non-closure ancestor of this context, i.e.

bool isObjCContainer() const

ObjCMethodDeclBitfields ObjCMethodDeclBits

TagDeclBitfields TagDeclBits

ASTContext & getParentASTContext() const

lookups_range noload_lookups(bool PreserveInternalState) const

const DeclContext * getParent() const

bool isExternCXXContext() const

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

bool isDependentContext() const

Determines whether this context is dependent on a template parameter.

bool InEnclosingNamespaceSetOf(const DeclContext *NS) const

Test if this context is part of the enclosing namespace set of the context NS, as defined in C++0x [n...

const DeclContext * getRedeclContext() const

EnumDeclBitfields EnumDeclBits

CXXConstructorDeclBitfields CXXConstructorDeclBits

static bool classof(const DeclContext *D)

const Decl * getNonClosureAncestor() const

DeclContext * getLexicalParent()

getLexicalParent - Returns the containing lexical DeclContext.

lookup_result lookup(DeclarationName Name) const

lookup - Find the declarations (if any) with the given Name in this context.

@ NumOMPDeclareReductionDeclBits

bool isLookupContext() const

Test whether the context supports looking up names.

const BlockDecl * getInnermostBlockDecl() const

Return this DeclContext if it is a BlockDecl.

bool hasExternalVisibleStorage() const

Whether this DeclContext has external storage containing additional declarations that are visible in ...

const DeclContext * getPrimaryContext() const

ObjCContainerDeclBitfields ObjCContainerDeclBits

const char * getDeclKindName() const

BlockDeclBitfields BlockDeclBits

bool isTranslationUnit() const

void collectAllContexts(SmallVectorImpl< DeclContext * > &Contexts)

Collects all of the declaration contexts that are semantically connected to this declaration context.

DeclContext * getRedeclContext()

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

llvm::iterator_range< udir_iterator > udir_range

all_lookups_iterator lookups_end() const

void setMustBuildLookupTable()

Mark that there are external lexical declarations that we need to include in our lookup table (and th...

RecordDeclBitfields RecordDeclBits

Decl * FirstDecl

FirstDecl - The first declaration stored within this declaration context.

decl_iterator noload_decls_begin() const

void addDeclInternal(Decl *D)

Add the declaration D into this context, but suppress searches for external declarations with the sam...

lookups_range lookups() const

const DeclContext * getLookupParent() const

bool shouldUseQualifiedLookup() const

bool containsDeclAndLoad(Decl *D) const

Checks whether a declaration is in this context.

void removeDecl(Decl *D)

Removes a declaration from this context.

void addDecl(Decl *D)

Add the declaration D into this context.

llvm::iterator_range< decl_iterator > decl_range

void dumpDeclContext() const

StoredDeclsMap * buildLookup()

Ensure the lookup structure is fully-built and return it.

decl_iterator decls_end() const

bool hasValidDeclKind() const

bool isStdNamespace() const

ddiag_range ddiags() const

llvm::iterator_adaptor_base< udir_iterator, lookup_iterator, typename lookup_iterator::iterator_category, UsingDirectiveDecl * > udir_iterator_base

lookup_result noload_lookup(DeclarationName Name)

Find the declarations with the given name that are visible within this context; don't attempt to retr...

static bool classof(const Decl *D)

@ NumObjCContainerDeclBits

const DeclContext * getNonTransparentContext() const

const RecordDecl * getOuterLexicalRecordContext() const

bool containsDecl(Decl *D) const

Checks whether a declaration is in this context.

llvm::iterator_range< DeclContext::ddiag_iterator > ddiag_range

bool hasExternalLexicalStorage() const

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

void setUseQualifiedLookup(bool use=true) const

DeclContext * getEnclosingNamespaceContext()

Retrieve the nearest enclosing namespace context.

@ NumCXXConstructorDeclBits

Decl * LastDecl

LastDecl - The last declaration stored within this declaration context.

NamespaceDeclBitfields NamespaceDeclBits

all_lookups_iterator lookups_begin() const

Iterators over all possible lookups within this context.

llvm::iterator_range< all_lookups_iterator > lookups_range

decl_range noload_decls() const

noload_decls_begin/end - Iterate over the declarations stored in this context that are currently load...

DeclContext * getPrimaryContext()

getPrimaryContext - There may be many different declarations of the same entity (including forward de...

RecordDecl * getOuterLexicalRecordContext()

Retrieve the outermost lexically enclosing record context.

const DeclContext * getEnclosingNamespaceContext() const

decl_range decls() const

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

bool isInlineNamespace() const

DeclContextBitfields DeclContextBits

bool isFunctionOrMethod() const

void setHasExternalLexicalStorage(bool ES=true) const

State whether this DeclContext has external storage for declarations lexically in this context.

DeclContext * getLookupParent()

Find the parent context of this context that will be used for unqualified name lookup.

StoredDeclsMap * LookupPtr

Pointer to the data structure used to lookup declarations within this context (or a DependentStoredDe...

bool isExternCContext() const

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

all_lookups_iterator noload_lookups_end() const

const LinkageSpecDecl * getExternCContext() const

Retrieve the nearest enclosing C linkage specification context.

LinkageSpecDeclBitfields LinkageSpecDeclBits

decl_iterator noload_decls_end() const

StoredDeclsMap * getLookupPtr() const

Retrieve the internal representation of the lookup structure.

bool Encloses(const DeclContext *DC) const

Determine whether this declaration context encloses the declaration context DC.

void addHiddenDecl(Decl *D)

Add the declaration D to this context without modifying any lookup tables.

void localUncachedLookup(DeclarationName Name, SmallVectorImpl< NamedDecl * > &Results)

A simplistic name lookup mechanism that performs name lookup into this declaration context without co...

OMPDeclareReductionDeclBitfields OMPDeclareReductionDeclBits

bool isDeclInLexicalTraversal(const Decl *D) const

Determine whether the given declaration is stored in the list of declarations lexically within this c...

Decl::Kind getDeclKind() const

DeclContext * getNonTransparentContext()

decl_iterator decls_begin() const

const DeclContext * getLexicalParent() const

std::forward_iterator_tag iterator_category

ptrdiff_t difference_type

reference operator*() const

bool operator==(const iterator &X) const

bool operator!=(const iterator &X) const

A list storing NamedDecls in the lookup tables.

llvm::PointerUnion< NamedDecl *, DeclListNode * > Decls

Iterates through all the redeclarations of the same decl.

friend bool operator!=(redecl_iterator x, redecl_iterator y)

value_type operator->() const

redecl_iterator & operator++()

redecl_iterator operator++(int)

friend bool operator==(redecl_iterator x, redecl_iterator y)

std::ptrdiff_t difference_type

redecl_iterator()=default

reference operator*() const

std::forward_iterator_tag iterator_category

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

Decl * getPreviousDecl()

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

Decl * getMostRecentDecl()

Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...

const DeclContext * getParentFunctionOrMethod(bool LexicalParent=false) const

If this decl is defined inside a function/method/block it returns the corresponding DeclContext,...

bool isInStdNamespace() const

unsigned CacheValidAndLinkage

If 0, we have not computed the linkage of this declaration.

bool isInCurrentModuleUnit() const

Whether this declaration comes from the same module unit being compiled.

SourceLocation getEndLoc() const LLVM_READONLY

bool isModulePrivate() const

Whether this declaration was marked as being private to the module in which it was defined.

TemplateDecl * getDescribedTemplate() const

If this is a declaration that describes some template, this method returns that template declaration.

bool isTemplateDecl() const

returns true if this declaration is a template

Module * getTopLevelOwningNamedModule() const

Get the top level owning named module that owns this declaration if any.

FriendObjectKind getFriendObjectKind() const

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

bool isFunctionOrFunctionTemplate() const

Whether this declaration is a function or function template.

bool isFromGlobalModule() const

Whether this declaration comes from global module.

ASTContext & getASTContext() const LLVM_READONLY

void setOwningModuleID(unsigned ID)

Set the owning module ID.

attr_iterator attr_end() const

bool isImplicit() const

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

void setAttrs(const AttrVec &Attrs)

bool isUnavailable(std::string *Message=nullptr) const

Determine whether this declaration is marked 'unavailable'.

bool hasLocalOwningModuleStorage() const

const Decl * getPreviousDecl() const

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

bool isFunctionPointerType() const

bool isInNamedModule() const

Whether this declaration comes from a named module.

const TranslationUnitDecl * getTranslationUnitDecl() const

ExternalSourceSymbolAttr * getExternalSourceSymbolAttr() const

Looks on this and related declarations for an applicable external source symbol attribute.

void setFromASTFile()

Set the FromASTFile flag.

void setLocalExternDecl()

Changes the namespace of this declaration to reflect that it's a function-local extern declaration.

Decl(Kind DK, DeclContext *DC, SourceLocation L)

virtual bool isOutOfLine() const

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

virtual Decl * getPreviousDeclImpl()

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

Decl(Kind DK, EmptyShell Empty)

llvm::iterator_range< redecl_iterator > redecl_range

const Decl * getCanonicalDecl() const

bool isWeakImported() const

Determine whether this is a weak-imported symbol.

ModuleOwnershipKind getModuleOwnershipKind() const

Get the kind of module ownership for this declaration.

bool isParameterPack() const

Whether this declaration is a parameter pack.

ASTMutationListener * getASTMutationListener() const

bool hasCachedLinkage() const

unsigned getMaxAlignment() const

getMaxAlignment - return the maximum alignment specified by attributes on this decl,...

AvailabilityResult getAvailability(std::string *Message=nullptr, VersionTuple EnclosingVersion=VersionTuple(), StringRef *RealizedPlatform=nullptr) const

Determine the availability of the given declaration.

void setInvalidDecl(bool Invalid=true)

setInvalidDecl - Indicates the Decl had a semantic error.

bool isUnconditionallyVisible() const

Determine whether this declaration is definitely visible to name lookup, independent of whether the o...

DeclContext * getParentFunctionOrMethod(bool LexicalParent=false)

Kind

Lists the kind of concrete classes of Decl.

void clearIdentifierNamespace()

Clears the namespace of this declaration.

AttrVec::const_iterator attr_iterator

static unsigned getIdentifierNamespaceForKind(Kind DK)

void setTopLevelDeclInObjCContainer(bool V=true)

virtual Stmt * getBody() const

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

void markUsed(ASTContext &C)

Mark the declaration used, in the sense of odr-use.

bool isInIdentifierNamespace(unsigned NS) const

bool isFileContextDecl() const

static Decl * castFromDeclContext(const DeclContext *)

@ FOK_Undeclared

A friend of a previously-undeclared entity.

@ FOK_None

Not a friend object.

@ FOK_Declared

A friend of a previously-declared entity.

Decl * getNextDeclInContext()

bool isInvisibleOutsideTheOwningModule() const

bool isTemplated() const

Determine whether this declaration is a templated entity (whether it is.

bool isInExportDeclContext() const

Whether this declaration was exported in a lexical context.

SourceLocation getBodyRBrace() const

getBodyRBrace - Gets the right brace of the body, if a body exists.

static bool isTagIdentifierNamespace(unsigned NS)

bool isReferenced() const

Whether any declaration of this entity was referenced.

const FunctionType * getFunctionType(bool BlocksToo=true) const

Looks through the Decl's underlying type to extract a FunctionType when possible.

bool isCanonicalDecl() const

Whether this particular Decl is a canonical one.

bool isInAnotherModuleUnit() const

Whether this declaration comes from another module unit.

llvm::PointerIntPair< Decl *, 3, ModuleOwnershipKind > NextInContextAndBits

The next declaration within the same lexical DeclContext.

Module * getOwningModule() const

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

unsigned getTemplateDepth() const

Determine the number of levels of template parameter surrounding this declaration.

bool isFirstDecl() const

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

bool isFromExplicitGlobalModule() const

Whether this declaration comes from explicit global module.

FunctionDecl * getAsFunction() LLVM_READONLY

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

Module * getImportedOwningModule() const

Get the imported owning module, if this decl is from an imported (non-local) module.

bool canBeWeakImported(bool &IsDefinition) const

Determines whether this symbol can be weak-imported, e.g., whether it would be well-formed to add the...

static DeclContext * castToDeclContext(const Decl *)

const DeclContext * getDeclContext() const

ObjCDeclQualifier

ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...

@ OBJC_TQ_CSNullability

The nullability qualifier is set when the nullability of the result or parameter was expressed via a ...

const TemplateParameterList * getDescribedTemplateParams() const

If this is a declaration that describes some template or partial specialization, this returns the cor...

void setObjectOfFriendDecl(bool PerformFriendInjection=false)

Changes the namespace of this declaration to reflect that it's the object of a friend declaration.

bool isFromASTFile() const

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

attr_iterator attr_begin() const

bool isInLocalScopeForInstantiation() const

Determine whether a substitution into this declaration would occur as part of a substitution into a d...

const Attr * getDefiningAttr() const

Return this declaration's defining attribute if it has one.

Linkage getCachedLinkage() const

bool isTemplateParameter() const

isTemplateParameter - Determines whether this declaration is a template parameter.

DeclContext * getNonTransparentDeclContext()

Return the non transparent context.

virtual bool hasBody() const

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

Decl * getNonClosureContext()

Find the innermost non-closure ancestor of this declaration, walking up through blocks,...

bool isInvalidDecl() const

unsigned getIdentifierNamespace() const

unsigned FromASTFile

Whether this declaration was loaded from an AST file.

const Decl * getMostRecentDecl() const

Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...

virtual Decl * getNextRedeclarationImpl()

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

Decl & operator=(Decl &&)=delete

bool hasDefiningAttr() const

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

bool isLocalExternDecl() const

Determine whether this is a block-scope declaration with linkage.

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

friend class CXXClassMemberWrapper

void setAccess(AccessSpecifier AS)

SourceLocation getLocation() const

redecl_iterator redecls_end() const

const char * getDeclKindName() const

IdentifierNamespace

IdentifierNamespace - The different namespaces in which declarations may appear.

@ IDNS_NonMemberOperator

This declaration is a C++ operator declared in a non-class context.

@ IDNS_TagFriend

This declaration is a friend class.

@ IDNS_Ordinary

Ordinary names.

@ IDNS_Type

Types, declared with 'struct foo', typedefs, etc.

@ IDNS_OMPReduction

This declaration is an OpenMP user defined reduction construction.

@ IDNS_Label

Labels, declared with 'x:' and referenced with 'goto x'.

@ IDNS_Member

Members, declared with object declarations within tag definitions.

@ IDNS_OMPMapper

This declaration is an OpenMP user defined mapper.

@ IDNS_ObjCProtocol

Objective C @protocol.

@ IDNS_Namespace

Namespaces, declared with 'namespace foo {}'.

@ IDNS_OrdinaryFriend

This declaration is a friend function.

@ IDNS_Using

This declaration is a using declaration.

@ IDNS_LocalExtern

This declaration is a function-local extern declaration of a variable or function.

@ IDNS_Tag

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

bool isDeprecated(std::string *Message=nullptr) const

Determine whether this declaration is marked 'deprecated'.

AccessSpecifier getAccessUnsafe() const

Retrieve the access specifier for this declaration, even though it may not yet have been properly set...

bool isTemplateParameterPack() const

isTemplateParameter - Determines whether this declaration is a template parameter pack.

void setLocalOwningModule(Module *M)

const DeclContext * getNonTransparentDeclContext() const

void setImplicit(bool I=true)

void setReferenced(bool R=true)

const DeclContext * getLexicalDeclContext() const

static void printGroup(Decl **Begin, unsigned NumDecls, raw_ostream &Out, const PrintingPolicy &Policy, unsigned Indentation=0)

bool isThisDeclarationReferenced() const

Whether this declaration was referenced.

redecl_range redecls() const

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

void setIsUsed()

Set whether the declaration is used, in the sense of odr-use.

unsigned Access

Access - Used by C++ decls for the access specifier.

bool isTopLevelDeclInObjCContainer() const

Whether this declaration is a top-level declaration (function, global variable, etc....

void setLocation(SourceLocation L)

bool isUsed(bool CheckUsedAttr=true) const

Whether any (re-)declaration of the entity was used, meaning that a definition is required.

bool isDefinedOutsideFunctionOrMethod() const

isDefinedOutsideFunctionOrMethod - This predicate returns true if this scoped decl is defined outside...

DeclContext * getDeclContext()

AccessSpecifier getAccess() const

const Decl * getNextDeclInContext() const

bool isInAnonymousNamespace() const

SourceLocation getBeginLoc() const LLVM_READONLY

redecl_iterator redecls_begin() const

static void EnableStatistics()

TranslationUnitDecl * getTranslationUnitDecl()

VersionTuple getVersionIntroduced() const

Retrieve the version of the target platform in which this declaration was introduced.

specific_attr_iterator< T > specific_attr_end() const

virtual Decl * getMostRecentDeclImpl()

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

bool hasOwningModule() const

Is this declaration owned by some module?

Decl(const Decl &)=delete

void setCachedLinkage(Linkage L) const

void setModulePrivate()

Specify that this declaration was marked as being private to the module in which it was defined.

bool isFromHeaderUnit() const

Whether this declaration comes from a header unit.

llvm::iterator_range< attr_iterator > attr_range

specific_attr_iterator< T > specific_attr_begin() const

void updateOutOfDate(IdentifierInfo &II) const

Update a potentially out-of-date declaration.

void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const

static bool isFlexibleArrayMemberLike(ASTContext &Context, const Decl *D, QualType Ty, LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel, bool IgnoreTemplateOrMacroSubstitution)

Whether it resembles a flexible array member.

void setDeclContext(DeclContext *DC)

setDeclContext - Set both the semantic and lexical DeclContext to DC.

Module * getOwningModuleForLinkage() const

Get the module that owns this declaration for linkage purposes.

bool hasTagIdentifierNamespace() const

DeclContext * getLexicalDeclContext()

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

void setNonMemberOperator()

Specifies that this declaration is a C++ overloaded non-member.

void setLexicalDeclContext(DeclContext *DC)

virtual Decl * getCanonicalDecl()

Retrieves the "canonical" declaration of the given declaration.

ModuleOwnershipKind

The kind of ownership a declaration has, for visibility purposes.

@ VisibleWhenImported

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

@ Unowned

This declaration is not owned by a module.

@ ReachableWhenImported

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

@ ModulePrivate

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

@ Visible

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

void setModuleOwnershipKind(ModuleOwnershipKind MOK)

Set whether this declaration is hidden from name lookup.

Module * getLocalOwningModule() const

Get the local owning module, if known.

const LangOptions & getLangOpts() const LLVM_READONLY

Helper to get the language options from the ASTContext.

virtual SourceRange getSourceRange() const LLVM_READONLY

Source range that this declaration covers.

GlobalDeclID getGlobalID() const

Retrieve the global declaration ID associated with this declaration, which specifies where this Decl ...

unsigned getOwningModuleID() const

Retrieve the global ID of the module that owns this particular declaration.

static bool classofKind(Kind K)

bool shouldEmitInExternalSource() const

Whether the definition of the declaration should be emitted in external sources.

Decl & operator=(const Decl &)=delete

void setVisibleDespiteOwningModule()

Set that this declaration is globally visible, even if it came from a module that is not visible.

const Decl * getNonClosureContext() const

The name of a declaration.

A dependently-generated diagnostic.

Abstract interface for external sources of AST nodes.

Represents a function declaration or definition.

FunctionType - C99 6.7.5.3 - Function Declarators.

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

StrictFlexArraysLevelKind

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

Represents a linkage specification.

Describes a module or submodule.

This represents a decl that may have a name.

Represent a C++ namespace.

This represents '#pragma omp declare reduction ...' directive.

ObjCContainerDecl - Represents a container for method declarations.

ObjCMethodDecl - Represents an instance or class method declaration.

PrettyStackTraceDecl - If a crash occurs, indicate that it happened when doing something to a specifi...

void print(raw_ostream &OS) const override

PrettyStackTraceDecl(const Decl *theDecl, SourceLocation L, SourceManager &sm, const char *Msg)

A (possibly-)qualified type.

Represents a struct/union/class.

Provides common interface for the Decls that can be redeclared.

Encodes a location in the source.

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

A trivial tuple used to represent a source range.

SourceLocation getEnd() const

SourceLocation getBegin() const

Stmt - This represents one statement.

An array of decls optimized for the common case of only containing one entry.

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

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

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

The top declaration context.

Represents C++ using-directive.

specific_attr_iterator - Iterates over a subrange of an AttrVec, only providing attributes that are o...

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

ASTDumpOutputFormat

Used to specify the format for printing AST dump information.

bool isa(CodeGen::Address addr)

SelectorLocationsKind

Whether all locations of the selector identifiers are in a "standard" position.

ConstexprSpecKind

Define the kind of constexpr specifier.

LinkageSpecLanguageIDs

Represents the language in a linkage specification.

OMPDeclareReductionInitKind

StorageClass

Storage classes.

@ ObjCMethodFamilyBitWidth

ObjCMethodFamily

A family of Objective-C methods.

Linkage

Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.

@ Internal

Internal linkage, which indicates that the entity can be referred to from within the translation unit...

@ Module

Module linkage, which indicates that the entity can be referred to from other translation units withi...

Language

The language for the input, used to select and validate the language standard and possible actions.

TagTypeKind

The kind of a tag type.

AvailabilityResult

Captures the result of checking the availability of a declaration.

ObjCImplementationControl

RecordArgPassingKind

Enum that represents the different ways arguments are passed to and returned from function calls.

const FunctionProtoType * T

DeductionCandidate

Only used by CXXDeductionGuideDecl.

bool declaresSameEntity(const Decl *D1, const Decl *D2)

Determine whether two declarations declare the same entity.

AccessSpecifier

A C++ access specifier (public, private, protected), plus the special value "none" which means differ...

Diagnostic wrappers for TextAPI types for error reporting.

UsingDirectiveDecl * operator*() const

udir_iterator(lookup_iterator I)

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

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

static ToTy * doit(DeclContext *Val)

static const ToTy * doit(const DeclContext *Val)

static const ToTy * doit(const DeclContext *Val)

static ToTy * doit(DeclContext *Val)

static void * getAsVoidPointer(::clang::NamedDecl *P)

static inline ::clang::NamedDecl * getFromVoidPointer(void *P)

static ToTy & doit(::clang::DeclContext &Val)

static ToTy * doit(::clang::DeclContext *Val)

static const ToTy & doit(const ::clang::DeclContext &Val)

static const ToTy * doit(const ::clang::DeclContext *Val)

::clang::DeclContext & doit(const FromTy &Val)

::clang::DeclContext * doit(const FromTy *Val)

static const ::clang::DeclContext & doit(const FromTy &Val)

static const ::clang::DeclContext * doit(const FromTy *Val)

static bool doit(const ::clang::DeclContext &Val)