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

1

2

3

4

5

6

7

8

9

10

11

12

13

73#include "llvm/ADT/DenseMap.h"

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

75#include "llvm/ADT/SmallPtrSet.h"

76#include "llvm/Support/TimeProfiler.h"

77#include

78

79using namespace clang;

80using namespace sema;

81

84}

85

87

90 StringRef Platform) {

92 if (!SDKInfo && !WarnedDarwinSDKInfoMissing) {

93 Diag(Loc, diag::warn_missing_sdksettings_for_availability_checking)

94 << Platform;

95 WarnedDarwinSDKInfoMissing = true;

96 }

97 return SDKInfo;

98}

99

101 if (CachedDarwinSDKInfo)

102 return CachedDarwinSDKInfo->get();

106 if (SDKInfo && *SDKInfo) {

107 CachedDarwinSDKInfo = std::make_unique(std::move(**SDKInfo));

108 return CachedDarwinSDKInfo->get();

109 }

110 if (!SDKInfo)

111 llvm::consumeError(SDKInfo.takeError());

112 CachedDarwinSDKInfo = std::unique_ptr();

113 return nullptr;

114}

115

117 const IdentifierInfo *ParamName, unsigned int Index) {

118 std::string InventedName;

119 llvm::raw_string_ostream OS(InventedName);

120

121 if (!ParamName)

122 OS << "auto:" << Index + 1;

123 else

124 OS << ParamName->getName() << ":auto";

125

127}

128

132

133

135 if (!Policy.Bool) {

137 Policy.Bool = BoolMacro->isObjectLike() &&

138 BoolMacro->getNumTokens() == 1 &&

139 BoolMacro->getReplacementToken(0).is(tok::kw__Bool);

140 }

141 }

142

143

145

146 return Policy;

147}

148

152}

153

155namespace sema {

156

158 Sema *S = nullptr;

161

162public:

164

165 void reset() { S = nullptr; }

166

169 FileID PrevFID) override {

170 if (!S)

171 return;

172 switch (Reason) {

176 if (IncludeLoc.isValid()) {

177 if (llvm::timeTraceProfilerEnabled()) {

179 ProfilerStack.push_back(llvm::timeTraceAsyncProfilerBegin(

180 "Source", FE ? FE->getName() : StringRef("")));

181 }

182

183 IncludeStack.push_back(IncludeLoc);

186 IncludeLoc);

187 }

188 break;

189 }

191 if (!IncludeStack.empty()) {

192 if (llvm::timeTraceProfilerEnabled())

193 llvm::timeTraceProfilerEnd(ProfilerStack.pop_back_val());

194

197 IncludeStack.pop_back_val());

198 }

199 break;

200 default:

201 break;

202 }

203 }

204};

205

206}

207}

208

211

214 : SemaBase(*this), CollectStats(false), TUKind(TUKind),

215 CurFPFeatures(pp.getLangOpts()), LangOpts(pp.getLangOpts()), PP(pp),

216 Context(ctxt), Consumer(consumer), Diags(PP.getDiagnostics()),

217 SourceMgr(PP.getSourceManager()), APINotes(SourceMgr, LangOpts),

218 AnalysisWarnings(*this), ThreadSafetyDeclCache(nullptr),

219 LateTemplateParser(nullptr), LateTemplateParserCleanup(nullptr),

220 OpaqueParser(nullptr), CurContext(nullptr), ExternalSource(nullptr),

221 StackHandler(Diags), CurScope(nullptr), Ident_super(nullptr),

223 ARMPtr(std::make_unique<SemaARM>(*this)),

224 AVRPtr(std::make_unique<SemaAVR>(*this)),

225 BPFPtr(std::make_unique<SemaBPF>(*this)),

226 CodeCompletionPtr(

228 CUDAPtr(std::make_unique<SemaCUDA>(*this)),

229 HLSLPtr(std::make_unique<SemaHLSL>(*this)),

232 M68kPtr(std::make_unique<SemaM68k>(*this)),

233 MIPSPtr(std::make_unique<SemaMIPS>(*this)),

235 NVPTXPtr(std::make_unique<SemaNVPTX>(*this)),

236 ObjCPtr(std::make_unique<SemaObjC>(*this)),

240 PPCPtr(std::make_unique<SemaPPC>(*this)),

242 RISCVPtr(std::make_unique<SemaRISCV>(*this)),

243 SPIRVPtr(std::make_unique<SemaSPIRV>(*this)),

244 SYCLPtr(std::make_unique<SemaSYCL>(*this)),

245 SwiftPtr(std::make_unique<SemaSwift>(*this)),

247 WasmPtr(std::make_unique<SemaWasm>(*this)),

248 X86Ptr(std::make_unique<SemaX86>(*this)),

249 MSPointerToMemberRepresentationMethod(

250 LangOpts.getMSPointerToMemberRepresentationMethod()),

251 MSStructPragmaOn(false), VtorDispStack(LangOpts.getVtorDispMode()),

252 AlignPackStack(AlignPackInfo(getLangOpts().XLPragmaPack)),

253 DataSegStack(nullptr), BSSSegStack(nullptr), ConstSegStack(nullptr),

254 CodeSegStack(nullptr), StrictGuardStackCheckStack(false),

256 VisContext(nullptr), PragmaAttributeCurrentTargetDecl(nullptr),

257 StdCoroutineTraitsCache(nullptr), IdResolver(pp),

258 OriginalLexicalContext(nullptr), StdInitializerList(nullptr),

259 FullyCheckedComparisonCategories(

261 StdSourceLocationImplDecl(nullptr), CXXTypeInfoDecl(nullptr),

262 GlobalNewDeleteDeclared(false), DisableTypoCorrection(false),

263 TyposCorrected(0), IsBuildingRecoveryCallExpr(false), NumSFINAEErrors(0),

264 AccessCheckingSFINAE(false), CurrentInstantiationScope(nullptr),

265 InNonInstantiationSFINAEContext(false), NonInstantiationEntries(0),

266 ArgumentPackSubstitutionIndex(-1), SatisfactionCache(Context) {

269

270 LoadedExternalKnownNamespaces = false;

273

276

279

280

282

283

284

285

289

290

291 OpenMP().InitDataSharingAttributesStack();

292

293 std::unique_ptrsema::SemaPPCallbacks Callbacks =

294 std::make_uniquesema::SemaPPCallbacks();

295 SemaPPCallbackHandler = Callbacks.get();

297 SemaPPCallbackHandler->set(*this);

298

300}

301

302

304

309}

310

312

313

314

318

320 SC->InitializeSema(*this);

321

322

325 ExternalSema->InitializeSema(*this);

326

327

328

330

332 return;

333

334

338

339

343

347 }

348

349

350

352

353

357

358

359

363

364

368

369

373 }

374

375

379

380

387

389 }

390

391

392

399 if (OCLCompatibleVersion >= 200) {

403 }

411

412

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428 auto AddPointerSizeDependentTypes = [&]() {

432 auto AtomicPtrDiffT =

438 };

439

441 AddPointerSizeDependentTypes();

442 }

443

447 }

448

449 std::vector Atomic64BitTypes;

450 if (getOpenCLOptions().isSupported("cl_khr_int64_base_atomics",

452 getOpenCLOptions().isSupported("cl_khr_int64_extended_atomics",

457 Atomic64BitTypes.push_back(AtomicDoubleT);

458 }

463

464

466 AddPointerSizeDependentTypes();

467 }

468 }

469 }

470

471#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \

472 if (getOpenCLOptions().isSupported(#Ext, getLangOpts())) { \

473 addImplicitTypedef(#ExtType, Context.Id##Ty); \

474 }

475#include "clang/Basic/OpenCLExtensionTypes.def"

476 }

477

481#define SVE_TYPE(Name, Id, SingletonId) \

482 addImplicitTypedef(Name, Context.SingletonId);

483#include "clang/Basic/AArch64SVEACLETypes.def"

484 }

485

487#define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \

488 addImplicitTypedef(#Name, Context.Id##Ty);

489#include "clang/Basic/PPCTypes.def"

490#define PPC_VECTOR_VSX_TYPE(Name, Id, Size) \

491 addImplicitTypedef(#Name, Context.Id##Ty);

492#include "clang/Basic/PPCTypes.def"

493 }

494

496#define RVV_TYPE(Name, Id, SingletonId) \

497 addImplicitTypedef(Name, Context.SingletonId);

498#include "clang/Basic/RISCVVTypes.def"

499 }

500

503#define WASM_TYPE(Name, Id, SingletonId) \

504 addImplicitTypedef(Name, Context.SingletonId);

505#include "clang/Basic/WebAssemblyReferenceTypes.def"

506 }

507

511#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \

512 addImplicitTypedef(Name, Context.SingletonId);

513#include "clang/Basic/AMDGPUTypes.def"

514 }

515

520 }

521

525}

526

529 "failed to clean up an InstantiatingTemplate?");

530

532

533

535 delete FSI;

536

537

539 SC->ForgetSema();

540

541

544 ExternalSema->ForgetSema();

545

546

547 std::vector<ConstraintSatisfaction *> Satisfactions;

548 Satisfactions.reserve(SatisfactionCache.size());

549 for (auto &Node : SatisfactionCache)

550 Satisfactions.push_back(&Node);

551 for (auto *Node : Satisfactions)

553

555

556

557 OpenMP().DestroyDataSharingAttributesStack();

558

559

560

561 SemaPPCallbackHandler->reset();

562}

563

565 llvm::function_ref<void()> Fn) {

567}

568

570 UnavailableAttr::ImplicitReason reason) {

571

573 if (!fn) return false;

574

575

577 return false;

578

579

581 return false;

582

583

584 if (fn->hasAttr()) return true;

585

586 fn->addAttr(UnavailableAttr::CreateImplicit(Context, "", reason, loc));

587 return true;

588}

589

592}

593

595 assert(E && "Cannot use with NULL ptr");

596

599 return;

600 }

601

602 if (auto *Ex = dyn_cast(ExternalSource))

603 Ex->AddSource(E);

604 else

606}

607

609 llvm::errs() << "\n*** Semantic Analysis Stats:\n";

610 llvm::errs() << NumSFINAEErrors << " SFINAE diagnostics trapped.\n";

611

614}

615

619 std::optional ExprNullability = SrcType->getNullability();

622 return;

623

624 std::optional TypeNullability = DstType->getNullability();

626 return;

627

628 Diag(Loc, diag::warn_nullability_lost) << SrcType << DstType;

629}

630

631

636 if (SrcFX != DstFX) {

638 if (Diff.shouldDiagnoseConversion(SrcType, SrcFX, DstType, DstFX))

639 Diag(Loc, diag::warn_invalid_add_func_effects) << Diff.effectName();

640 }

641 }

642}

643

645

647 return;

648

649 if (Kind != CK_NullToPointer && Kind != CK_NullToMemberPointer)

650 return;

651

654 return;

655 if (isa(EStripped))

656 return;

657

658 if (Diags.isIgnored(diag::warn_zero_as_null_pointer_constant,

660 return;

661

662

663

667 return;

668

669

672 return;

673 }

674

675

676

677

678

683 return;

684

685 Diag(E->getBeginLoc(), diag::warn_zero_as_null_pointer_constant)

687}

688

689

690

691

696#ifndef NDEBUG

698 switch (Kind) {

699 default:

700 llvm_unreachable(

701 ("can't implicitly cast glvalue to prvalue with this cast "

702 "kind: " +

704 .c_str());

705 case CK_Dependent:

706 case CK_LValueToRValue:

707 case CK_ArrayToPointerDecay:

708 case CK_FunctionToPointerDecay:

709 case CK_ToVoid:

710 case CK_NonAtomicToAtomic:

711 case CK_HLSLArrayRValue:

712 break;

713 }

714 }

716 "can't cast prvalue to glvalue");

717#endif

718

722 Kind != CK_NullToPointer && Kind != CK_NullToMemberPointer)

724

727

728

729

730

731

732

733 if (Kind == CK_HLSLArrayRValue && !isa(E))

736

737 if (ExprTy == TypeTy)

738 return E;

739

740 if (Kind == CK_ArrayToPointerDecay) {

741

742

744

749 E = Materialized.get();

750 }

751

752

753

754

755

756

757

758

760 if (const auto *DRE = dyn_cast(E)) {

761 if (const auto *VD = dyn_cast(DRE->getDecl())) {

762 if (VD->getStorageClass() == SC_Register) {

766 }

767 }

768 }

769 }

770 }

771

773 if (ImpCast->getCastKind() == Kind && (!BasePath || BasePath->empty())) {

774 ImpCast->setType(Ty);

775 ImpCast->setValueKind(VK);

776 return E;

777 }

778 }

779

782}

783

796 }

797 llvm_unreachable("unknown scalar type kind");

798}

799

800

803 return true;

804

805 if (D->isExternallyVisible())

806 return true;

807

808 if (const FunctionDecl *FD = dyn_cast(D)) {

809

810

812 for (const auto *Spec : Template->specializations())

814 return true;

815

816

817

819 if (FD->hasBody(DeclToCheck))

821

822

823

825 if (DeclToCheck != FD)

827 }

828

829 if (const VarDecl *VD = dyn_cast(D)) {

830

831

832

833

834

835 if (VD->isReferenced() &&

836 VD->mightBeUsableInConstantExpressions(SemaRef->Context))

837 return true;

838

839 if (VarTemplateDecl *Template = VD->getDescribedVarTemplate())

840

841

842 for (const auto *Spec : Template->specializations())

844 return true;

845

846

847

849 if (DeclToCheck)

851

852

853

855 if (DeclToCheck != VD)

857 }

858

859 return false;

860}

861

863 if (const auto *FD = dyn_cast(ND))

864 return FD->isExternC();

865 return cast(ND)->isExternC();

866}

867

868

869

871

872

873

877}

878

879

880

882 SmallVectorImpl<std::pair<NamedDecl *, SourceLocation> > &Undefined) {

884 NamedDecl *ND = UndefinedUse.first;

885

886

888

889

890 if (ND->hasAttr()) continue;

891

892 if (isa(ND))

893 continue;

894

895 if (ND->hasAttr() || ND->hasAttr()) {

896

897

898

899 continue;

900 }

901

902 if (const auto *FD = dyn_cast(ND)) {

903 if (FD->isDefined())

904 continue;

905 if (FD->isExternallyVisible() &&

907 !FD->getMostRecentDecl()->isInlined() &&

908 !FD->hasAttr())

909 continue;

910 if (FD->getBuiltinID())

911 continue;

912 } else {

913 const auto *VD = cast(ND);

915 continue;

916 if (VD->isExternallyVisible() &&

918 !VD->getMostRecentDecl()->isInline() &&

919 !VD->hasAttr())

920 continue;

921

922

923

924 if (VD->isKnownToBeDefined())

925 continue;

926 }

927

928 Undefined.push_back(std::make_pair(ND, UndefinedUse.second));

929 }

930}

931

932

933

936

937

941 if (Undefined.empty()) return;

942

943 for (const auto &Undef : Undefined) {

944 ValueDecl *VD = cast(Undef.first);

946

948

949

950

951

952

953

954

955

956

958 ? diag::ext_undefined_internal_type

959 : diag::err_undefined_internal_type)

960 << isa(VD) << VD;

962

963

964

965 bool IsImplicitBase = false;

966 if (const auto *BaseD = dyn_cast(VD)) {

967 auto *DVAttr = BaseD->getAttr();

968 if (DVAttr && !DVAttr->getTraitInfo().isExtensionActive(

969 llvm::omp::TraitProperty::

970 implementation_extension_disable_implicit_base)) {

971 const auto *Func = cast(

972 cast(DVAttr->getVariantFuncRef())->getDecl());

973 IsImplicitBase = BaseD->isImplicit() &&

974 Func->getIdentifier()->isMangledOpenMPVariantName();

975 }

976 }

977 if (!S.getLangOpts().OpenMP || !IsImplicitBase)

979 << isa(VD) << VD;

980 } else if (auto *FD = dyn_cast(VD)) {

981 (void)FD;

982 assert(FD->getMostRecentDecl()->isInlined() &&

983 "used object requires definition but isn't inline or internal?");

984

985 S.Diag(VD->getLocation(), diag::warn_undefined_inline) << VD;

986 } else {

987 assert(cast(VD)->getMostRecentDecl()->isInline() &&

988 "used var requires definition but isn't inline or internal?");

989 S.Diag(VD->getLocation(), diag::err_undefined_inline_var) << VD;

990 }

992 S.Diag(UseLoc, diag::note_used_here);

993 }

994}

995

998 return;

999

1001 ExternalSource->ReadWeakUndeclaredIdentifiers(WeakIDs);

1002 for (auto &WeakID : WeakIDs)

1004}

1005

1006

1008

1009

1010

1011

1012

1013

1016 RecordCompleteMap::iterator Cache = MNCComplete.find(RD);

1017 if (Cache != MNCComplete.end())

1018 return Cache->second;

1020 return false;

1025 if (const CXXMethodDecl *M = dyn_cast(*I))

1026 Complete = M->isDefined() || M->isDefaulted() ||

1027 (M->isPureVirtual() && !isa(M));

1028 else if (const FunctionTemplateDecl *F = dyn_cast(*I))

1029

1030

1031

1032

1033 Complete = !F->getTemplatedDecl()->isLateTemplateParsed() &&

1034 F->getTemplatedDecl()->isDefined();

1035 else if (const CXXRecordDecl *R = dyn_cast(*I)) {

1036 if (R->isInjectedClassName())

1037 continue;

1038 if (R->hasDefinition())

1040 MNCComplete);

1041 else

1043 }

1044 }

1047}

1048

1049

1050

1051

1052

1053

1054

1055

1059 RecordCompleteMap::iterator Cache = RecordsComplete.find(RD);

1060 if (Cache != RecordsComplete.end())

1061 return Cache->second;

1066

1068

1069 if (CXXRecordDecl *FriendD = TSI->getType()->getAsCXXRecordDecl())

1071 else

1073 } else {

1074

1076 dyn_cast((*I)->getFriendDecl()))

1078 else

1079

1081 }

1082 }

1083 RecordsComplete[RD] = Complete;

1085}

1086

1089 ExternalSource->ReadUnusedLocalTypedefNameCandidates(

1092 if (TD->isReferenced())

1093 continue;

1094 Diag(TD->getLocation(), diag::warn_unused_local_typedef)

1095 << isa(TD) << TD->getDeclName();

1096 }

1098}

1099

1103 HandleStartOfHeaderUnit();

1104}

1105

1107

1109 return;

1110

1111

1112

1113

1114

1115

1116

1117

1118

1119

1124

1125

1126

1127

1129

1130

1131

1132

1133

1134

1135

1136

1137

1138

1140

1143 for (auto PII : Pending)

1144 if (auto Func = dyn_cast(PII.first))

1145 Func->setInstantiationIsPending(true);

1147 Pending.begin(), Pending.end());

1148 }

1149

1150 {

1151 llvm::TimeTraceScope TimeScope("PerformPendingInstantiations");

1153 }

1154

1156

1158 "end of TU template instantiation should not create more "

1159 "late-parsed templates");

1160

1161

1162

1163

1164 for (const auto &Typo : DelayedTypos) {

1165

1167 }

1168 DelayedTypos.clear();

1169}

1170

1173 && "reached end of translation unit with a pool attached?");

1174

1175

1176

1178 return;

1179

1180

1181

1184

1186 !ModuleScopes.empty() && ModuleScopes.back().Module->Kind ==

1190

1193

1195 } else {

1196

1197

1198

1199

1200

1205

1206 if (LangOpts.PCHInstantiateTemplates) {

1207 llvm::TimeTraceScope TimeScope("PerformPendingInstantiations");

1209 }

1210 }

1211

1216

1217

1218

1221

1222

1225

1226

1231 return ShouldRemoveFromUnused(this, DD);

1232 }),

1234

1236

1239 return;

1240 }

1241

1242

1245 if (WeakIDs.second.empty())

1246 continue;

1247

1250 if (PrevDecl != nullptr &&

1251 !(isa(PrevDecl) || isa(PrevDecl)))

1252 for (const auto &WI : WeakIDs.second)

1253 Diag(WI.getLocation(), diag::warn_attribute_wrong_decl_type)

1255 else

1256 for (const auto &WI : WeakIDs.second)

1257 Diag(WI.getLocation(), diag::warn_weak_identifier_undeclared)

1258 << WeakIDs.first;

1259 }

1260

1264

1269 }

1270

1271

1272 if (!ModuleScopes.empty() && ModuleScopes.back().Module->Kind ==

1274 Diag(ModuleScopes.back().BeginLoc,

1275 diag::err_module_declaration_missing_after_global_module_introducer);

1276 } else if (getLangOpts().getCompilingModule() ==

1278

1279

1281

1282

1283

1284

1287 diag::err_module_declaration_missing);

1288 }

1289

1290

1293 auto DoesModNeedInit = [this](Module *M) {

1295 return true;

1296 for (auto [Exported, _] : M->Exports)

1297 if (Exported->isNamedModuleInterfaceHasInit())

1298 return true;

1301 return true;

1302

1303 return false;

1304 };

1305

1306 CurrentModule->NamedModuleHasInit =

1307 DoesModNeedInit(CurrentModule) ||

1308 llvm::any_of(CurrentModule->submodules(),

1309 [&](auto *SubM) { return DoesModNeedInit(SubM); });

1310 }

1311

1313

1314

1317

1319 Stack.push_back(CurrentModule);

1320 while (!Stack.empty()) {

1321 Module *Mod = Stack.pop_back_val();

1322

1323

1324

1325

1326

1328 ModMap.resolveUses(Mod, false);

1330

1331

1332 auto SubmodulesRange = Mod->submodules();

1333 Stack.append(SubmodulesRange.begin(), SubmodulesRange.end());

1334 }

1335 }

1336

1337

1338

1340 }

1341

1342

1343

1344

1345 if (!PendingInlineFuncDecls.empty()) {

1346 for (auto *D : PendingInlineFuncDecls) {

1347 if (auto *FD = dyn_cast(D)) {

1348 bool DefInPMF = false;

1349 if (auto *FDD = FD->getDefinition()) {

1350 DefInPMF = FDD->getOwningModule()->isPrivateModule();

1351 if (!DefInPMF)

1352 continue;

1353 }

1354 Diag(FD->getLocation(), diag::err_export_inline_not_defined)

1355 << DefInPMF;

1356

1357 if (DefInPMF &&

1359 Diag(ModuleScopes.back().BeginLoc,

1360 diag::note_private_module_fragment);

1361 }

1362 }

1363 }

1364 PendingInlineFuncDecls.clear();

1365 }

1366

1367

1368

1369

1370

1371

1372

1373

1374

1375

1376

1377

1378 llvm::SmallSet<VarDecl *, 32> Seen;

1379 for (TentativeDefinitionsType::iterator

1382 T != TEnd; ++T) {

1384

1385

1386

1387

1388 if (!VD || VD->isInvalidDecl() || !Seen.insert(VD).second)

1389 continue;

1390

1393

1394 Diag(VD->getLocation(), diag::warn_tentative_incomplete_array);

1400 diag::err_tentative_def_incomplete_type))

1402

1403

1405

1406

1409 }

1410

1413 continue;

1414

1416 }

1417

1421

1422

1423

1424

1425

1427

1428 for (UnusedFileScopedDeclsType::iterator

1431 I != E; ++I) {

1433 continue;

1434

1435 if (const FunctionDecl *FD = dyn_cast(*I)) {

1437 if (!FD->hasBody(DiagD))

1438 DiagD = FD;

1440 continue;

1444 DiagRange.setEnd(ASTTAL->RAngleLoc);

1446 if (isa(DiagD))

1447 Diag(DiagD->getLocation(), diag::warn_unneeded_member_function)

1448 << DiagD << DiagRange;

1449 else {

1450 if (FD->getStorageClass() == SC_Static &&

1451 !FD->isInlineSpecified() &&

1455 diag::warn_unneeded_static_internal_decl)

1456 << DiagD << DiagRange;

1457 else

1458 Diag(DiagD->getLocation(), diag::warn_unneeded_internal_decl)

1459 << 0 << DiagD << DiagRange;

1460 }

1461 } else if (!FD->isTargetMultiVersion() ||

1462 FD->isTargetMultiVersionDefault()) {

1463 if (FD->getDescribedFunctionTemplate())

1465 << 0 << DiagD << DiagRange;

1466 else

1468 ? diag::warn_unused_member_function

1469 : diag::warn_unused_function)

1470 << DiagD << DiagRange;

1471 }

1472 } else {

1474 if (!DiagD)

1475 DiagD = cast(*I);

1477 if (const auto *VTSD = dyn_cast(DiagD)) {

1479 VTSD->getTemplateArgsAsWritten())

1480 DiagRange.setEnd(ASTTAL->RAngleLoc);

1481 }

1483 Diag(DiagD->getLocation(), diag::warn_unneeded_internal_decl)

1484 << 1 << DiagD << DiagRange;

1487 << 1 << DiagD << DiagRange;

1490 if (SM.getMainFileID() != SM.getFileID(DiagD->getLocation()) ||

1492 Diag(DiagD->getLocation(), diag::warn_unused_const_variable)

1493 << DiagD << DiagRange;

1494 } else {

1496 << DiagD << DiagRange;

1497 }

1498 }

1499 }

1500

1502 }

1503

1505

1506

1511 if (RD && !RD->isUnion() &&

1514 << D->getDeclName();

1515 }

1516 }

1517 }

1518

1522 for (const auto &DeletedFieldInfo : DeleteExprs) {

1523 for (const auto &DeleteExprLoc : DeletedFieldInfo.second) {

1524 AnalyzeDeleteExprMismatch(DeletedFieldInfo.first, DeleteExprLoc.first,

1526 }

1527 }

1528 }

1529

1531

1534

1535

1536

1537

1539 "Didn't unmark var as having its initializer parsed");

1540

1543}

1544

1545

1546

1547

1548

1549

1552

1553 while (true) {

1554 if (isa(DC) || isa(DC) || isa(DC) ||

1555 isa(DC)) {

1557 } else if (!AllowLambda && isa(DC) &&

1558 cast(DC)->getOverloadedOperator() == OO_Call &&

1559 cast(DC->getParent())->isLambda()) {

1561 } else break;

1562 }

1563

1564 return DC;

1565}

1566

1567

1568

1569

1572 return dyn_cast(DC);

1573}

1574

1577 while (isa(DC))

1579 return dyn_cast(DC);

1580}

1581

1584 if (isa(DC) || isa(DC))

1585 return cast(DC);

1586 return nullptr;

1587}

1588

1593}

1594

1596

1597

1598

1599

1600

1601

1602

1604 if (std::optional<TemplateDeductionInfo *> Info = isSFINAEContext()) {

1607

1608 break;

1609

1611

1612

1614

1615

1616

1617 if (*Info && !(*Info)->hasSFINAEDiagnostic()) {

1618 (*Info)->addSFINAEDiagnostic(DiagInfo.getLocation(),

1620 }

1621

1623 return;

1624

1626

1627

1628

1629

1631 break;

1632

1634

1635

1637

1638

1639

1640 if (*Info && !(*Info)->hasSFINAEDiagnostic()) {

1641 (*Info)->addSFINAEDiagnostic(DiagInfo.getLocation(),

1643 }

1644

1646

1647

1648 Diag(Loc, diag::warn_cxx98_compat_sfinae_access_control);

1649

1650

1651

1653 return;

1654 }

1655

1657

1658

1659 if (*Info) {

1660 (*Info)->addSuppressedDiagnostic(DiagInfo.getLocation(),

1662 }

1663

1664

1666 return;

1667 }

1668 }

1669

1670

1671

1673

1674

1676 return;

1677

1678

1679

1680

1681

1684}

1685

1688 return true;

1689 auto *FD = dyn_cast(CurContext);

1690 if (!FD)

1691 return false;

1694 return false;

1695 for (auto PDAt : Loc->second) {

1697 return true;

1698 }

1699 return false;

1700}

1701

1702

1703

1707

1709 return;

1711 S.Diags.Report(FnIt->second.Loc, diag::note_called_by));

1712 Builder << FnIt->second.FD;

1714 }

1715}

1716

1717namespace {

1718

1719

1720

1721

1722

1723

1724

1725

1726

1727

1728

1729

1730

1731

1732

1733

1734

1735

1736

1737

1738

1739

1740

1741

1742

1743

1744

1745

1746class DeferredDiagnosticsEmitter

1748public:

1750

1751

1753

1754

1756

1757

1758

1759

1760

1762

1763

1764 bool ShouldEmitRootNode;

1765

1766

1767

1768

1769 unsigned InOMPDeviceContext;

1770

1771 DeferredDiagnosticsEmitter(Sema &S)

1772 : Inherited(S), ShouldEmitRootNode(false), InOMPDeviceContext(0) {}

1773

1774 bool shouldVisitDiscardedStmt() const { return false; }

1775

1777 ++InOMPDeviceContext;

1778 Inherited::VisitOMPTargetDirective(Node);

1779 --InOMPDeviceContext;

1780 }

1781

1783 if (isa(D))

1784 return;

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

1786 checkFunc(Loc, FD);

1787 else

1788 Inherited::visitUsedDecl(Loc, D);

1789 }

1790

1791 void checkVar(VarDecl *VD) {

1793 "Should only check file-scope variables");

1795 auto DevTy = OMPDeclareTargetDeclAttr::getDeviceType(VD);

1796 bool IsDev = DevTy && (*DevTy == OMPDeclareTargetDeclAttr::DT_NoHost ||

1797 *DevTy == OMPDeclareTargetDeclAttr::DT_Any);

1798 if (IsDev)

1799 ++InOMPDeviceContext;

1800 this->Visit(Init);

1801 if (IsDev)

1802 --InOMPDeviceContext;

1803 }

1804 }

1805

1807 auto &Done = DoneMap[InOMPDeviceContext > 0 ? 1 : 0];

1808 FunctionDecl *Caller = UsePath.empty() ? nullptr : UsePath.back();

1809 if ((!ShouldEmitRootNode && !S.getLangOpts().OpenMP && !Caller) ||

1811 return;

1812

1813 if (Caller && S.LangOpts.OpenMP && UsePath.size() == 1 &&

1814 (ShouldEmitRootNode || InOMPDeviceContext))

1816 if (Caller)

1818

1819

1820

1821 if (ShouldEmitRootNode || InOMPDeviceContext)

1822 emitDeferredDiags(FD, Caller);

1823

1824

1825 if (!Done.insert(FD).second)

1826 return;

1827 InUsePath.insert(FD);

1828 UsePath.push_back(FD);

1829 if (auto *S = FD->getBody()) {

1830 this->Visit(S);

1831 }

1832 UsePath.pop_back();

1833 InUsePath.erase(FD);

1834 }

1835

1836 void checkRecordedDecl(Decl *D) {

1837 if (auto *FD = dyn_cast(D)) {

1839 Sema::FunctionEmissionStatus::Emitted;

1841 } else

1842 checkVar(cast(D));

1843 }

1844

1845

1846 void emitDeferredDiags(FunctionDecl *FD, bool ShowCallStack) {

1849 return;

1850 bool HasWarningOrError = false;

1851 bool FirstDiag = true;

1853

1855 return;

1858 HasWarningOrError |=

1861 {

1863 PD.Emit(Builder);

1864 }

1865

1866

1867 if (FirstDiag && HasWarningOrError && ShowCallStack) {

1869 FirstDiag = false;

1870 }

1871 }

1872 }

1873};

1874}

1875

1879 DeclsToCheckForDeferredDiags);

1880

1882 DeclsToCheckForDeferredDiags.empty())

1883 return;

1884

1885 DeferredDiagnosticsEmitter DDE(*this);

1886 for (auto *D : DeclsToCheckForDeferredDiags)

1887 DDE.checkRecordedDecl(D);

1888}

1889

1890

1891

1892

1893

1894

1895

1896

1897

1898

1899

1900

1901

1902

1903

1904

1905

1906

1907

1908

1909

1910

1911

1912

1913

1914Sema::SemaDiagnosticBuilder::SemaDiagnosticBuilder(Kind K, SourceLocation Loc,

1915 unsigned DiagID,

1918 : S(S), Loc(Loc), DiagID(DiagID), Fn(Fn),

1919 ShowCallStack(K == K_ImmediateWithCallStack || K == K_Deferred) {

1920 switch (K) {

1921 case K_Nop:

1922 break;

1923 case K_Immediate:

1924 case K_ImmediateWithCallStack:

1925 ImmediateDiag.emplace(

1926 ImmediateDiagBuilder(S.Diags.Report(Loc, DiagID), S, DiagID));

1927 break;

1928 case K_Deferred:

1929 assert(Fn && "Must have a function to attach the deferred diag to.");

1931 PartialDiagId.emplace(Diags.size());

1933 break;

1934 }

1935}

1936

1937Sema::SemaDiagnosticBuilder::SemaDiagnosticBuilder(SemaDiagnosticBuilder &&D)

1939 ShowCallStack(D.ShowCallStack), ImmediateDiag(D.ImmediateDiag),

1940 PartialDiagId(D.PartialDiagId) {

1941

1942 D.ShowCallStack = false;

1943 D.ImmediateDiag.reset();

1944 D.PartialDiagId.reset();

1945}

1946

1947Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() {

1948 if (ImmediateDiag) {

1949

1950

1953 ImmediateDiag.reset();

1954 if (IsWarningOrError && ShowCallStack)

1956 } else {

1957 assert((!PartialDiagId || ShowCallStack) &&

1958 "Must always show call stack for deferred diags.");

1959 }

1960}

1961

1964 FD = FD ? FD : getCurFunctionDecl();

1965 if (LangOpts.OpenMP)

1966 return LangOpts.OpenMPIsTargetDevice

1967 ? OpenMP().diagIfOpenMPDeviceCode(Loc, DiagID, FD)

1968 : OpenMP().diagIfOpenMPHostCode(Loc, DiagID, FD);

1970 return getLangOpts().CUDAIsDevice ? CUDA().DiagIfDeviceCode(Loc, DiagID)

1971 : CUDA().DiagIfHostCode(Loc, DiagID);

1972

1974 return SYCL().DiagIfDeviceCode(Loc, DiagID);

1975

1977 FD, *this);

1978}

1979

1981 if (isUnevaluatedContext() || Ty.isNull())

1982 return;

1983

1984

1985

1986

1987

1988 if (D && LangOpts.SYCLIsDevice) {

1989 llvm::DenseSet Visited;

1990 SYCL().deepTypeCheckForDevice(Loc, Visited, D);

1991 }

1992

1993 Decl *C = cast(getCurLexicalContext());

1994

1995

1996

1997 if (const auto *MD = dyn_cast(C)) {

1998 if ((MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator()) &&

1999 MD->isTrivial())

2000 return;

2001

2002 if (const auto *Ctor = dyn_cast(MD))

2003 if (Ctor->isCopyOrMoveConstructor() && Ctor->isTrivial())

2004 return;

2005 }

2006

2007

2008

2010 ? cast(C)

2011 : dyn_cast_or_null(D);

2012

2013 auto CheckDeviceType = [&](QualType Ty) {

2015 return;

2016

2020 if (D)

2021 PD << D;

2022 else

2023 PD << "expression";

2024 targetDiag(Loc, PD, FD)

2025 << false << 0 << false

2027 }

2028 return;

2029 }

2030

2031

2032

2033 bool LongDoubleMismatched = false;

2036 if ((&Sem != &llvm::APFloat::PPCDoubleDouble() &&

2038 (&Sem == &llvm::APFloat::PPCDoubleDouble() &&

2040 LongDoubleMismatched = true;

2041 }

2042

2049 !LangOpts.CUDAIsDevice) ||

2050 LongDoubleMismatched) {

2052 if (D)

2053 PD << D;

2054 else

2055 PD << "expression";

2056

2057 if (targetDiag(Loc, PD, FD)

2058 << true

2059 << static_cast<unsigned>(Context.getTypeSize(Ty)) << Ty

2061 if (D)

2063 }

2064 if (D)

2065 targetDiag(D->getLocation(), diag::note_defined_here, FD) << D;

2066 }

2067 };

2068

2069 auto CheckType = [&](QualType Ty, bool IsRetTy = false) {

2070 if (LangOpts.SYCLIsDevice ||

2071 (LangOpts.OpenMP && LangOpts.OpenMPIsTargetDevice) ||

2072 LangOpts.CUDAIsDevice)

2073 CheckDeviceType(Ty);

2074

2079 if (D)

2080 PD << D;

2081 else

2082 PD << "expression";

2083

2085 << false << 0 << Ty << false

2087 if (D)

2089 }

2090 if (D)

2091 targetDiag(D->getLocation(), diag::note_defined_here, FD) << D;

2092 }

2093

2094 bool IsDouble = UnqualTy == Context.DoubleTy;

2095 bool IsFloat = UnqualTy == Context.FloatTy;

2096 if (IsRetTy && !TI.hasFPReturn() && (IsDouble || IsFloat)) {

2098 if (D)

2099 PD << D;

2100 else

2101 PD << "expression";

2102

2104 << false << 0 << Ty << true

2106 if (D)

2108 }

2109 if (D)

2110 targetDiag(D->getLocation(), diag::note_defined_here, FD) << D;

2111 }

2112

2114 llvm::StringMap CallerFeatureMap;

2116 RISCV().checkRVVTypeSupport(Ty, Loc, D, CallerFeatureMap);

2117 }

2118

2119

2121 llvm::StringMap CallerFeatureMap;

2125 Diag(Loc, diag::err_sve_vector_in_non_sve_target) << Ty;

2127 true)) {

2128 Diag(Loc, diag::err_sve_vector_in_non_streaming_function) << Ty;

2129 }

2130 }

2131 }

2132 };

2133

2134 CheckType(Ty);

2135 if (const auto *FPTy = dyn_cast(Ty)) {

2136 for (const auto &ParamTy : FPTy->param_types())

2137 CheckType(ParamTy);

2138 CheckType(FPTy->getReturnType(), true);

2139 }

2140 if (const auto *FNPTy = dyn_cast(Ty))

2141 CheckType(FNPTy->getReturnType(), true);

2142}

2143

2146 if (!loc.isMacroID()) return false;

2147

2148

2149

2150 loc = getSourceManager().getExpansionLoc(loc);

2151

2152

2154 if (getPreprocessor().getSpelling(loc, buffer) == name) {

2155 locref = loc;

2156 return true;

2157 }

2158 return false;

2159}

2160

2162

2163 if (!Ctx)

2164 return nullptr;

2165

2167 for (Scope *S = getCurScope(); S; S = S->getParent()) {

2168

2169

2171 if (DeclContext *Entity = S->getEntity())

2173 return S;

2174 }

2175

2176 return nullptr;

2177}

2178

2179

2181 if (FunctionScopes.empty() && CachedFunctionScope) {

2182

2183 CachedFunctionScope->Clear();

2184 FunctionScopes.push_back(CachedFunctionScope.release());

2185 } else {

2187 }

2188 if (LangOpts.OpenMP)

2189 OpenMP().pushOpenMPFunctionRegion();

2190}

2191

2194 BlockScope, Block));

2195 CapturingFunctionScopes++;

2196}

2197

2200 FunctionScopes.push_back(LSI);

2201 CapturingFunctionScopes++;

2202 return LSI;

2203}

2204

2207 LSI->AutoTemplateParameterDepth = Depth;

2208 return;

2209 }

2210 llvm_unreachable(

2211 "Remove assertion if intentionally called in a non-lambda context.");

2212}

2213

2214

2215

2216

2217

2218

2224 Expr *VarRef =

2232 } else {

2235 VarRef);

2236 }

2237

2238 if (Result.isInvalid()) {

2242 }

2243

2244

2245

2250 }

2251}

2252

2254

2255

2258 VarDecl *VD = BC.getVariable();

2259 if (VD->hasAttr()) {

2260

2261

2263 continue;

2265 }

2266

2267

2268 QualType CapType = BC.getVariable()->getType();

2275 }

2276 }

2277

2279

2281 continue;

2282

2283

2284

2285

2288 }

2289}

2290

2294 assert(!FunctionScopes.empty() && "mismatched push/pop!");

2295

2297

2300

2301 if (LangOpts.OpenMP)

2302 OpenMP().popOpenMPFunctionRegion(Scope.get());

2303

2304

2305 if (WP && D)

2306 AnalysisWarnings.IssueWarnings(*WP, Scope.get(), D, BlockType);

2307 else

2308 for (const auto &PUD : Scope->PossiblyUnreachableDiags)

2309 Diag(PUD.Loc, PUD.PD);

2310

2312}

2313

2316 if (Scope->isPlainFunction())

2317 Self->CapturingFunctionScopes--;

2318

2319 if (Scope->isPlainFunction() && Self->CachedFunctionScope)

2320 Self->CachedFunctionScope.reset(Scope);

2321 else

2323}

2324

2326 getCurFunction()->CompoundScopes.push_back(

2328}

2329

2332 assert(!CurFunction->CompoundScopes.empty() && "mismatched push/pop");

2333

2335}

2336

2338 return getCurFunction()->hasUnrecoverableErrorOccurred();

2339}

2340

2342 if (!FunctionScopes.empty())

2343 FunctionScopes.back()->setHasBranchIntoScope();

2344}

2345

2347 if (!FunctionScopes.empty())

2348 FunctionScopes.back()->setHasBranchProtectedScope();

2349}

2350

2352 if (!FunctionScopes.empty())

2353 FunctionScopes.back()->setHasIndirectGoto();

2354}

2355

2357 if (!FunctionScopes.empty())

2358 FunctionScopes.back()->setHasMustTail();

2359}

2360

2362 if (FunctionScopes.empty())

2363 return nullptr;

2364

2365 auto CurBSI = dyn_cast(FunctionScopes.back());

2366 if (CurBSI && CurBSI->TheDecl &&

2367 !CurBSI->TheDecl->Encloses(CurContext)) {

2368

2369 assert(!CodeSynthesisContexts.empty());

2370 return nullptr;

2371 }

2372

2373 return CurBSI;

2374}

2375

2377 if (FunctionScopes.empty())

2378 return nullptr;

2379

2380 for (int e = FunctionScopes.size() - 1; e >= 0; --e) {

2381 if (isasema::BlockScopeInfo(FunctionScopes[e]))

2382 continue;

2383 return FunctionScopes[e];

2384 }

2385 return nullptr;

2386}

2387

2389 for (auto *Scope : llvm::reverse(FunctionScopes)) {

2390 if (auto *CSI = dyn_cast(Scope)) {

2391 auto *LSI = dyn_cast(CSI);

2392 if (LSI && LSI->Lambda && !LSI->Lambda->Encloses(CurContext) &&

2393 LSI->AfterParameterList) {

2394

2395

2396

2397 assert(!CodeSynthesisContexts.empty());

2398 return nullptr;

2399 }

2400 return CSI;

2401 }

2402 }

2403 return nullptr;

2404}

2405

2407 if (FunctionScopes.empty())

2408 return nullptr;

2409

2410 auto I = FunctionScopes.rbegin();

2411 if (IgnoreNonLambdaCapturingScope) {

2412 auto E = FunctionScopes.rend();

2413 while (I != E && isa(*I) && !isa(*I))

2414 ++I;

2415 if (I == E)

2416 return nullptr;

2417 }

2418 auto *CurLSI = dyn_cast(*I);

2419 if (CurLSI && CurLSI->Lambda && CurLSI->CallOperator &&

2420 !CurLSI->Lambda->Encloses(CurContext) && CurLSI->AfterParameterList) {

2421

2422 assert(!CodeSynthesisContexts.empty());

2423 return nullptr;

2424 }

2425

2426 return CurLSI;

2427}

2428

2429

2430

2433 return (LSI->TemplateParams.size() ||

2434 LSI->GLTemplateParameterList) ? LSI : nullptr;

2435 }

2436 return nullptr;

2437}

2438

2439

2441 if (!LangOpts.RetainCommentsFromSystemHeaders &&

2442 SourceMgr.isInSystemHeader(Comment.getBegin()))

2443 return;

2448 StringRef MagicMarkerText;

2451 MagicMarkerText = "///<";

2452 break;

2454 MagicMarkerText = "/**<";

2455 break;

2457

2458

2459 Diag(Comment.getBegin(), diag::warn_splice_in_doxygen_comment);

2460 return;

2461 default:

2462 llvm_unreachable("if this is an almost Doxygen comment, "

2463 "it should be ordinary");

2464 }

2465 Diag(Comment.getBegin(), diag::warn_not_a_doxygen_trailing_member_comment) <<

2467 }

2469}

2470

2471

2473char ExternalSemaSource::ID;

2474

2477

2480}

2481

2483 llvm::MapVector<NamedDecl *, SourceLocation> &Undefined) {}

2484

2487

2490 ZeroArgCallReturnTy = QualType();

2491 OverloadSet.clear();

2492

2494 bool IsMemExpr = false;

2497

2498

2500 return false;

2501

2504 Overloads = dyn_cast(E.IgnoreParens());

2505 IsMemExpr = true;

2506 }

2507

2508 bool Ambiguous = false;

2509 bool IsMV = false;

2510

2511 if (Overloads) {

2513 DeclsEnd = Overloads->decls_end(); it != DeclsEnd; ++it) {

2514 OverloadSet.addDecl(*it);

2515

2516

2517

2518 if (IsMemExpr)

2519 continue;

2521 = dyn_cast((*it)->getUnderlyingDecl())) {

2522 if (OverloadDecl->getMinRequiredArguments() == 0) {

2523 if (!ZeroArgCallReturnTy.isNull() && !Ambiguous &&

2524 (!IsMV || !(OverloadDecl->isCPUDispatchMultiVersion() ||

2525 OverloadDecl->isCPUSpecificMultiVersion()))) {

2526 ZeroArgCallReturnTy = QualType();

2527 Ambiguous = true;

2528 } else {

2529 ZeroArgCallReturnTy = OverloadDecl->getReturnType();

2530 IsMV = OverloadDecl->isCPUDispatchMultiVersion() ||

2531 OverloadDecl->isCPUSpecificMultiVersion();

2532 }

2533 }

2534 }

2535 }

2536

2537

2538 if (!IsMemExpr)

2539 return !ZeroArgCallReturnTy.isNull();

2540 }

2541

2542

2543

2544

2550 ZeroArgCallReturnTy = R.get()->getType();

2551 return true;

2552 }

2553 return false;

2554 }

2555

2556 if (const auto *DeclRef = dyn_cast(E.IgnoreParens())) {

2557 if (const auto *Fun = dyn_cast(DeclRef->getDecl())) {

2558 if (Fun->getMinRequiredArguments() == 0)

2559 ZeroArgCallReturnTy = Fun->getReturnType();

2560 return true;

2561 }

2562 }

2563

2564

2565

2569 if (!PointeeTy.isNull())

2571 if (!FunTy)

2573

2574 if (const auto *FPT = dyn_cast_if_present(FunTy)) {

2575 if (FPT->getNumParams() == 0)

2577 return true;

2578 }

2579 return false;

2580}

2581

2582

2583

2584

2585

2586

2587

2588

2589

2590

2591

2592

2593

2596 unsigned ShownOverloads = 0;

2597 unsigned SuppressedOverloads = 0;

2599 DeclsEnd = Overloads.end(); It != DeclsEnd; ++It) {

2601 ++SuppressedOverloads;

2602 continue;

2603 }

2604

2605 const NamedDecl *Fn = (*It)->getUnderlyingDecl();

2606

2607 if (const auto *FD = Fn->getAsFunction()) {

2609 !FD->getAttr()->isDefaultVersion())

2610 continue;

2612 !FD->getAttr()->isDefaultVersion())

2613 continue;

2614 }

2615 S.Diag(Fn->getLocation(), diag::note_possible_target_of_call);

2616 ++ShownOverloads;

2617 }

2618

2620

2621 if (SuppressedOverloads)

2622 S.Diag(FinalNoteLoc, diag::note_ovl_too_many_candidates)

2623 << SuppressedOverloads;

2624}

2625

2628 bool (*IsPlausibleResult)(QualType)) {

2629 if (!IsPlausibleResult)

2631

2634 DeclsEnd = Overloads.end(); It != DeclsEnd; ++It) {

2635 const auto *OverloadDecl = cast(*It);

2636 QualType OverloadResultTy = OverloadDecl->getReturnType();

2637 if (IsPlausibleResult(OverloadResultTy))

2638 PlausibleOverloads.addDecl(It.getDecl());

2639 }

2641}

2642

2643

2644

2645

2646

2649 return (!isa(E) &&

2650 !isa(E) &&

2651 !isa(E) &&

2652 !isa(E));

2653}

2654

2656 if (const auto *UO = dyn_cast(E))

2657 E = UO->getSubExpr();

2658

2659 if (const auto *ULE = dyn_cast(E)) {

2660 if (ULE->getNumDecls() == 0)

2661 return false;

2662

2663 const NamedDecl *ND = *ULE->decls_begin();

2664 if (const auto *FD = dyn_cast(ND))

2666 }

2667 return false;

2668}

2669

2671 bool ForceComplain,

2672 bool (*IsPlausibleResult)(QualType)) {

2676

2677

2678

2679 if (!isSFINAEContext()) {

2681 if (tryExprAsCall(*E.get(), ZeroArgCallTy, Overloads) &&

2682 !ZeroArgCallTy.isNull() &&

2683 (!IsPlausibleResult || IsPlausibleResult(ZeroArgCallTy))) {

2684

2685

2686

2687

2690 Diag(Loc, PD) << 1 << IsMV << Range

2693 "()")

2695 if (!IsMV)

2697

2698

2699

2700 E = BuildCallExpr(nullptr, E.get(), Range.getEnd(), {},

2702 return true;

2703 }

2704 }

2705 if (!ForceComplain) return false;

2706

2708 Diag(Loc, PD) << 0 << IsMV << Range;

2709 if (!IsMV)

2712 return true;

2713}

2714

2716 if (!Ident_super)

2717 Ident_super = &Context.Idents.get("super");

2718 return Ident_super;

2719}

2720

2723 unsigned OpenMPCaptureLevel) {

2727 ? OpenMP().getOpenMPNestingLevel()

2728 : 0,

2729 OpenMPCaptureLevel);

2730 CSI->ReturnType = Context.VoidTy;

2731 FunctionScopes.push_back(CSI);

2732 CapturingFunctionScopes++;

2733}

2734

2736 if (FunctionScopes.empty())

2737 return nullptr;

2738

2739 return dyn_cast(FunctionScopes.back());

2740}

2741

2742const llvm::MapVector<FieldDecl *, Sema::DeleteLocs> &

2744 return DeleteExprs;

2745}

2746

2748 : S(S), OldFPFeaturesState(S.CurFPFeatures),

2749 OldOverrides(S.FpPragmaStack.CurrentValue),

2750 OldEvalMethod(S.PP.getCurrentFPEvalMethod()),

2751 OldFPPragmaLocation(S.PP.getLastFPEvalPragmaLocation()) {}

2752

2757}

2758

2760 assert(D.getCXXScopeSpec().isSet() &&

2761 "can only be called for qualified names");

2762

2766 D.getDeclSpec().isFriendSpecified());

2767 if (!DC)

2768 return false;

2769

2771 bool Result = llvm::all_of(LR, [](Decl *Dcl) {

2772 if (NamedDecl *ND = dyn_cast(Dcl)) {

2773 ND = ND->getUnderlyingDecl();

2774 return isa(ND) || isa(ND) ||

2775 isa(ND);

2776 }

2777 return false;

2778 });

2780}

2781

2784

2785 auto *A = AnnotateAttr::Create(Context, Annot, Args.data(), Args.size(), CI);

2788 return nullptr;

2789 }

2790 return A;

2791}

2792

2794

2795

2796 StringRef Str;

2798 return nullptr;

2799

2802 for (unsigned Idx = 1; Idx < AL.getNumArgs(); Idx++) {

2805 }

2806

2808}

Defines the clang::ASTContext interface.

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

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

llvm::DenseSet< const void * > Visited

llvm::MachO::FileType FileType

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

Defines the clang::Preprocessor interface.

This file declares semantic analysis functions specific to AMDGPU.

This file declares semantic analysis functions specific to ARM.

This file declares semantic analysis functions specific to AVR.

This file declares semantic analysis functions specific to BPF.

This file declares semantic analysis for CUDA constructs.

This file declares facilities that support code completion.

This file declares semantic analysis for HLSL constructs.

This file declares semantic analysis functions specific to Hexagon.

This file declares semantic analysis functions specific to LoongArch.

This file declares semantic analysis functions specific to M68k.

This file declares semantic analysis functions specific to MIPS.

This file declares semantic analysis functions specific to MSP430.

This file declares semantic analysis functions specific to NVPTX.

This file declares semantic analysis for Objective-C.

This file declares semantic analysis for OpenACC constructs and clauses.

This file declares semantic analysis routines for OpenCL.

This file declares semantic analysis for OpenMP constructs and clauses.

This file declares semantic analysis functions specific to PowerPC.

This file declares semantic analysis for expressions involving.

This file declares semantic analysis functions specific to RISC-V.

This file declares semantic analysis for SPIRV constructs.

This file declares semantic analysis for SYCL constructs.

This file declares semantic analysis functions specific to Swift.

This file declares semantic analysis functions specific to SystemZ.

This file declares semantic analysis functions specific to Wasm.

This file declares semantic analysis functions specific to X86.

static void checkEscapingByref(VarDecl *VD, Sema &S)

static bool IsCPUDispatchCPUSpecificMultiVersion(const Expr *E)

llvm::DenseMap< const CXXRecordDecl *, bool > RecordCompleteMap

static bool IsCallableWithAppend(const Expr *E)

Determine whether the given expression can be called by just putting parentheses after it.

static bool MethodsAndNestedClassesComplete(const CXXRecordDecl *RD, RecordCompleteMap &MNCComplete)

Returns true, if all methods and nested classes of the given CXXRecordDecl are defined in this transl...

static void noteOverloads(Sema &S, const UnresolvedSetImpl &Overloads, const SourceLocation FinalNoteLoc)

Give notes for a set of overloads.

static bool isFunctionOrVarDeclExternC(const NamedDecl *ND)

static void markEscapingByrefs(const FunctionScopeInfo &FSI, Sema &S)

static bool ShouldRemoveFromUnused(Sema *SemaRef, const DeclaratorDecl *D)

Used to prune the decls of Sema's UnusedFileScopedDecls vector.

static void emitCallStackNotes(Sema &S, const FunctionDecl *FD)

static void notePlausibleOverloads(Sema &S, SourceLocation Loc, const UnresolvedSetImpl &Overloads, bool(*IsPlausibleResult)(QualType))

static void checkUndefinedButUsed(Sema &S)

checkUndefinedButUsed - Check for undefined objects with internal linkage or that are inline.

static bool IsRecordFullyDefined(const CXXRecordDecl *RD, RecordCompleteMap &RecordsComplete, RecordCompleteMap &MNCComplete)

Returns true, if the given CXXRecordDecl is fully defined in this translation unit,...

Defines the SourceManager interface.

Allows QualTypes to be sorted and hence used in maps and sets.

ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.

virtual void CompleteTentativeDefinition(VarDecl *D)

CompleteTentativeDefinition - Callback invoked at the end of a translation unit to notify the consume...

virtual ASTMutationListener * GetASTMutationListener()

If the consumer is interested in entities getting modified after their initial creation,...

virtual void CompleteExternalDeclaration(DeclaratorDecl *D)

CompleteExternalDeclaration - Callback invoked at the end of a translation unit to notify the consume...

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

SourceManager & getSourceManager()

TranslationUnitDecl * getTranslationUnitDecl() const

QualType getAtomicType(QualType T) const

Return the uniqued reference to the atomic type for the specified type.

TypedefDecl * getObjCClassDecl() const

Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type.

TypedefDecl * getCFConstantStringDecl() const

const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const

Return the APFloat 'semantics' for the specified scalar floating point type.

TypedefDecl * getObjCSelDecl() const

Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.

TypedefDecl * buildImplicitTypedef(QualType T, StringRef Name) const

Create a new implicit TU-level typedef declaration.

TypedefDecl * getBuiltinMSVaListDecl() const

Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type.

TypedefDecl * getObjCIdDecl() const

Retrieve the typedef corresponding to the predefined id type in Objective-C.

CanQualType getCanonicalType(QualType T) const

Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...

ArrayRef< Decl * > getModuleInitializers(Module *M)

Get the initializations to perform when importing a module, if any.

void addComment(const RawComment &RC)

RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=RecordDecl::TagKind::Struct) const

Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.

const IncompleteArrayType * getAsIncompleteArrayType(QualType T) const

QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArraySizeModifier ASM, unsigned IndexTypeQuals) const

Return the unique reference to the type for a constant array of the specified element type.

const LangOptions & getLangOpts() const

QualType getUIntPtrType() const

Return a type compatible with "uintptr_t" (C99 7.18.1.4), as defined by the target.

PartialDiagnostic::DiagStorageAllocator & getDiagAllocator()

QualType getPointerDiffType() const

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

const TargetInfo * getAuxTargetInfo() const

CanQualType UnsignedLongTy

bool hasAnyFunctionEffects() const

CanQualType getSizeType() const

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

CanQualType BoundMemberTy

TypedefDecl * getInt128Decl() const

Retrieve the declaration for the 128-bit signed integer type.

LangAS getDefaultOpenCLPointeeAddrSpace()

Returns default address space based on OpenCL version and enabled features.

CanQualType OCLClkEventTy

TypedefDecl * getUInt128Decl() const

Retrieve the declaration for the 128-bit unsigned integer type.

const clang::PrintingPolicy & getPrintingPolicy() const

uint64_t getTypeSize(QualType T) const

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

ObjCInterfaceDecl * getObjCProtocolDecl() const

Retrieve the Objective-C class declaration corresponding to the predefined Protocol class.

TypedefDecl * getBuiltinVaListDecl() const

Retrieve the C type declaration corresponding to the predefined __builtin_va_list type.

CanQualType UnsignedIntTy

CanQualType OCLReserveIDTy

const TargetInfo & getTargetInfo() const

void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *) const

void setBlockVarCopyInit(const VarDecl *VD, Expr *CopyExpr, bool CanThrow)

Set the copy initialization expression of a block var decl.

ExternalASTSource * getExternalSource() const

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

QualType getIntPtrType() const

Return a type compatible with "intptr_t" (C99 7.18.1.4), as defined by the target.

IdentifierInfo * getBoolName() const

Retrieve the identifier 'bool'.

void setPrintingPolicy(const clang::PrintingPolicy &Policy)

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

Attr - This represents one attribute.

A class which contains all the information about a particular captured value.

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

ArrayRef< Capture > captures() const

SourceLocation getCaretLocation() const

bool doesNotEscape() const

Represents a C++ destructor within a class.

CXXFieldCollector - Used to keep track of CXXFieldDecls during parsing of C++ classes.

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

An iterator over the friend declarations of a class.

Represents a C++ struct/union/class.

friend_iterator friend_begin() const

friend_iterator friend_end() const

Represents the body of a CapturedStmt, and serves as its DeclContext.

ImplicitParamDecl * getContextParam() const

Retrieve the parameter containing captured variables.

const char * getCastKindName() const

Abstract interface for a consumer of code-completion information.

The information about the darwin SDK that was used during this compilation.

decl_iterator - Iterates through the declarations stored within this context.

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

DeclContext * getParent()

getParent - Returns the containing DeclContext.

decl_iterator decls_end() const

DeclContext * getPrimaryContext()

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

decl_iterator decls_begin() const

A reference to a declared variable, function, enum, etc.

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

void setInvalidDecl(bool Invalid=true)

setInvalidDecl - Indicates the Decl had a semantic error.

bool isReferenced() const

Whether any declaration of this entity was referenced.

bool isInvalidDecl() const

SourceLocation getLocation() const

bool isUsed(bool CheckUsedAttr=true) const

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

DeclContext * getDeclContext()

SourceLocation getBeginLoc() const LLVM_READONLY

The name of a declaration.

Represents a ValueDecl that came out of a declarator.

Information about one declarator, including the parsed type information and the identifier.

A little helper class used to produce diagnostics.

static SFINAEResponse getDiagnosticSFINAEResponse(unsigned DiagID)

Determines whether the given built-in diagnostic ID is for an error that is suppressed if it occurs d...

static bool isDefaultMappingAsError(unsigned DiagID)

Return true if the specified diagnostic is mapped to errors by default.

static bool isBuiltinNote(unsigned DiagID)

Determine whether the given built-in diagnostic ID is a Note.

@ SFINAE_SubstitutionFailure

The diagnostic should not be reported, but it should cause template argument deduction to fail.

@ SFINAE_Suppress

The diagnostic should be suppressed entirely.

@ SFINAE_AccessControl

The diagnostic is an access-control diagnostic, which will be substitution failures in some contexts ...

@ SFINAE_Report

The diagnostic should be reported.

A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine a...

const SourceLocation & getLocation() const

DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)

Issue the message to the client.

void SetArgToStringFn(ArgToStringFnTy Fn, void *Cookie)

bool EmitDiagnostic(const DiagnosticBuilder &DB, bool Force=false)

Emit the diagnostic.

bool hasErrorOccurred() const

void overloadCandidatesShown(unsigned N)

Call this after showing N overload candidates.

void setLastDiagnosticIgnored(bool Ignored)

Pretend that the last diagnostic issued was ignored, so any subsequent notes will be suppressed,...

unsigned getNumOverloadCandidatesToShow() const

When a call or operator fails, print out up to this many candidate overloads as suggestions.

bool hasFatalErrorOccurred() const

bool isIgnored(unsigned DiagID, SourceLocation Loc) const

Determine whether the diagnostic is known to be ignored.

Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc) const

Based on the way the client configured the DiagnosticsEngine object, classify the specified diagnosti...

bool getSuppressSystemWarnings() const

RAII object that enters a new expression evaluation context.

This represents one expression.

bool isTypeDependent() const

Determines whether the type of this expression depends on.

Expr * IgnoreParenImpCasts() LLVM_READONLY

Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...

Expr * IgnoreImplicit() LLVM_READONLY

Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.

Expr * IgnoreParens() LLVM_READONLY

Skip past any parentheses which might surround this expression until reaching a fixed point.

SourceLocation getExprLoc() const LLVM_READONLY

getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...

An abstract interface that should be implemented by external AST sources that also provide informatio...

virtual void updateOutOfDateSelector(Selector Sel)

Load the contents of the global method pool for a given selector if necessary.

virtual void ReadMethodPool(Selector Sel)

Load the contents of the global method pool for a given selector.

virtual void ReadUndefinedButUsed(llvm::MapVector< NamedDecl *, SourceLocation > &Undefined)

Load the set of used but not defined functions or variables with internal linkage,...

~ExternalSemaSource() override

virtual void ReadKnownNamespaces(SmallVectorImpl< NamespaceDecl * > &Namespaces)

Load the set of namespaces that are known to the external source, which will be used during typo corr...

virtual void ReadMismatchingDeleteExpressions(llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 > > &)

Represents difference between two FPOptions values.

Represents a member of a struct/union/class.

StringRef getName() const

The name of this FileEntry.

An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...

llvm::vfs::FileSystem & getVirtualFileSystem() const

Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...

static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)

Create a code modification hint that replaces the given source range with the given code string.

static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)

Create a code modification hint that inserts the given code string at a specific location.

Represents a function declaration or definition.

bool isMultiVersion() const

True if this function is considered a multiversioned function.

Stmt * getBody(const FunctionDecl *&Definition) const

Retrieve the body (definition) of the function.

bool isCPUSpecificMultiVersion() const

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

bool isDeleted() const

Whether this function has been deleted.

bool isCPUDispatchMultiVersion() const

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

bool isDefaulted() const

Whether this function is defaulted.

const ASTTemplateArgumentListInfo * getTemplateSpecializationArgsAsWritten() const

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

static FunctionEffectsRef get(QualType QT)

Extract the effects from a Type if it is a function, block, or member function pointer,...

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

Declaration of a template function.

FunctionType - C99 6.7.5.3 - Function Declarators.

QualType getReturnType() const

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

StringRef getName() const

Return the actual identifier string.

iterator begin(DeclarationName Name)

Returns an iterator over decls with the name 'Name'.

iterator end()

Returns the end iterator.

IdentifierInfo & get(StringRef Name)

Return the identifier token info for the specified named identifier.

ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...

static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat, FPOptionsOverride FPO)

Represents a C array with an unspecified size.

static InitializedEntity InitializeBlock(SourceLocation BlockVarLoc, QualType Type)

@ CMK_HeaderUnit

Compiling a module header unit.

@ CMK_ModuleInterface

Compiling a C++ modules interface unit.

bool IsHeaderFile

Indicates whether the front-end is explicitly told that the input is a header file (i....

CommentOptions CommentOpts

Options for parsing comments.

unsigned getOpenCLCompatibleVersion() const

Return the OpenCL version that kernel language is compatible with.

void erase(iterator From, iterator To)

iterator begin(Source *source, bool LocalOnly=false)

static SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset, const SourceManager &SM, const LangOptions &LangOpts)

Computes the source location just past the end of the token at this source location.

Represents the results of name lookup.

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

Abstract interface for a module loader.

bool resolveExports(Module *Mod, bool Complain)

Resolve all of the unresolved exports in the given module.

bool resolveConflicts(Module *Mod, bool Complain)

Resolve all of the unresolved conflicts in the given module.

bool resolveUses(Module *Mod, bool Complain)

Resolve all of the unresolved uses in the given module.

Describes a module or submodule.

bool isNamedModuleInterfaceHasInit() const

bool isInterfaceOrPartition() const

llvm::SmallSetVector< Module *, 2 > Imports

The set of modules imported by this module, and on which this module depends.

llvm::iterator_range< submodule_iterator > submodules()

@ PrivateModuleFragment

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

@ ExplicitGlobalModuleFragment

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

An abstract interface that should be implemented by external AST sources that also provide informatio...

static const unsigned NumNSNumberLiteralMethods

This represents a decl that may have a name.

bool hasExternalFormalLinkage() const

True if this decl has external linkage.

bool isExternallyVisible() const

This represents '#pragma omp target' directive.

ObjCMethodDecl - Represents an instance or class method declaration.

void addSupport(const llvm::StringMap< bool > &FeaturesMap, const LangOptions &Opts)

A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.

static FindResult find(Expr *E)

Finds the overloaded expression in the given expression E of OverloadTy.

decls_iterator decls_begin() const

decls_iterator decls_end() const

This interface provides a way to observe the actions of the preprocessor as it does its thing.

ParsedAttr - Represents a syntactic attribute.

unsigned getNumArgs() const

getNumArgs - Return the number of actual arguments to this attribute.

bool isArgIdent(unsigned Arg) const

Expr * getArgAsExpr(unsigned Arg) const

unsigned getDiagID() const

void Emit(const DiagnosticBuilder &DB) const

Engages in a tight little dance with the lexer to efficiently preprocess tokens.

bool isIncrementalProcessingEnabled() const

Returns true if incremental processing is enabled.

const MacroInfo * getMacroInfo(const IdentifierInfo *II) const

LangOptions::FPEvalMethodKind getCurrentFPEvalMethod() const

const TranslationUnitKind TUKind

The kind of translation unit we are processing.

ModuleLoader & getModuleLoader() const

Retrieve the module loader associated with this preprocessor.

void addPPCallbacks(std::unique_ptr< PPCallbacks > C)

IdentifierInfo * getIdentifierInfo(StringRef Name) const

Return information about the specified preprocessor identifier token.

Module * getCurrentModule()

Retrieves the module that we're currently building, if any.

void setCurrentFPEvalMethod(SourceLocation PragmaLoc, LangOptions::FPEvalMethodKind Val)

FileManager & getFileManager() const

bool isCodeCompletionEnabled() const

Determine if we are performing code completion.

HeaderSearch & getHeaderSearchInfo() const

const LangOptions & getLangOpts() const

A (possibly-)qualified type.

bool hasNonTrivialToPrimitiveCopyCUnion() const

Check if this is or contains a C union that is non-trivial to copy, which is a union that has a membe...

bool isNull() const

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

bool hasNonTrivialToPrimitiveDestructCUnion() const

Check if this is or contains a C union that is non-trivial to destruct, which is a union that has a m...

QualType getCanonicalType() const

QualType getUnqualifiedType() const

Retrieve the unqualified variant of the given type, removing as little sugar as possible.

bool isConstQualified() const

Determine whether this type is const-qualified.

Represents a struct/union/class.

decl_type * getMostRecentDecl()

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

Scope - A scope is a transient data structure that is used while parsing the program.

@ TemplateParamScope

This is a scope that corresponds to the template parameters of a C++ template.

@ DeclScope

This is a scope that can contain a declaration.

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

A generic diagnostic builder for errors which may or may not be deferred.

@ K_Immediate

Emit the diagnostic immediately (i.e., behave like Sema::Diag()).

SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)

Emit a diagnostic.

PartialDiagnostic PDiag(unsigned DiagID=0)

Build a partial diagnostic.

const LangOptions & getLangOpts() const

DiagnosticsEngine & getDiagnostics() const

llvm::DenseMap< CanonicalDeclPtr< const FunctionDecl >, FunctionDeclAndLoc > DeviceKnownEmittedFns

An inverse call graph, mapping known-emitted functions to one of their known-emitted callers (plus th...

An abstract interface that should be implemented by clients that read ASTs and then require further s...

void DiagnoseAvailabilityViolations(TranslationUnitDecl *TU)

ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]

The Objective-C NSNumber methods used to create NSNumber literals.

void DiagnoseUseOfUnimplementedSelectors()

std::unique_ptr< NSAPI > NSAPIObj

Caches identifiers/selectors for NSFoundation APIs.

void DiagnoseUnterminatedOpenMPDeclareTarget()

Report unterminated 'omp declare target' or 'omp begin declare target' at the end of a compilation un...

void finalizeOpenMPDelayedAnalysis(const FunctionDecl *Caller, const FunctionDecl *Callee, SourceLocation Loc)

Finishes analysis of the deferred functions calls that may be declared as host/nohost during device/h...

A class which encapsulates the logic for delaying diagnostics during parsing and other processing.

sema::DelayedDiagnosticPool * getCurrentPool() const

Returns the current delayed-diagnostics pool.

FPFeaturesStateRAII(Sema &S)

Custom deleter to allow FunctionScopeInfos to be kept alive for a short time after they've been poppe...

void operator()(sema::FunctionScopeInfo *Scope) const

RAII class used to indicate that we are performing provisional semantic analysis to determine the val...

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

SmallVector< DeclaratorDecl *, 4 > ExternalDeclarations

All the external declarations encoutered and used in the TU.

bool ConstantFoldAttrArgs(const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)

ConstantFoldAttrArgs - Folds attribute arguments into ConstantExprs (unless they are value dependent ...

SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts

List of active code synthesis contexts.

sema::CapturingScopeInfo * getEnclosingLambdaOrBlock() const

Get the innermost lambda or block enclosing the current location, if any.

void LoadExternalWeakUndeclaredIdentifiers()

Load weak undeclared identifiers from the external source.

bool isExternalWithNoLinkageType(const ValueDecl *VD) const

Determine if VD, which must be a variable or function, is an external symbol that nonetheless can't b...

bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, UnresolvedSetImpl &NonTemplateOverloads)

Figure out if an expression could be turned into a call.

@ LookupOrdinaryName

Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....

void addImplicitTypedef(StringRef Name, QualType T)

void CheckDelegatingCtorCycles()

SmallVector< CXXMethodDecl *, 4 > DelayedDllExportMemberFunctions

const TranslationUnitKind TUKind

The kind of translation unit we are processing.

llvm::SmallSetVector< const TypedefNameDecl *, 4 > UnusedLocalTypedefNameCandidates

Set containing all typedefs that are likely unused.

void emitAndClearUnusedLocalTypedefWarnings()

std::unique_ptr< CXXFieldCollector > FieldCollector

FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.

void Initialize()

Perform initialization that occurs after the parser has been initialized but before it parses anythin...

SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes

Stack containing information about each of the nested function, block, and method scopes that are cur...

PoppedFunctionScopePtr PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP=nullptr, const Decl *D=nullptr, QualType BlockType=QualType())

Pop a function (or block or lambda or captured region) scope from the stack.

Scope * getScopeForContext(DeclContext *Ctx)

Determines the active Scope associated with the given declaration context.

llvm::DenseSet< std::pair< Decl *, unsigned > > InstantiatingSpecializations

Specializations whose definitions are currently being instantiated.

PragmaStack< FPOptionsOverride > FpPragmaStack

void setFunctionHasBranchIntoScope()

virtual void anchor()

This virtual key function only exists to limit the emission of debug info describing the Sema class.

void ActOnComment(SourceRange Comment)

void ActOnEndOfTranslationUnit()

ActOnEndOfTranslationUnit - This is called at the very end of the translation unit when EOF is reache...

FPOptionsOverride CurFPFeatureOverrides()

void ActOnTranslationUnitScope(Scope *S)

Scope actions.

NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)

Look up a name, looking for a single declaration.

IdentifierInfo * getSuperIdentifier() const

FunctionDecl * getCurFunctionDecl(bool AllowLambda=false) const

Returns a pointer to the innermost enclosing function, or nullptr if the current context is not insid...

void DiagnosePrecisionLossInComplexDivision()

void diagnoseNullableToNonnullConversion(QualType DstType, QualType SrcType, SourceLocation Loc)

Warn if we're implicitly casting from a _Nullable pointer type to a _Nonnull one.

DiagnosticsEngine & getDiagnostics() const

bool tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD, bool ForceComplain=false, bool(*IsPlausibleResult)(QualType)=nullptr)

Try to recover by turning the given expression into a call.

SemaDiagnosticBuilder::DeferredDiagnosticsType DeviceDeferredDiags

Diagnostics that are emitted only if we discover that the given function must be codegen'ed.

void CheckDelayedMemberExceptionSpecs()

void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)

Add this decl to the scope shadowed decl chains.

UnusedFileScopedDeclsType UnusedFileScopedDecls

The set of file scoped decls seen so far that have not been used and must warn if not used.

ASTContext & getASTContext() const

SmallVector< std::pair< FunctionDecl *, FunctionDecl * >, 2 > DelayedEquivalentExceptionSpecChecks

All the function redeclarations seen during a class definition that had their exception spec checks d...

ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CheckedConversionKind::Implicit)

ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.

static const unsigned MaxAlignmentExponent

The maximum alignment, same as in llvm::Value.

bool shouldIgnoreInHostDeviceCheck(FunctionDecl *Callee)

PrintingPolicy getPrintingPolicy() const

Retrieve a suitable printing policy for diagnostics.

ObjCMethodDecl * getCurMethodDecl()

getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...

sema::LambdaScopeInfo * getCurGenericLambda()

Retrieve the current generic lambda info, if any.

unsigned NumSFINAEErrors

The number of SFINAE diagnostics that have been trapped.

void setFunctionHasIndirectGoto()

LangAS getDefaultCXXMethodAddrSpace() const

Returns default addr space for method qualifiers.

void PushFunctionScope()

Enter a new function scope.

std::unique_ptr< sema::FunctionScopeInfo, PoppedFunctionScopeDeleter > PoppedFunctionScopePtr

Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, TranslationUnitKind TUKind=TU_Complete, CodeCompleteConsumer *CompletionConsumer=nullptr)

SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)

Calls Lexer::getLocForEndOfToken()

sema::LambdaScopeInfo * PushLambdaScope()

const LangOptions & getLangOpts() const

const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)

ASTConsumer & getASTConsumer() const

threadSafety::BeforeSet * ThreadSafetyDeclCache

void checkTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D=nullptr)

Check if the type is allowed to be used for the current target.

const LangOptions & LangOpts

sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)

Retrieve the current lambda scope info, if any.

static const uint64_t MaximumAlignment

void PerformPendingInstantiations(bool LocalOnly=false)

Performs template instantiation for all implicit template instantiations we have seen until this poin...

NamedDeclSetType UnusedPrivateFields

Set containing all declared private fields that are not used.

void ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind)

bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const

IdentifierInfo * InventAbbreviatedTemplateParameterTypeName(const IdentifierInfo *ParamName, unsigned Index)

Invent a new identifier for parameters of abbreviated templates.

SmallVector< PendingImplicitInstantiation, 1 > LateParsedInstantiations

Queue of implicit template instantiations that cannot be performed eagerly.

void performFunctionEffectAnalysis(TranslationUnitDecl *TU)

SmallVector< std::pair< const CXXMethodDecl *, const CXXMethodDecl * >, 2 > DelayedOverridingExceptionSpecChecks

All the overriding functions seen during a class definition that had their exception spec checks dela...

NamedDecl * getCurFunctionOrMethodDecl() const

getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method or C function we're in,...

static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)

ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...

void PushCompoundScope(bool IsStmtExpr)

bool isDeclaratorFunctionLike(Declarator &D)

Determine whether.

std::optional< sema::TemplateDeductionInfo * > isSFINAEContext() const

Determines whether we are currently in a context where template argument substitution failures are no...

bool findMacroSpelling(SourceLocation &loc, StringRef name)

Looks through the macro-expansion chain for the given location, looking for a macro expansion with th...

FunctionEmissionStatus getEmissionStatus(const FunctionDecl *Decl, bool Final=false)

Module * getCurrentModule() const

Get the module unit whose scope we are currently within.

static bool isCast(CheckedConversionKind CCK)

sema::BlockScopeInfo * getCurBlock()

Retrieve the current block, if any.

DeclContext * CurContext

CurContext - This is the current declaration context of parsing.

MaterializeTemporaryExpr * CreateMaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference)

DeclContext * getFunctionLevelDeclContext(bool AllowLambda=false) const

If AllowLambda is true, treat lambda as function.

bool DefineUsedVTables()

Define all of the vtables that have been used in this translation unit and reference any virtual memb...

bool inTemplateInstantiation() const

Determine whether we are currently performing template instantiation.

SourceManager & getSourceManager() const

bool makeUnavailableInSystemHeader(SourceLocation loc, UnavailableAttr::ImplicitReason reason)

makeUnavailableInSystemHeader - There is an error in the current context.

void getUndefinedButUsed(SmallVectorImpl< std::pair< NamedDecl *, SourceLocation > > &Undefined)

Obtain a sorted list of functions that are undefined but ODR-used.

void diagnoseFunctionEffectConversion(QualType DstType, QualType SrcType, SourceLocation Loc)

Warn when implicitly changing function effects.

ExprResult PerformMoveOrCopyInitialization(const InitializedEntity &Entity, const NamedReturnInfo &NRInfo, Expr *Value, bool SupressSimplerImplicitMoves=false)

Perform the initialization of a potentially-movable value, which is the result of return value.

void DiagnoseNonDefaultPragmaAlignPack(PragmaAlignPackDiagnoseKind Kind, SourceLocation IncludeLoc)

CanThrowResult canThrow(const Stmt *E)

bool AccessCheckingSFINAE

When true, access checking violations are treated as SFINAE failures rather than hard errors.

DeclContext * computeDeclContext(QualType T)

Compute the DeclContext that is associated with the given type.

void PushBlockScope(Scope *BlockScope, BlockDecl *Block)

void * VisContext

VisContext - Manages the stack for #pragma GCC visibility.

void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD, RecordDecl *RD, CapturedRegionKind K, unsigned OpenMPCaptureLevel=0)

void setFunctionHasMustTail()

void CheckCompleteVariableDeclaration(VarDecl *VD)

@ Global

The global module fragment, between 'module;' and a module-declaration.

@ Private

The private module fragment, between 'module :private;' and the end of the translation unit.

@ Normal

A normal translation unit fragment.

void setFunctionHasBranchProtectedScope()

RedeclarationKind forRedeclarationInCurContext() const

void ActOnStartOfTranslationUnit()

This is called before the very first declaration in the translation unit is parsed.

llvm::SmallPtrSet< const Decl *, 4 > ParsingInitForAutoVars

ParsingInitForAutoVars - a set of declarations with auto types for which we are currently parsing the...

@ NonDefaultStateAtInclude

sema::AnalysisBasedWarnings AnalysisWarnings

Worker object for performing CFG-based warnings.

bool hasUncompilableErrorOccurred() const

Whether uncompilable error has occurred.

std::deque< PendingImplicitInstantiation > PendingInstantiations

The queue of implicit template instantiations that are required but have not yet been performed.

ModuleLoader & getModuleLoader() const

Retrieve the module loader associated with the preprocessor.

@ PotentiallyEvaluated

The current expression is potentially evaluated at run time, which means that code may be generated t...

std::pair< SourceLocation, bool > DeleteExprLoc

void RecordParsingTemplateParameterDepth(unsigned Depth)

This is used to inform Sema what the current TemplateParameterDepth is during Parsing.

bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)

Ensure that the type T is a complete type.

Scope * TUScope

Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...

void DiagnoseUnterminatedPragmaAttribute()

void FreeVisContext()

FreeVisContext - Deallocate and null out VisContext.

bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)

Perform qualified name lookup into a given context.

llvm::MapVector< FieldDecl *, DeleteLocs > DeleteExprs

Delete-expressions to be analyzed at the end of translation unit.

TentativeDefinitionsType TentativeDefinitions

All the tentative definitions encountered in the TU.

Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)

MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...

DarwinSDKInfo * getDarwinSDKInfoForAvailabilityChecking()

const llvm::MapVector< FieldDecl *, DeleteLocs > & getMismatchingDeleteExpressions() const

Retrieves list of suspicious delete-expressions that will be checked at the end of translation unit.

SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts

A stack of expression evaluation contexts.

void PushDeclContext(Scope *S, DeclContext *DC)

Set the current declaration context until it gets popped.

SourceManager & SourceMgr

DiagnosticsEngine & Diags

void DiagnoseUnterminatedPragmaAlignPack()

OpenCLOptions & getOpenCLOptions()

LateTemplateParserCleanupCB * LateTemplateParserCleanup

ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)

Attr * CreateAnnotationAttr(const AttributeCommonInfo &CI, StringRef Annot, MutableArrayRef< Expr * > Args)

CreateAnnotationAttr - Creates an annotation Annot with Args arguments.

llvm::MapVector< NamedDecl *, SourceLocation > UndefinedButUsed

UndefinedInternals - all the used, undefined objects which require a definition in this translation u...

void PrintStats() const

Print out statistics about the semantic analysis.

llvm::BumpPtrAllocator BumpAlloc

void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)

Run some code with "sufficient" stack space.

void addExternalSource(ExternalSemaSource *E)

Registers an external source.

SmallVector< CXXRecordDecl *, 4 > DelayedDllExportClasses

llvm::MapVector< IdentifierInfo *, llvm::SetVector< WeakInfo, llvm::SmallVector< WeakInfo, 1u >, llvm::SmallDenseSet< WeakInfo, 2u, WeakInfo::DenseMapInfoByAliasOnly > > > WeakUndeclaredIdentifiers

WeakUndeclaredIdentifiers - Identifiers contained in #pragma weak before declared.

SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID, const FunctionDecl *FD=nullptr)

DeclarationName VAListTagName

VAListTagName - The declaration name corresponding to __va_list_tag.

sema::FunctionScopeInfo * getEnclosingFunction() const

sema::CapturedRegionScopeInfo * getCurCapturedRegion()

Retrieve the current captured region, if any.

void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E)

Warn when implicitly casting 0 to nullptr.

void EmitDiagnostic(unsigned DiagID, const DiagnosticBuilder &DB)

Cause the built diagnostic to be emitted on the DiagosticsEngine.

void checkNonTrivialCUnion(QualType QT, SourceLocation Loc, NonTrivialCUnionContext UseContext, unsigned NonTrivialKind)

Emit diagnostics if a non-trivial C union type or a struct that contains a non-trivial C union is use...

IdentifierResolver IdResolver

bool hasAnyUnrecoverableErrorsInThisFunction() const

Determine whether any errors occurred within this function/method/ block.

bool checkStringLiteralArgumentAttr(const AttributeCommonInfo &CI, const Expr *E, StringRef &Str, SourceLocation *ArgLocation=nullptr)

Check if the argument E is a ASCII string literal.

ASTMutationListener * getASTMutationListener() const

Encodes a location in the source.

bool isValid() const

Return true if this is a valid SourceLocation object.

SourceLocation getLocWithOffset(IntTy Offset) const

Return a source location with the specified offset from this SourceLocation.

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

bool isInMainFile(SourceLocation Loc) const

Returns whether the PresumedLoc for a given SourceLocation is in the main file.

bool isInSystemMacro(SourceLocation loc) const

Returns whether Loc is expanded from a macro in a system header.

bool isInSystemHeader(SourceLocation Loc) const

Returns if a SourceLocation is in a system header.

SourceLocation getExpansionLoc(SourceLocation Loc) const

Given a SourceLocation object Loc, return the expansion location referenced by the ID.

A trivial tuple used to represent a source range.

SourceLocation getEnd() const

SourceLocation getBegin() const

void setEnd(SourceLocation e)

void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)

Run some code with "sufficient" stack space.

SourceRange getSourceRange() const LLVM_READONLY

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

SourceLocation getBeginLoc() const LLVM_READONLY

bool isCompleteDefinition() const

Return true if this decl has its body fully specified.

Exposes information about the current target.

virtual bool hasLongDoubleType() const

Determine whether the long double type is supported on this target.

virtual bool hasBitIntType() const

Determine whether the _BitInt type is supported on this target.

const llvm::Triple & getTriple() const

Returns the target triple of the primary target.

virtual bool hasInt128Type() const

Determine whether the __int128 type is supported on this target.

virtual bool hasFloat16Type() const

Determine whether the _Float16 type is supported on this target.

llvm::StringMap< bool > & getSupportedOpenCLOpts()

Get supported OpenCL extensions and optional core features.

virtual bool hasIbm128Type() const

Determine whether the __ibm128 type is supported on this target.

virtual bool hasFPReturn() const

Determine whether return of a floating point value is supported on this target.

bool hasBuiltinMSVaList() const

Returns whether or not type __builtin_ms_va_list type is available on this target.

virtual bool hasFloat128Type() const

Determine whether the __float128 type is supported on this target.

bool hasAArch64SVETypes() const

Returns whether or not the AArch64 SVE built-in types are available on this target.

virtual bool hasBFloat16Type() const

Determine whether the _BFloat16 type is supported on this target.

virtual bool hasFeature(StringRef Feature) const

Determine whether the given target has the given feature.

bool hasRISCVVTypes() const

Returns whether or not the RISC-V V built-in types are available on this target.

A container of type source information.

CXXRecordDecl * getAsCXXRecordDecl() const

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

bool isFloat16Type() const

bool isIntegerType() const

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

bool isSVESizelessBuiltinType() const

Returns true for SVE scalable vector types.

bool isFloat128Type() const

QualType getPointeeType() const

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

bool isBitIntType() const

bool isDependentType() const

Whether this type is a dependent type, meaning that its definition somehow depends on a template para...

ScalarTypeKind getScalarTypeKind() const

Given that this is a scalar type, classify it.

bool isIbm128Type() const

bool isBFloat16Type() const

bool isStructureOrClassType() const

bool isRealFloatingType() const

Floating point categories.

bool isRVVSizelessBuiltinType() const

Returns true for RVV scalable vector types.

Linkage getLinkage() const

Determine the linkage of this type.

const T * getAs() const

Member-template getAs'.

bool isNullPtrType() const

std::optional< NullabilityKind > getNullability() const

Determine the nullability of the given type.

Base class for declarations which introduce a typedef-name.

Simple class containing the result of Sema::CorrectTypo.

A set of unresolved declarations.

void addDecl(NamedDecl *D)

The iterator over UnresolvedSets.

A set of unresolved declarations.

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

void setType(QualType newType)

Represents a variable declaration or definition.

VarTemplateDecl * getDescribedVarTemplate() const

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

VarDecl * getDefinition(ASTContext &)

Get the real (not just tentative) definition for this declaration.

bool isFileVarDecl() const

Returns true for file scoped variable declaration.

const Expr * getInit() const

VarDecl * getActingDefinition()

Get the tentative definition that acts as the real definition in a TU.

@ DeclarationOnly

This declaration is only a declaration.

bool isEscapingByref() const

Indicates the capture is a __block variable that is captured by a block that can potentially escape (...

Declaration of a variable template.

void IssueWarnings(Policy P, FunctionScopeInfo *fscope, const Decl *D, QualType BlockType)

Retains information about a block that is currently being parsed.

Retains information about a captured region.

Contains information about the compound statement currently being parsed.

Retains information about a function, method, or block that is currently being parsed.

SmallVector< CompoundScopeInfo, 4 > CompoundScopes

The stack of currently active compound statement scopes in the function.

llvm::SmallPtrSet< const BlockDecl *, 1 > Blocks

The set of blocks that are introduced in this function.

llvm::TinyPtrVector< VarDecl * > ByrefBlockVars

The set of __block variables that are introduced in this function.

void FileChanged(SourceLocation Loc, FileChangeReason Reason, SrcMgr::CharacteristicKind FileType, FileID PrevFID) override

Callback invoked whenever a source file is entered or exited.

Defines the clang::TargetInfo interface.

bool evaluateRequiredTargetFeatures(llvm::StringRef RequiredFatures, const llvm::StringMap< bool > &TargetFetureMap)

Returns true if the required target features of a builtin function are enabled.

CharacteristicKind

Indicates whether a file or directory holds normal user code, system code, or system code which is im...

void threadSafetyCleanup(BeforeSet *Cache)

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

@ ExpectedVariableOrFunction

@ Nullable

Values of this type can be null.

@ NonNull

Values of this type can never be null.

Expected< std::optional< DarwinSDKInfo > > parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS, StringRef SDKRootPath)

Parse the SDK information from the SDKSettings.json file.

@ Self

'self' clause, allowed on Compute and Combined Constructs, plus 'update'.

CapturedRegionKind

The different kinds of captured statement.

@ Result

The result type of a method or function.

@ Class

The "class" keyword.

LangAS

Defines the address space values used by the address space qualifier of QualType.

CastKind

CastKind - The kind of operation required for a conversion.

TranslationUnitKind

Describes the kind of translation unit being processed.

@ TU_ClangModule

The translation unit is a clang module.

@ TU_Prefix

The translation unit is a prefix to a translation unit, and is not complete.

ComparisonCategoryType

An enumeration representing the different comparison categories types.

void FormatASTNodeDiagnosticArgument(DiagnosticsEngine::ArgumentKind Kind, intptr_t Val, StringRef Modifier, StringRef Argument, ArrayRef< DiagnosticsEngine::ArgumentValue > PrevArgs, SmallVectorImpl< char > &Output, void *Cookie, ArrayRef< intptr_t > QualTypeVals)

DiagnosticsEngine argument formatting function for diagnostics that involve AST nodes.

ExprValueKind

The categorization of expression values, currently following the C++11 scheme.

@ VK_PRValue

A pr-value expression (in the C++11 taxonomy) produces a temporary value.

@ VK_XValue

An x-value expression is a reference to an object with independent storage but which can be "moved",...

@ VK_LValue

An l-value expression is a reference to an object with independent storage.

const FunctionProtoType * T

bool isExternalFormalLinkage(Linkage L)

std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt

A partial diagnostic along with the source location where this diagnostic occurs.

@ Class

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

bool IsArmStreamingFunction(const FunctionDecl *FD, bool IncludeLocallyStreaming)

Returns whether the given FunctionDecl has an __arm[_locally]_streaming attribute.

bool isExternallyVisible(Linkage L)

CheckedConversionKind

The kind of conversion being performed.

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

bool HasFormOfMemberPointer

OverloadExpr * Expression

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

unsigned Bool

Whether we can use 'bool' rather than '_Bool' (even if the language doesn't actually have 'bool',...

unsigned EntireContentsOfLargeArray

Whether to print the entire array initializers, especially on non-type template parameters,...

@ RewritingOperatorAsSpaceship

We are rewriting a comparison operator in terms of an operator<=>.