Go to the documentation of this file.
48 #include "llvm/ADT/DenseMap.h"
49 #include "llvm/ADT/STLExtras.h"
50 #include "llvm/ADT/SmallPtrSet.h"
51 #include "llvm/Support/TimeProfiler.h"
54 using namespace clang;
66 auto *SDKInfo = getDarwinSDKInfoForAvailabilityChecking();
67 if (!SDKInfo && !WarnedDarwinSDKInfoMissing) {
68 Diag(Loc, diag::warn_missing_sdksettings_for_availability_checking)
70 WarnedDarwinSDKInfoMissing =
true;
76 if (CachedDarwinSDKInfo)
77 return CachedDarwinSDKInfo->get();
79 PP.getFileManager().getVirtualFileSystem(),
80 PP.getHeaderSearchInfo().getHeaderSearchOpts().Sysroot);
81 if (SDKInfo && *SDKInfo) {
82 CachedDarwinSDKInfo = std::make_unique<DarwinSDKInfo>(std::move(**SDKInfo));
83 return CachedDarwinSDKInfo->get();
86 llvm::consumeError(SDKInfo.takeError());
87 CachedDarwinSDKInfo = std::unique_ptr<DarwinSDKInfo>();
95 llvm::raw_string_ostream OS(InventedName);
98 OS <<
"auto:" << Index + 1;
100 OS << ParamName->
getName() <<
":auto";
114 Policy.
Bool = BoolMacro->isObjectLike() &&
115 BoolMacro->getNumTokens() == 1 &&
116 BoolMacro->getReplacementToken(0).is(tok::kw__Bool);
145 FileID PrevFID)
override {
153 if (llvm::timeTraceProfilerEnabled()) {
154 const FileEntry *FE =
SM.getFileEntryForID(
SM.getFileID(Loc));
155 llvm::timeTraceProfilerBegin(
156 "Source", FE !=
nullptr ? FE->
getName() : StringRef(
"<unknown>"));
159 IncludeStack.push_back(IncludeLoc);
167 if (!IncludeStack.empty()) {
168 if (llvm::timeTraceProfilerEnabled())
169 llvm::timeTraceProfilerEnd();
173 IncludeStack.pop_back_val());
190 : ExternalSource(nullptr), CurFPFeatures(pp.getLangOpts()),
191 LangOpts(pp.getLangOpts()), PP(pp), Context(ctxt), Consumer(consumer),
192 Diags(PP.getDiagnostics()), SourceMgr(PP.getSourceManager()),
193 CollectStats(
false), CodeCompleter(CodeCompleter), CurContext(nullptr),
194 OriginalLexicalContext(nullptr), MSStructPragmaOn(
false),
195 MSPointerToMemberRepresentationMethod(
196 LangOpts.getMSPointerToMemberRepresentationMethod()),
197 VtorDispStack(LangOpts.getVtorDispMode()),
199 DataSegStack(nullptr), BSSSegStack(nullptr), ConstSegStack(nullptr),
200 CodeSegStack(nullptr), StrictGuardStackCheckStack(
false),
202 VisContext(nullptr), PragmaAttributeCurrentTargetDecl(nullptr),
203 IsBuildingRecoveryCallExpr(
false), LateTemplateParser(nullptr),
204 LateTemplateParserCleanup(nullptr), OpaqueParser(nullptr), IdResolver(pp),
205 StdExperimentalNamespaceCache(nullptr), StdInitializerList(nullptr),
206 StdCoroutineTraitsCache(nullptr), CXXTypeInfoDecl(nullptr),
207 MSVCGuidDecl(nullptr), StdSourceLocationImplDecl(nullptr),
208 NSNumberDecl(nullptr), NSValueDecl(nullptr), NSStringDecl(nullptr),
209 StringWithUTF8StringMethod(nullptr),
210 ValueWithBytesObjCTypeMethod(nullptr), NSArrayDecl(nullptr),
211 ArrayWithObjectsMethod(nullptr), NSDictionaryDecl(nullptr),
212 DictionaryWithObjectsMethod(nullptr), GlobalNewDeleteDeclared(
false),
213 TUKind(TUKind), NumSFINAEErrors(0),
214 FullyCheckedComparisonCategories(
216 SatisfactionCache(Context), AccessCheckingSFINAE(
false),
217 InNonInstantiationSFINAEContext(
false), NonInstantiationEntries(0),
218 ArgumentPackSubstitutionIndex(-1), CurrentInstantiationScope(nullptr),
219 DisableTypoCorrection(
false), TyposCorrected(0), AnalysisWarnings(*this),
220 ThreadSafetyDeclCache(nullptr), VarDataSharingAttributesStack(nullptr),
221 CurScope(nullptr), Ident_super(nullptr), Ident___float128(nullptr) {
226 LoadedExternalKnownNamespaces =
false;
247 InitDataSharingAttributesStack();
249 std::unique_ptr<sema::SemaPPCallbacks> Callbacks =
250 std::make_unique<sema::SemaPPCallbacks>();
251 SemaPPCallbackHandler = Callbacks.get();
253 SemaPPCallbackHandler->
set(*
this);
269 SC->InitializeSema(*
this);
274 ExternalSema->InitializeSema(*
this);
347 if (OCLCompatibleVersion >= 200) {
376 auto AddPointerSizeDependentTypes = [&]() {
380 auto AtomicPtrDiffT =
389 AddPointerSizeDependentTypes();
397 std::vector<QualType> Atomic64BitTypes;
405 Atomic64BitTypes.push_back(AtomicDoubleT);
414 AddPointerSizeDependentTypes();
419 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
420 if (getOpenCLOptions().isSupported(#Ext, getLangOpts())) { \
421 addImplicitTypedef(#ExtType, Context.Id##Ty); \
423 #include "clang/Basic/OpenCLExtensionTypes.def"
427 #define SVE_TYPE(Name, Id, SingletonId) \
428 addImplicitTypedef(Name, Context.SingletonId);
429 #include "clang/Basic/AArch64SVEACLETypes.def"
433 #define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \
434 addImplicitTypedef(#Name, Context.Id##Ty);
435 #include "clang/Basic/PPCTypes.def"
436 #define PPC_VECTOR_VSX_TYPE(Name, Id, Size) \
437 addImplicitTypedef(#Name, Context.Id##Ty);
438 #include "clang/Basic/PPCTypes.def"
442 #define RVV_TYPE(Name, Id, SingletonId) \
443 addImplicitTypedef(Name, Context.SingletonId);
444 #include "clang/Basic/RISCVVTypes.def"
460 "failed to clean up an InstantiatingTemplate?");
475 ExternalSema->ForgetSema();
478 std::vector<ConstraintSatisfaction *> Satisfactions;
479 Satisfactions.reserve(Satisfactions.size());
480 for (
auto &
Node : SatisfactionCache)
481 Satisfactions.push_back(&
Node);
482 for (
auto *
Node : Satisfactions)
488 DestroyDataSharingAttributesStack();
492 SemaPPCallbackHandler->
reset();
498 Diag(Loc, diag::warn_stack_exhausted);
504 llvm::function_ref<
void()> Fn) {
513 UnavailableAttr::ImplicitReason reason) {
516 if (!fn)
return false;
527 if (fn->
hasAttr<UnavailableAttr>())
return true;
529 fn->
addAttr(UnavailableAttr::CreateImplicit(
Context,
"", reason, loc));
543 assert(E &&
"Cannot use with NULL ptr");
545 if (!ExternalSource) {
550 if (
auto *Ex = dyn_cast<MultiplexExternalSemaSource>(ExternalSource))
558 llvm::errs() <<
"\n*** Semantic Analysis Stats:\n";
568 std::optional<NullabilityKind> ExprNullability = SrcType->
getNullability();
573 std::optional<NullabilityKind> TypeNullability = DstType->
getNullability();
577 Diag(Loc, diag::warn_nullability_lost) << SrcType << DstType;
585 if (
Kind != CK_NullToPointer &&
Kind != CK_NullToMemberPointer)
631 (
"can't implicitly cast glvalue to prvalue with this cast "
636 case CK_LValueToRValue:
637 case CK_ArrayToPointerDecay:
638 case CK_FunctionToPointerDecay:
640 case CK_NonAtomicToAtomic:
645 "can't cast prvalue to glvalue");
657 if (
Kind == CK_ArrayToPointerDecay) {
666 E = Materialized.
get();
677 if (
const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
678 if (
const auto *VD = dyn_cast<VarDecl>(DRE->getDecl())) {
690 if (ImpCast->getCastKind() ==
Kind && (!BasePath || BasePath->empty())) {
691 ImpCast->setType(Ty);
692 ImpCast->setValueKind(VK);
716 llvm_unreachable(
"unknown scalar type kind");
727 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
731 for (
const auto *Spec : Template->specializations())
738 if (FD->hasBody(DeclToCheck))
744 if (DeclToCheck != FD)
748 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
754 if (VD->isReferenced() &&
755 VD->mightBeUsableInConstantExpressions(SemaRef->
Context))
761 for (
const auto *Spec : Template->specializations())
774 if (DeclToCheck != VD)
782 if (
auto *FD = dyn_cast<FunctionDecl>(ND))
783 return FD->isExternC();
784 return cast<VarDecl>(ND)->isExternC();
809 if (ND->
hasAttr<WeakRefAttr>())
continue;
811 if (isa<CXXDeductionGuideDecl>(ND))
814 if (ND->
hasAttr<DLLImportAttr>() || ND->
hasAttr<DLLExportAttr>()) {
824 if (FD->isExternallyVisible() &&
826 !FD->getMostRecentDecl()->isInlined() &&
827 !FD->hasAttr<ExcludeFromExplicitInstantiationAttr>())
829 if (FD->getBuiltinID())
832 auto *VD = cast<VarDecl>(ND);
835 if (VD->isExternallyVisible() &&
837 !VD->getMostRecentDecl()->isInline() &&
838 !VD->hasAttr<ExcludeFromExplicitInstantiationAttr>())
843 if (VD->isKnownToBeDefined())
847 Undefined.push_back(std::make_pair(ND, UndefinedUse.second));
859 if (Undefined.empty())
return;
861 for (
auto Undef : Undefined) {
862 ValueDecl *VD = cast<ValueDecl>(Undef.first);
876 ? diag::ext_undefined_internal_type
877 : diag::err_undefined_internal_type)
878 << isa<VarDecl>(VD) << VD;
883 bool IsImplicitBase =
false;
884 if (
const auto *BaseD = dyn_cast<FunctionDecl>(VD)) {
885 auto *DVAttr = BaseD->
getAttr<OMPDeclareVariantAttr>();
886 if (DVAttr && !DVAttr->getTraitInfo().isExtensionActive(
887 llvm::omp::TraitProperty::
888 implementation_extension_disable_implicit_base)) {
889 const auto *Func = cast<FunctionDecl>(
890 cast<DeclRefExpr>(DVAttr->getVariantFuncRef())->getDecl());
891 IsImplicitBase = BaseD->isImplicit() &&
892 Func->getIdentifier()->isMangledOpenMPVariantName();
897 << isa<VarDecl>(VD) << VD;
898 }
else if (
auto *FD = dyn_cast<FunctionDecl>(VD)) {
900 assert(FD->getMostRecentDecl()->isInlined() &&
901 "used object requires definition but isn't inline or internal?");
905 assert(cast<VarDecl>(VD)->getMostRecentDecl()->isInline() &&
906 "used var requires definition but isn't inline or internal?");
910 S.
Diag(UseLoc, diag::note_used_here);
921 ExternalSource->ReadWeakUndeclaredIdentifiers(WeakIDs);
922 for (
auto &WeakID : WeakIDs)
936 RecordCompleteMap::iterator
Cache = MNCComplete.find(RD);
937 if (
Cache != MNCComplete.end())
938 return Cache->second;
941 bool Complete =
true;
944 I != E && Complete; ++I) {
946 Complete = M->isDefined() || M->isDefaulted() ||
947 (M->isPure() && !isa<CXXDestructorDecl>(M));
953 Complete = !F->getTemplatedDecl()->isLateTemplateParsed() &&
954 F->getTemplatedDecl()->isDefined();
955 else if (
const CXXRecordDecl *R = dyn_cast<CXXRecordDecl>(*I)) {
956 if (R->isInjectedClassName())
958 if (R->hasDefinition())
965 MNCComplete[RD] = Complete;
979 RecordCompleteMap::iterator
Cache = RecordsComplete.find(RD);
980 if (
Cache != RecordsComplete.end())
981 return Cache->second;
985 I != E && Complete; ++I) {
989 if (
CXXRecordDecl *FriendD = TSI->getType()->getAsCXXRecordDecl())
996 dyn_cast<FunctionDecl>((*I)->getFriendDecl()))
997 Complete = FD->isDefined();
1003 RecordsComplete[RD] = Complete;
1009 ExternalSource->ReadUnusedLocalTypedefNameCandidates(
1012 if (TD->isReferenced())
1014 Diag(TD->getLocation(), diag::warn_unused_local_typedef)
1015 << isa<TypeAliasDecl>(TD) << TD->getDeclName();
1026 HandleStartOfHeaderUnit();
1035 ModuleScopes.back().ImplicitGlobalModuleFragment =
true;
1041 if (
Kind == TUFragmentKind::Global)
1072 if (ExternalSource) {
1075 ExternalSource->ReadPendingInstantiations(Pending);
1076 for (
auto PII : Pending)
1077 if (
auto Func = dyn_cast<FunctionDecl>(PII.first))
1078 Func->setInstantiationIsPending(
true);
1080 Pending.begin(), Pending.end());
1084 llvm::TimeTraceScope TimeScope(
"PerformPendingInstantiations");
1091 "end of TU template instantiation should not create more "
1092 "late-parsed templates");
1097 for (
const auto &Typo : DelayedTypos) {
1101 DelayedTypos.clear();
1109 &&
"reached end of translation unit with a pool attached?");
1122 !ModuleScopes.empty() && ModuleScopes.back().Module->Kind ==
1124 ? TUFragmentKind::Private
1125 : TUFragmentKind::Normal);
1142 if (
LangOpts.PCHInstantiateTemplates) {
1143 llvm::TimeTraceScope TimeScope(
"PerformPendingInstantiations");
1166 return ShouldRemoveFromUnused(this, DD);
1180 if (WeakIDs.second.empty())
1185 if (PrevDecl !=
nullptr &&
1186 !(isa<FunctionDecl>(PrevDecl) || isa<VarDecl>(PrevDecl)))
1187 for (
const auto &WI : WeakIDs.second)
1188 Diag(WI.getLocation(), diag::warn_attribute_wrong_decl_type)
1191 for (
const auto &WI : WeakIDs.second)
1192 Diag(WI.getLocation(), diag::warn_weak_identifier_undeclared)
1207 bool DiagnosedMissingModuleDeclaration =
false;
1208 if (!ModuleScopes.empty() &&
1210 !ModuleScopes.back().ImplicitGlobalModuleFragment) {
1211 Diag(ModuleScopes.back().BeginLoc,
1212 diag::err_module_declaration_missing_after_global_module_introducer);
1213 DiagnosedMissingModuleDeclaration =
true;
1221 !isCurrentModulePurview() && !DiagnosedMissingModuleDeclaration) {
1225 diag::err_module_declaration_missing);
1234 Stack.push_back(CurrentModule);
1235 while (!Stack.empty()) {
1236 Module *Mod = Stack.pop_back_val();
1259 if (!PendingInlineFuncDecls.empty()) {
1260 for (
auto *D : PendingInlineFuncDecls) {
1261 if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
1262 bool DefInPMF =
false;
1263 if (
auto *FDD = FD->getDefinition()) {
1264 assert(FDD->getOwningModule() &&
1265 FDD->getOwningModule()->isModulePurview());
1266 DefInPMF = FDD->getOwningModule()->isPrivateModule();
1270 Diag(FD->getLocation(), diag::err_export_inline_not_defined)
1275 Diag(ModuleScopes.back().BeginLoc,
1276 diag::note_private_module_fragment);
1280 PendingInlineFuncDecls.clear();
1294 llvm::SmallSet<VarDecl *, 32> Seen;
1295 for (TentativeDefinitionsType::iterator
1316 diag::err_tentative_def_incomplete_type))
1328 if (!D || D->isInvalidDecl() || D->getPreviousDecl() || !D->isUsed())
1340 for (UnusedFileScopedDeclsType::iterator
1347 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(*I)) {
1349 if (!FD->hasBody(DiagD))
1354 if (isa<CXXMethodDecl>(DiagD))
1358 if (FD->getStorageClass() ==
SC_Static &&
1359 !FD->isInlineSpecified() &&
1363 diag::warn_unneeded_static_internal_decl)
1370 if (FD->getDescribedFunctionTemplate())
1375 ? diag::warn_unused_member_function
1376 : diag::warn_unused_function)
1382 DiagD = cast<VarDecl>(*I);
1424 ExternalSource->ReadMismatchingDeleteExpressions(
DeleteExprs);
1425 for (
const auto &DeletedFieldInfo :
DeleteExprs) {
1427 AnalyzeDeleteExprMismatch(DeletedFieldInfo.first,
DeleteExprLoc.first,
1437 "Didn't unmark var as having its initializer parsed");
1452 if (isa<BlockDecl>(DC) || isa<EnumDecl>(DC) || isa<CapturedDecl>(DC) ||
1453 isa<RequiresExprBodyDecl>(DC)) {
1455 }
else if (!AllowLambda && isa<CXXMethodDecl>(DC) &&
1456 cast<CXXMethodDecl>(DC)->getOverloadedOperator() == OO_Call &&
1457 cast<CXXRecordDecl>(DC->
getParent())->isLambda()) {
1470 return dyn_cast<FunctionDecl>(DC);
1475 while (isa<RecordDecl>(DC))
1477 return dyn_cast<ObjCMethodDecl>(DC);
1482 if (isa<ObjCMethodDecl>(DC) || isa<FunctionDecl>(DC))
1483 return cast<NamedDecl>(DC);
1501 if (std::optional<TemplateDeductionInfo *> Info =
isSFINAEContext()) {
1515 if (*Info && !(*Info)->hasSFINAEDiagnostic()) {
1517 (*Info)->addSFINAEDiagnostic(DiagInfo.
getLocation(),
1540 if (*Info && !(*Info)->hasSFINAEDiagnostic()) {
1542 (*Info)->addSFINAEDiagnostic(DiagInfo.
getLocation(),
1551 Diag(Loc, diag::warn_cxx98_compat_sfinae_access_control);
1564 (*Info)->addSuppressedDiagnostic(DiagInfo.
getLocation(),
1599 auto *FD = dyn_cast<FunctionDecl>(
CurContext);
1605 for (
auto PDAt : Loc->second) {
1621 S.
Diags.
Report(FnIt->second.Loc, diag::note_called_by));
1622 Builder << FnIt->second.FD;
1656 class DeferredDiagnosticsEmitter
1674 bool ShouldEmitRootNode;
1679 unsigned InOMPDeviceContext;
1681 DeferredDiagnosticsEmitter(
Sema &S)
1682 : Inherited(S), ShouldEmitRootNode(
false), InOMPDeviceContext(0) {}
1684 bool shouldVisitDiscardedStmt()
const {
return false; }
1687 ++InOMPDeviceContext;
1688 Inherited::VisitOMPTargetDirective(
Node);
1689 --InOMPDeviceContext;
1693 if (isa<VarDecl>(D))
1695 if (
auto *FD = dyn_cast<FunctionDecl>(D))
1698 Inherited::visitUsedDecl(Loc, D);
1703 "Should only check file-scope variables");
1704 if (
auto *Init = VD->
getInit()) {
1705 auto DevTy = OMPDeclareTargetDeclAttr::getDeviceType(VD);
1706 bool IsDev = DevTy && (*DevTy == OMPDeclareTargetDeclAttr::DT_NoHost ||
1707 *DevTy == OMPDeclareTargetDeclAttr::DT_Any);
1709 ++InOMPDeviceContext;
1712 --InOMPDeviceContext;
1717 auto &Done = DoneMap[InOMPDeviceContext > 0 ? 1 : 0];
1718 FunctionDecl *Caller = UsePath.empty() ? nullptr : UsePath.back();
1719 if ((!ShouldEmitRootNode && !S.
getLangOpts().OpenMP && !Caller) ||
1723 if (Caller && S.
LangOpts.OpenMP && UsePath.size() == 1 &&
1724 (ShouldEmitRootNode || InOMPDeviceContext))
1731 if (ShouldEmitRootNode || InOMPDeviceContext)
1732 emitDeferredDiags(FD, Caller);
1735 if (!Done.insert(FD).second)
1737 InUsePath.insert(FD);
1738 UsePath.push_back(FD);
1739 if (
auto *S = FD->
getBody()) {
1743 InUsePath.erase(FD);
1746 void checkRecordedDecl(
Decl *D) {
1747 if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
1752 checkVar(cast<VarDecl>(D));
1756 void emitDeferredDiags(
FunctionDecl *FD,
bool ShowCallStack) {
1760 bool HasWarningOrError =
false;
1761 bool FirstDiag =
true;
1768 HasWarningOrError |=
1777 if (FirstDiag && HasWarningOrError && ShowCallStack) {
1788 ExternalSource->ReadDeclsToCheckForDeferredDiags(
1789 DeclsToCheckForDeferredDiags);
1792 DeclsToCheckForDeferredDiags.empty())
1795 DeferredDiagnosticsEmitter DDE(*
this);
1796 for (
auto *D : DeclsToCheckForDeferredDiags)
1797 DDE.checkRecordedDecl(D);
1827 : S(S), Loc(Loc), DiagID(DiagID), Fn(Fn),
1828 ShowCallStack(K == K_ImmediateWithCallStack || K == K_Deferred) {
1834 ImmediateDiag.emplace(
1838 assert(Fn &&
"Must have a function to attach the deferred diag to.");
1840 PartialDiagId.emplace(
Diags.size());
1847 : S(D.S), Loc(D.Loc), DiagID(D.DiagID), Fn(D.Fn),
1848 ShowCallStack(D.ShowCallStack), ImmediateDiag(D.ImmediateDiag),
1849 PartialDiagId(D.PartialDiagId) {
1851 D.ShowCallStack =
false;
1852 D.ImmediateDiag.reset();
1853 D.PartialDiagId.reset();
1857 if (ImmediateDiag) {
1862 ImmediateDiag.reset();
1863 if (IsWarningOrError && ShowCallStack)
1866 assert((!PartialDiagId || ShowCallStack) &&
1867 "Must always show call stack for deferred diags.");
1894 auto SetIsLastErrorImmediate = [&](
bool Flag) {
1899 SetIsLastErrorImmediate(
true);
1928 if (
const auto *MD = dyn_cast<CXXMethodDecl>(C)) {
1929 if ((MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator()) &&
1933 if (
const auto *Ctor = dyn_cast<CXXConstructorDecl>(MD))
1934 if (Ctor->isCopyOrMoveConstructor() && Ctor->isTrivial())
1940 FunctionDecl *FD = isa<FunctionDecl>(C) ? cast<FunctionDecl>(C)
1941 : dyn_cast_or_null<FunctionDecl>(D);
1943 auto CheckDeviceType = [&](
QualType Ty) {
1955 <<
false << 0 <<
false
1963 bool LongDoubleMismatched =
false;
1966 if ((&Sem != &llvm::APFloat::PPCDoubleDouble() &&
1968 (&Sem == &llvm::APFloat::PPCDoubleDouble() &&
1970 LongDoubleMismatched =
true;
1980 LongDoubleMismatched) {
1992 D->setInvalidDecl();
1995 targetDiag(D->getLocation(), diag::note_defined_here, FD) << D;
1999 auto CheckType = [&](
QualType Ty,
bool IsRetTy =
false) {
2002 CheckDeviceType(Ty);
2013 if (
Diag(Loc, PD, FD)
2014 <<
false << 0 << Ty <<
false
2017 D->setInvalidDecl();
2020 targetDiag(D->getLocation(), diag::note_defined_here, FD) << D;
2025 if (IsRetTy && !TI.
hasFPReturn() && (IsDouble || IsFloat)) {
2032 if (
Diag(Loc, PD, FD)
2033 <<
false << 0 << Ty <<
true
2036 D->setInvalidDecl();
2039 targetDiag(D->getLocation(), diag::note_defined_here, FD) << D;
2044 llvm::StringMap<bool> CallerFeatureMap;
2047 "sve", CallerFeatureMap))
2053 if (
const auto *FPTy = dyn_cast<FunctionProtoType>(Ty)) {
2054 for (
const auto &ParamTy : FPTy->param_types())
2056 CheckType(FPTy->getReturnType(),
true);
2058 if (
const auto *FNPTy = dyn_cast<FunctionNoProtoType>(Ty))
2059 CheckType(FNPTy->getReturnType(),
true);
2122 pushOpenMPFunctionRegion();
2127 BlockScope,
Block));
2138 LSI->AutoTemplateParameterDepth =
Depth;
2142 "Remove assertion if intentionally called in a non-lambda context.");
2169 if (!Result.isInvalid()) {
2189 VarDecl *VD = BC.getVariable();
2190 if (VD->
hasAttr<BlocksAttr>()) {
2199 QualType CapType = BC.getVariable()->getType();
2240 popOpenMPFunctionRegion(
Scope.get());
2246 for (
const auto &PUD :
Scope->PossiblyUnreachableDiags)
2247 Diag(PUD.Loc, PUD.PD);
2255 if (
Scope->isPlainFunction() && !Self->CachedFunctionScope)
2256 Self->CachedFunctionScope.reset(
Scope);
2268 assert(!CurFunction->
CompoundScopes.empty() &&
"mismatched push/pop");
2304 if (CurBSI && CurBSI->TheDecl &&
2328 if (
auto *LSI = dyn_cast<sema::LambdaScopeInfo>(
Scope)) {
2329 if (LSI->Lambda && !LSI->Lambda->Encloses(
CurContext)) {
2347 if (IgnoreNonLambdaCapturingScope) {
2349 while (I != E && isa<CapturingScopeInfo>(*I) && !isa<LambdaScopeInfo>(*I))
2354 auto *CurLSI = dyn_cast<LambdaScopeInfo>(*I);
2355 if (CurLSI && CurLSI->Lambda &&
2369 return (LSI->TemplateParams.size() ||
2370 LSI->GLTemplateParameterList) ? LSI :
nullptr;
2377 if (!
LangOpts.RetainCommentsFromSystemHeaders &&
2384 StringRef MagicMarkerText;
2387 MagicMarkerText =
"///<";
2390 MagicMarkerText =
"/**<";
2393 llvm_unreachable(
"if this is an almost Doxygen comment, "
2394 "it should be ordinary");
2396 Diag(Comment.
getBegin(), diag::warn_not_a_doxygen_trailing_member_comment) <<
2404 char ExternalSemaSource::ID;
2414 llvm::MapVector<NamedDecl *, SourceLocation> &Undefined) {}
2433 OverloadSet.
clear();
2436 bool IsMemExpr =
false;
2446 Overloads = dyn_cast<UnresolvedMemberExpr>(E.
IgnoreParens());
2450 bool Ambiguous =
false;
2455 DeclsEnd = Overloads->
decls_end(); it != DeclsEnd; ++it) {
2463 = dyn_cast<FunctionDecl>((*it)->getUnderlyingDecl())) {
2464 if (OverloadDecl->getMinRequiredArguments() == 0) {
2465 if (!ZeroArgCallReturnTy.
isNull() && !Ambiguous &&
2466 (!IsMV || !(OverloadDecl->isCPUDispatchMultiVersion() ||
2467 OverloadDecl->isCPUSpecificMultiVersion()))) {
2471 ZeroArgCallReturnTy = OverloadDecl->getReturnType();
2472 IsMV = OverloadDecl->isCPUDispatchMultiVersion() ||
2473 OverloadDecl->isCPUSpecificMultiVersion();
2481 return !ZeroArgCallReturnTy.
isNull();
2499 if (
const FunctionDecl *Fun = dyn_cast<FunctionDecl>(DeclRef->getDecl())) {
2500 if (Fun->getMinRequiredArguments() == 0)
2501 ZeroArgCallReturnTy = Fun->getReturnType();
2517 dyn_cast_or_null<FunctionProtoType>(FunTy)) {
2518 if (FPT->getNumParams() == 0)
2539 unsigned ShownOverloads = 0;
2540 unsigned SuppressedOverloads = 0;
2542 DeclsEnd = Overloads.
end(); It != DeclsEnd; ++It) {
2544 ++SuppressedOverloads;
2552 !FD->
getAttr<TargetAttr>()->isDefaultVersion())
2555 !FD->
getAttr<TargetVersionAttr>()->isDefaultVersion())
2564 if (SuppressedOverloads)
2565 S.
Diag(FinalNoteLoc, diag::note_ovl_too_many_candidates)
2566 << SuppressedOverloads;
2571 bool (*IsPlausibleResult)(
QualType)) {
2572 if (!IsPlausibleResult)
2577 DeclsEnd = Overloads.
end(); It != DeclsEnd; ++It) {
2578 const FunctionDecl *OverloadDecl = cast<FunctionDecl>(*It);
2580 if (IsPlausibleResult(OverloadResultTy))
2581 PlausibleOverloads.
addDecl(It.getDecl());
2592 return (!isa<CStyleCastExpr>(E) &&
2593 !isa<UnaryOperator>(E) &&
2594 !isa<BinaryOperator>(E) &&
2595 !isa<CXXOperatorCallExpr>(E));
2599 if (
const auto *UO = dyn_cast<UnaryOperator>(E))
2600 E = UO->getSubExpr();
2602 if (
const auto *ULE = dyn_cast<UnresolvedLookupExpr>(E)) {
2603 if (ULE->getNumDecls() == 0)
2606 const NamedDecl *ND = *ULE->decls_begin();
2607 if (
const auto *FD = dyn_cast<FunctionDecl>(ND))
2615 bool (*IsPlausibleResult)(
QualType)) {
2625 !ZeroArgCallTy.
isNull() &&
2626 (!IsPlausibleResult || IsPlausibleResult(ZeroArgCallTy))) {
2633 Diag(Loc, PD) << 1 << IsMV << Range
2644 Range.getEnd().getLocWithOffset(1));
2648 if (!ForceComplain)
return false;
2651 Diag(Loc, PD) << 0 << IsMV << Range;
2665 if (!Ident___float128)
2667 return Ident___float128;
2672 unsigned OpenMPCaptureLevel) {
2676 OpenMPCaptureLevel);
2688 const llvm::MapVector<FieldDecl *, Sema::DeleteLocs> &
2696 OldEvalMethod(S.
PP.getCurrentFPEvalMethod()),
2697 OldFPPragmaLocation(S.
PP.getLastFPEvalPragmaLocation()) {}
2707 "can only be called for qualified names");
2717 bool Result = std::all_of(LR.begin(), LR.end(), [](
Decl *Dcl) {
2718 if (NamedDecl *ND = dyn_cast<NamedDecl>(Dcl)) {
2719 ND = ND->getUnderlyingDecl();
2720 return isa<FunctionDecl>(ND) || isa<FunctionTemplateDecl>(ND) ||
unsigned EntireContentsOfLargeArray
Whether to print the entire array initializers, especially on non-type template parameters,...
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type.
bool hasAnyUnrecoverableErrorsInThisFunction() const
Determine whether any errors occurred within this function/method/ block.
llvm::DenseMap< const CXXRecordDecl *, bool > RecordCompleteMap
void CheckDelayedMemberExceptionSpecs()
static bool isDeferrable(unsigned DiagID)
Whether the diagnostic message can be deferred.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
bool resolveConflicts(Module *Mod, bool Complain)
Resolve all of the unresolved conflicts in the given module.
std::optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
void getUndefinedButUsed(SmallVectorImpl< std::pair< NamedDecl *, SourceLocation > > &Undefined)
Obtain a sorted list of functions that are undefined but ODR-used.
void setFunctionHasIndirectGoto()
DeclarationName VAListTagName
VAListTagName - The declaration name corresponding to __va_list_tag.
void warnStackExhausted(SourceLocation Loc)
Warn that the stack is nearly exhausted.
bool isDefaulted() const
Whether this function is defaulted.
DeclGroupPtrTy ActOnGlobalModuleFragmentDecl(SourceLocation ModuleLoc)
The parser has processed a global-module-fragment declaration that begins the definition of the globa...
A class which encapsulates the logic for delaying diagnostics during parsing and other processing.
decl_iterator decls_end() const
virtual void updateOutOfDateSelector(Selector Sel)
Load the contents of the global method pool for a given selector if necessary.
LangOptions::FPEvalMethodKind getCurrentFPEvalMethod() const
bool resolveUses(Module *Mod, bool Complain)
Resolve all of the unresolved uses in the given module.
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
@ CMK_ModuleInterface
Compiling a C++ modules interface unit.
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
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...
TypedefDecl * getInt128Decl() const
Retrieve the declaration for the 128-bit signed integer type.
void SetArgToStringFn(ArgToStringFnTy Fn, void *Cookie)
bool isFileVarDecl() const
Returns true for file scoped variable declaration.
bool isExternalWithNoLinkageType(ValueDecl *VD)
Determine if VD, which must be a variable or function, is an external symbol that nonetheless can't b...
SmallVector< CXXMethodDecl *, 4 > DelayedDllExportMemberFunctions
A little helper class used to produce diagnostics.
CanQualType OCLReserveIDTy
const TranslationUnitKind TUKind
The kind of translation unit we are processing.
bool DeferDiags
Whether deferrable diagnostics should be deferred.
QualType getReturnType() const
A set of unresolved declarations.
unsigned getOpenCLCompatibleVersion() const
Return the OpenCL version that kernel language is compatible with.
RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=TTK_Struct) const
Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.
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...
A trivial tuple used to represent a source range.
void ActOnEndOfTranslationUnit()
ActOnEndOfTranslationUnit - This is called at the very end of the translation unit when EOF is reache...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *) const
Simple class containing the result of Sema::CorrectTypo.
bool isFloat16Type() const
void erase(iterator From, iterator To)
bool isIncrementalProcessingEnabled() const
Returns true if incremental processing is enabled.
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.
@ ExpectedVariableOrFunction
ASTContext & getASTContext() const
void FreeVisContext()
FreeVisContext - Deallocate and null out VisContext.
bool isConstQualified() const
Determine whether this type is const-qualified.
sema::FunctionScopeInfo * getCurFunction() const
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
SourceManager & SourceMgr
void FileChanged(SourceLocation Loc, FileChangeReason Reason, SrcMgr::CharacteristicKind FileType, FileID PrevFID) override
Callback invoked whenever a source file is entered or exited.
iterator begin(DeclarationName Name)
begin - Returns an iterator for decls with the name 'Name'.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
threadSafety::BeforeSet * ThreadSafetyDeclCache
bool isInMainFile(SourceLocation Loc) const
Returns whether the PresumedLoc for a given SourceLocation is in the main file.
bool isDeleted() const
Whether this function has been deleted.
bool isExternallyVisible() const
llvm::TinyPtrVector< VarDecl * > ByrefBlockVars
The set of __block variables that are introduced in this function.
RedeclarationKind forRedeclarationInCurContext()
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Encodes a location in the source.
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
const TranslationUnitKind TUKind
The kind of translation unit we are processing.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
sema::AnalysisBasedWarnings AnalysisWarnings
Worker object for performing CFG-based warnings.
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
This interface provides a way to observe the actions of the preprocessor as it does its thing.
This represents a decl that may have a name.
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
SourceLocation getBegin() const
sema::FunctionScopeInfo * getEnclosingFunction() const
friend_iterator friend_begin() const
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
void DiagnoseUnterminatedPragmaAttribute()
bool findMacroSpelling(SourceLocation &loc, StringRef name)
Looks through the macro-expansion chain for the given location, looking for a macro expansion with th...
static bool isFunctionOrVarDeclExternC(NamedDecl *ND)
PragmaStack< FPOptionsOverride > FpPragmaStack
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
virtual bool hasLongDoubleType() const
Determine whether the long double type is supported on this target.
A (possibly-)qualified type.
LateTemplateParserCleanupCB * LateTemplateParserCleanup
submodule_iterator submodule_begin()
IdentifierInfo * getIdentifier() const
virtual void ReadMismatchingDeleteExpressions(llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 >> &)
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
The iterator over UnresolvedSets.
QualType getCanonicalType() const
Represents a member of a struct/union/class.
Represents the results of name lookup.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
Exposes information about the current target.
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
MaterializeTemporaryExpr * CreateMaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference)
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
const TargetInfo * getAuxTargetInfo() const
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
void addComment(const RawComment &RC)
unsigned getNumOverloadCandidatesToShow() const
When a call or operator fails, print out up to this many candidate overloads as suggestions.
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
virtual bool hasFloat16Type() const
Determine whether the _Float16 type is supported on this target.
SourceManager & getSourceManager() const
SmallVector< PendingImplicitInstantiation, 1 > LateParsedInstantiations
Queue of implicit template instantiations that cannot be performed eagerly.
FriendSpecified isFriendSpecified() const
bool isRealFloatingType() const
Floating point categories.
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
CapturedRegionKind
The different kinds of captured statement.
std::unique_ptr< sema::FunctionScopeInfo > CachedFunctionScope
void setFunctionHasMustTail()
Encapsulates the data about a macro definition (e.g.
void setLastDiagnosticIgnored(bool Ignored)
Pretend that the last diagnostic issued was ignored, so any subsequent notes will be suppressed,...
static void emitCallStackNotes(Sema &S, FunctionDecl *FD)
CharacteristicKind
Indicates whether a file or directory holds normal user code, system code, or system code which is im...
ExprResult BuildCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallExpr - Handle a call to Fn with the specified array of arguments.
static bool IsRecordFullyDefined(const CXXRecordDecl *RD, RecordCompleteMap &RecordsComplete, RecordCompleteMap &MNCComplete)
Returns true, if the given CXXRecordDecl is fully defined in this translation unit,...
Describes how types, statements, expressions, and declarations should be printed.
ExprResult BuildCallToMemberFunction(Scope *S, Expr *MemExpr, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallToMemberFunction - Build a call to a member function.
static bool isBuiltinNote(unsigned DiagID)
Determine whether the given built-in diagnostic ID is a Note.
FunctionType - C99 6.7.5.3 - Function Declarators.
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
Represents the body of a CapturedStmt, and serves as its DeclContext.
Retains information about a block that is currently being parsed.
sema::CapturedRegionScopeInfo * getCurCapturedRegion()
Retrieve the current captured region, if any.
CXXFieldCollector - Used to keep track of CXXFieldDecls during parsing of C++ classes.
void ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind)
virtual bool hasInt128Type() const
Determine whether the __int128 type is supported on this target.
The name of a declaration.
unsigned Bool
Whether we can use 'bool' rather than '_Bool' (even if the language doesn't actually have 'bool',...
SourceManager & getSourceManager()
std::deque< PendingImplicitInstantiation > PendingInstantiations
The queue of implicit template instantiations that are required but have not yet been performed.
SmallVector< VarDecl *, 4 > ExternalDeclarations
All the external declarations encoutered and used in the TU.
TranslationUnitDecl * getTranslationUnitDecl() const
decls_iterator decls_end() const
bool isReferenced() const
Whether any declaration of this entity was referenced.
Retains information about a captured region.
bool isDeclaratorFunctionLike(Declarator &D)
Determine whether.
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
This class handles loading and caching of source files into memory.
void ActOnTranslationUnitScope(Scope *S)
const LangOptions & getLangOpts() const
static void markEscapingByrefs(const FunctionScopeInfo &FSI, Sema &S)
std::unique_ptr< CXXFieldCollector > FieldCollector
FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
@ TU_Prefix
The translation unit is a prefix to a translation unit, and is not complete.
static FindResult find(Expr *E)
Finds the overloaded expression in the given expression E of OverloadTy.
bool isSVESizelessBuiltinType() const
Returns true for SVE scalable vector types.
~ExternalSemaSource() override
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
bool WarnedStackExhausted
bool isSet() const
Deprecated.
static void checkEscapingByref(VarDecl *VD, Sema &S)
SemaDiagnosticBuilder CUDADiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
CanQualType BoundMemberTy
const LangOptions & getLangOpts() const
ArrayRef< Capture > captures() const
bool doesNotEscape() const
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
IdentifierInfo * getSuperIdentifier() const
DeclContext * getCurLexicalContext() const
llvm::StringMap< bool > & getSupportedOpenCLOpts()
Get supported OpenCL extensions and optional core features.
FunctionDecl * getCurFunctionDecl(bool AllowLambda=false)
Returns a pointer to the innermost enclosing function, or nullptr if the current context is not insid...
@ TU_Module
The translation unit is a module.
virtual bool hasBitIntType() const
Determine whether the _BitInt type is supported on this target.
bool isExternalFormalLinkage(Linkage L)
Declaration of a template function.
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
QualType getUIntPtrType() const
Return a type compatible with "uintptr_t" (C99 7.18.1.4), as defined by the target.
bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, UnresolvedSetImpl &NonTemplateOverloads)
Figure out if an expression could be turned into a call.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
bool isBitIntType() const
sema::LambdaScopeInfo * getEnclosingLambda() const
Get the innermost lambda enclosing the current location, if any.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
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...
An abstract interface that should be implemented by clients that read ASTs and then require further s...
bool isCPUDispatchMultiVersion() const
True if this function is a multiversioned dispatch function as a part of the cpu_specific/cpu_dispatc...
llvm::SmallPtrSet< const BlockDecl *, 1 > Blocks
The set of blocks that are introduced in this function.
Describes a module or submodule.
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
decls_iterator decls_begin() const
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
TentativeDefinitionsType TentativeDefinitions
All the tentative definitions encountered in the TU.
DiagnosticsEngine & getDiagnostics() const
SourceLocation getBeginLoc() const LLVM_READONLY
FPOptionsOverride CurFPFeatureOverrides()
Represents a block literal declaration, which is like an unnamed FunctionDecl.
@ CMK_None
Not compiling a module interface at all.
const IncompleteArrayType * getAsIncompleteArrayType(QualType T) const
bool hasFatalErrorOccurred() const
llvm::DenseMap< CanonicalDeclPtr< FunctionDecl >, std::vector< PartialDiagnosticAt > > DeviceDeferredDiags
Diagnostics that are emitted only if we discover that the given function must be codegen'ed.
bool hasUncompilableErrorOccurred() const
Whether uncompilable error has occurred.
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
bool isNullPtrType() const
Scope - A scope is a transient data structure that is used while parsing the program.
@ K_Nop
Emit no diagnostics.
void * VisContext
VisContext - Manages the stack for #pragma GCC visibility.
bool hasUnrecoverableErrorOccurred() const
Determine whether an unrecoverable error has occurred within this function.
@ K_Immediate
Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
bool hasErrorOccurred() const
static bool isDefaultMappingAsError(unsigned DiagID)
Return true if the specified diagnostic is mapped to errors by default.
Represents difference between two FPOptions values.
bool AccessCheckingSFINAE
When true, access checking violations are treated as SFINAE failures rather than hard errors.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
FileID getMainFileID() const
Returns the FileID of the main source file.
NamedDecl * getCurFunctionOrMethodDecl()
getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method or C function we're in,...
void Clear()
Clear out the current diagnostic.
bool EmitCurrentDiagnostic(bool Force=false)
Emit the current diagnostic and clear the diagnostic state.
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...
const T * getAs() const
Member-template getAs<specific type>'.
bool isInvalidDecl() const
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
void Initialize()
Perform initialization that occurs after the parser has been initialized but before it parses anythin...
static const uint64_t MaximumAlignment
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
@ GlobalModuleFragment
This is a fragment of the global module within some C++ module.
virtual bool hasFloat128Type() const
Determine whether the __float128 type is supported on this target.
bool isEscapingByref() const
Indicates the capture is a __block variable that is captured by a block that can potentially escape (...
static SFINAEResponse getDiagnosticSFINAEResponse(unsigned DiagID)
Determines whether the given built-in diagnostic ID is for an error that is suppressed if it occurs d...
void runWithSufficientStackSpace(llvm::function_ref< void()> Diag, llvm::function_ref< void()> Fn)
Run a given function on a stack with "sufficient" space.
DiagnosticsEngine & Diags
An abstract interface that should be implemented by external AST sources that also provide informatio...
SemaDiagnosticBuilder diagIfOpenMPHostCode(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host cod...
void PushBlockScope(Scope *BlockScope, BlockDecl *Block)
An abstract interface that should be implemented by external AST sources that also provide informatio...
@ SFINAE_Suppress
The diagnostic should be suppressed entirely.
SourceLocation getCurrentDiagLoc() const
ComparisonCategoryType
An enumeration representing the different comparison categories types.
bool isExternallyVisible(Linkage L)
const IntrusiveRefCntPtr< DiagnosticIDs > & getDiagnosticIDs() const
decl_iterator - Iterates through the declarations stored within this context.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
Represents a C++ destructor within a class.
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat, FPOptionsOverride FPO)
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
bool IsLastErrorImmediate
Is the last error level diagnostic immediate.
A set of unresolved declarations.
void overloadCandidatesShown(unsigned N)
Call this after showing N overload candidates.
Represents a variable declaration or definition.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
void deepTypeCheckForSYCLDevice(SourceLocation UsedAt, llvm::DenseSet< QualType > Visited, ValueDecl *DeclToCheck)
@ SFINAE_SubstitutionFailure
The diagnostic should not be reported, but it should cause template argument deduction to fail.
IdentifierInfo * getBoolName() const
Retrieve the identifier 'bool'.
virtual void ReadMethodPool(Selector Sel)
Load the contents of the global method pool for a given selector.
LangAS getDefaultOpenCLPointeeAddrSpace()
Returns default address space based on OpenCL version and enabled features.
@ TTK_Class
The "class" keyword.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
const MacroInfo * getMacroInfo(const IdentifierInfo *II) const
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
FPOptions & getCurFPFeatures()
void checkTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D=nullptr)
Check if the type is allowed to be used for the current target.
bool isInSystemMacro(SourceLocation loc) const
Returns whether Loc is expanded from a macro in a system header.
bool IsHeaderFile
Indicates whether the front-end is explicitly told that the input is a header file (i....
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
SemaDiagnosticBuilder CUDADiagIfHostCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host cod...
CanThrowResult canThrow(const Stmt *E)
LangAS getDefaultCXXMethodAddrSpace() const
Returns default addr space for method qualifiers.
bool HasFormOfMemberPointer
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class.
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
static void checkUndefinedButUsed(Sema &S)
checkUndefinedButUsed - Check for undefined objects with internal linkage or that are inline.
iterator end()
end - Returns an iterator that has 'finished'.
llvm::DenseSet< std::pair< Decl *, unsigned > > InstantiatingSpecializations
Specializations whose definitions are currently being instantiated.
ASTMutationListener * getASTMutationListener() const
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...
OpenCLOptions & getOpenCLOptions()
Cached information about one file (either on disk or in the virtual file system).
virtual void CompleteTentativeDefinition(VarDecl *D)
CompleteTentativeDefinition - Callback invoked at the end of a translation unit to notify the consume...
Custom deleter to allow FunctionScopeInfos to be kept alive for a short time after they've been poppe...
void addExternalSource(ExternalSemaSource *E)
Registers an external source.
Represents a C array with an unspecified size.
bool evaluateRequiredTargetFeatures(llvm::StringRef RequiredFatures, const llvm::StringMap< bool > &TargetFetureMap)
Returns true if the required target features of a builtin function are enabled.
const LangOptions & LangOpts
void LoadExternalWeakUndeclaredIdentifiers()
Load weak undeclared identifiers from the external source.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
sema::LambdaScopeInfo * PushLambdaScope()
NamedDecl * getMostRecentDecl()
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body.
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
virtual void ReadUndefinedButUsed(llvm::MapVector< NamedDecl *, SourceLocation > &Undefined)
Load the set of used but not defined functions or variables with internal linkage,...
SourceLocation getLocForStartOfFile(FileID FID) const
Return the source location corresponding to the first byte of the specified file.
NamedDeclSetType UnusedPrivateFields
Set containing all declared private fields that are not used.
llvm::SmallSetVector< const TypedefNameDecl *, 4 > UnusedLocalTypedefNameCandidates
Set containing all typedefs that are likely unused.
LangAS
Defines the address space values used by the address space qualifier of QualType.
static const unsigned NumNSNumberLiteralMethods
Retains information about a function, method, or block that is currently being parsed.
@ K_Deferred
Create a deferred diagnostic, which is emitted only if the function it's attached to is codegen'ed.
virtual bool hasIbm128Type() const
Determine whether the __ibm128 type is supported on this target.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
sema::LambdaScopeInfo * getCurGenericLambda()
Retrieve the current generic lambda info, if any.
std::pair< SourceLocation, bool > DeleteExprLoc
Delete-expressions to be analyzed at the end of translation unit.
static bool IsCPUDispatchCPUSpecificMultiVersion(const Expr *E)
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
CanQualType UnsignedLongTy
void PerformPendingInstantiations(bool LocalOnly=false)
Performs template instantiation for all implicit template instantiations we have seen until this poin...
llvm::DenseMap< CanonicalDeclPtr< FunctionDecl >, FunctionDeclAndLoc > DeviceKnownEmittedFns
An inverse call graph, mapping known-emitted functions to one of their known-emitted callers (plus th...
Represents a C++ struct/union/class.
FPFeaturesStateRAII(Sema &S)
SemaDiagnosticBuilder SYCLDiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
IdentifierInfo * InventAbbreviatedTemplateParameterTypeName(IdentifierInfo *ParamName, unsigned Index)
Invent a new identifier for parameters of abbreviated templates.
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
const CXXScopeSpec & getCXXScopeSpec() const
getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part...
UnusedFileScopedDeclsType UnusedFileScopedDecls
The set of file scoped decls seen so far that have not been used and must warn if not used.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
CanQualType UnsignedIntTy
IdentifierInfo * getFloat128Identifier() const
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
SemaDiagnosticBuilder diagIfOpenMPDeviceCode(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
@ TemplateParamScope
This is a scope that corresponds to the template parameters of a C++ template.
TypedefDecl * getCFConstantStringDecl() const
bool hasExternalFormalLinkage() const
True if this decl has external linkage.
void Emit(const DiagnosticBuilder &DB) const
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
IdentifierResolver IdResolver
void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD, RecordDecl *RD, CapturedRegionKind K, unsigned OpenMPCaptureLevel=0)
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
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.
const llvm::MapVector< FieldDecl *, DeleteLocs > & getMismatchingDeleteExpressions() const
Retrieves list of suspicious delete-expressions that will be checked at the end of translation unit.
const SourceLocation & getLocation() const
void setBlockVarCopyInit(const VarDecl *VD, Expr *CopyExpr, bool CanThrow)
Set the copy initialization expression of a block var decl.
bool isCodeCompletionEnabled() const
Determine if we are performing code completion.
Represents a prototype with parameter type info, e.g.
virtual void CompleteExternalDeclaration(VarDecl *D)
CompleteExternalDeclaration - Callback invoked at the end of a translation unit to notify the consume...
static void notePlausibleOverloads(Sema &S, SourceLocation Loc, const UnresolvedSetImpl &Overloads, bool(*IsPlausibleResult)(QualType))
bool isMultiVersion() const
True if this function is considered a multiversioned function.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool shouldIgnoreInHostDeviceCheck(FunctionDecl *Callee)
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
const clang::PrintingPolicy & getPrintingPolicy() const
QualType getIntPtrType() const
Return a type compatible with "intptr_t" (C99 7.18.1.4), as defined by the target.
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.
VarDecl * getDefinition(ASTContext &)
Get the real (not just tentative) definition for this declaration.
VarDecl * getActingDefinition()
Get the tentative definition that acts as the real definition in a TU.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool isBFloat16Type() const
void DiagnoseNonDefaultPragmaAlignPack(PragmaAlignPackDiagnoseKind Kind, SourceLocation IncludeLoc)
Decl - This represents one declaration (or definition), e.g.
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.
RAII object that enters a new expression evaluation context.
Represents a ValueDecl that came out of a declarator.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
bool isFloat128Type() const
The information about the darwin SDK that was used during this compilation.
void ActOnComment(SourceRange Comment)
@ PrivateModuleFragment
This is the private module fragment within some C++ module.
@ K_ImmediateWithCallStack
Emit the diagnostic immediately, and, if it's a warning or error, also emit a call stack showing how ...
Sema - This implements semantic analysis and AST building for C.
PartialDiagnostic::DiagStorageAllocator & getDiagAllocator()
Abstract interface for a consumer of code-completion information.
void diagnoseNullableToNonnullConversion(QualType DstType, QualType SrcType, SourceLocation Loc)
Warn if we're implicitly casting from a _Nullable pointer type to a _Nonnull one.
void setCurrentFPEvalMethod(SourceLocation PragmaLoc, LangOptions::FPEvalMethodKind Val)
void DiagnoseUseOfUnimplementedSelectors()
iterator begin(Source *source, bool LocalOnly=false)
SmallVector< CXXRecordDecl *, 4 > DelayedDllExportClasses
llvm::MapVector< FieldDecl *, DeleteLocs > DeleteExprs
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
void setPrintingPolicy(const clang::PrintingPolicy &Policy)
friend_iterator friend_end() const
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
Module * getCurrentModule()
Retrieves the module that we're currently building, if any.
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=NotForRedeclaration)
Look up a name, looking for a single declaration.
const Expr * getInit() const
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
void PrintStats() const
Print out statistics about the semantic analysis.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Abstract interface for a module loader.
One of these records is kept for each identifier that is lexed.
void addImplicitTypedef(StringRef Name, QualType T)
ModuleLoader & getModuleLoader() const
Retrieve the module loader associated with the preprocessor.
void ActOnStartOfTranslationUnit()
This is called before the very first declaration in the translation unit is parsed.
DeclContext * getFunctionLevelDeclContext(bool AllowLambda=false)
If AllowLambda is true, treat lambda as function.
const TargetInfo & getTargetInfo() const
void DiagnoseUnterminatedPragmaAlignPack()
unsigned getDiagID() const
virtual void anchor()
This virtual key function only exists to limit the emission of debug info describing the Sema class.
bool isStructureOrClassType() const
ScalarTypeKind getScalarTypeKind() const
Given that this is a scalar type, classify it.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
A generic diagnostic builder for errors which may or may not be deferred.
void RecordParsingTemplateParameterDepth(unsigned Depth)
This is used to inform Sema what the current TemplateParameterDepth is during Parsing.
Preprocessor & getPreprocessor() const
sema::DelayedDiagnosticPool * getCurrentPool() const
Returns the current delayed-diagnostics pool.
FunctionEmissionStatus getEmissionStatus(FunctionDecl *Decl, bool Final=false)
SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD=nullptr)
TranslationUnitKind
Describes the kind of translation unit being processed.
ObjCMethodDecl - Represents an instance or class method declaration.
bool resolveExports(Module *Mod, bool Complain)
Resolve all of the unresolved exports in the given module.
TypedefDecl * buildImplicitTypedef(QualType T, StringRef Name) const
Create a new implicit TU-level typedef declaration.
void emitAndClearUnusedLocalTypedefWarnings()
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...
Scope * getCurScope() const
Retrieve the parser's current scope.
void DiagnoseUnterminatedOpenMPDeclareTarget()
Report unterminated 'omp declare target' or 'omp begin declare target' at the end of a compilation un...
StringRef getName() const
Return the actual identifier string.
void CheckCompleteVariableDeclaration(VarDecl *VD)
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
void PushFunctionScope()
Enter a new function scope.
void addPPCallbacks(std::unique_ptr< PPCallbacks > C)
SmallVector< CompoundScopeInfo, 4 > CompoundScopes
The stack of currently active compound stamement scopes in the function.
bool isConstantEvaluatedOverride
Used to change context to isConstantEvaluated without pushing a heavy ExpressionEvaluationContextReco...
@ DeclarationOnly
This declaration is only a declaration.
Smart pointer class that efficiently represents Objective-C method names.
Contains information about the compound statement currently being parsed.
void addDecl(NamedDecl *D)
@ NonDefaultStateAtInclude
Scope * getScopeForContext(DeclContext *Ctx)
Determines the active Scope associated with the given declaration context.
Information about one declarator, including the parsed type information and the identifier.
void threadSafetyCleanup(BeforeSet *Cache)
OverloadExpr * Expression
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type.
void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E)
Warn when implicitly casting 0 to nullptr.
StringRef getName() const
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
CanQualType OCLClkEventTy
bool isValid() const
Return true if this is a valid SourceLocation object.
static void noteOverloads(Sema &S, const UnresolvedSetImpl &Overloads, const SourceLocation FinalNoteLoc)
Give notes for a set of overloads.
A container of type source information.
QualType getReturnType() const
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
llvm::BumpPtrAllocator BumpAlloc
submodule_iterator submodule_end()
SourceLocation getBeginLoc() const LLVM_READONLY
bool isIbm128Type() const
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...
void PushCompoundScope(bool IsStmtExpr)
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
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...
This represents '#pragma omp target' directive.
@ RewritingOperatorAsSpaceship
We are rewriting a comparison operator in terms of an operator<=>.
Base class for declarations which introduce a typedef-name.
unsigned getCurrentDiagID() const
static bool IsCallableWithAppend(Expr *E)
Determine whether the given expression can be called by just putting parentheses after it.
@ Nullable
Values of this type can be null.
static InitializedEntity InitializeBlock(SourceLocation BlockVarLoc, QualType Type)
bool hasAArch64SVETypes() const
Returns whether or not the AArch64 SVE built-in types are available on this target.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
static const unsigned MaxAlignmentExponent
The maximum alignment, same as in llvm::Value.
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.
void addSupport(const llvm::StringMap< bool > &FeaturesMap, const LangOptions &Opts)
virtual ASTMutationListener * GetASTMutationListener()
If the consumer is interested in entities getting modified after their initial creation,...
bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const
CommentOptions CommentOpts
Options for parsing comments.
DarwinSDKInfo * getDarwinSDKInfoForAvailabilityChecking()
void setFunctionHasBranchIntoScope()
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
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.
Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc) const
Based on the way the client configured the DiagnosticsEngine object, classify the specified diagnosti...
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]
The Objective-C NSNumber methods used to create NSNumber literals.
const char * getCastKindName() const
std::optional< NullabilityKind > getNullability() const
Determine the nullability of the given type.
@ DeclScope
This is a scope that can contain a declaration.
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.
CastKind
CastKind - The kind of operation required for a conversion.
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
Declaration of a variable template.
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
llvm::SmallPtrSet< const Decl *, 4 > ParsingInitForAutoVars
ParsingInitForAutoVars - a set of declarations with auto types for which we are currently parsing the...
This represents one expression.
virtual bool hasBFloat16Type() const
Determine whether the _BFloat16 type is supported on this target.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
An iterator over the friend declarations of a class.
HeaderSearch & getHeaderSearchInfo() const
A class which contains all the information about a particular captured value.
bool DefineUsedVTables()
Define all of the vtables that have been used in this translation unit and reference any virtual memb...
Expected< std::optional< DarwinSDKInfo > > parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS, StringRef SDKRootPath)
Parse the SDK information from the SDKSettings.json file.
SemaDiagnosticBuilder(Kind K, SourceLocation Loc, unsigned DiagID, FunctionDecl *Fn, Sema &S)
void EmitCurrentDiagnostic(unsigned DiagID)
Cause the active diagnostic on the DiagosticsEngine to be emitted.
void CheckDelegatingCtorCycles()
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
@ NonNull
Values of this type can never be null.
SourceLocation getLocation() const
CheckedConversionKind
The kind of conversion being performed.
virtual bool hasFPReturn() const
Determine whether return of a floating point value is supported on this target.
A reference to a declared variable, function, enum, etc.
Represents a function declaration or definition.
Represents a struct/union/class.
SourceLocation getCaretLocation() const
llvm::MapVector< NamedDecl *, SourceLocation > UndefinedButUsed
UndefinedInternals - all the used, undefined objects which require a definition in this translation u...
ImplicitParamDecl * getContextParam() const
Retrieve the parameter containing captured variables.
void operator()(sema::FunctionScopeInfo *Scope) const
const LangOptions & getLangOpts() const
void setFunctionHasBranchProtectedScope()
IdentifierInfo * getIdentifierInfo(StringRef Name) const
Return information about the specified preprocessor identifier token.
@ CMK_HeaderUnit
Compiling a module header unit.
Linkage getLinkage() const
Determine the linkage of this type.
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
@ SFINAE_Report
The diagnostic should be reported.
bool getSuppressSystemWarnings() const
unsigned NumSFINAEErrors
The number of SFINAE diagnostics that have been trapped.
std::unique_ptr< sema::FunctionScopeInfo, PoppedFunctionScopeDeleter > PoppedFunctionScopePtr
@ SFINAE_AccessControl
The diagnostic is an access-control diagnostic, which will be substitution failures in some contexts ...
bool hasBuiltinMSVaList() const
Returns whether or not type __builtin_ms_va_list type is available on this target.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
bool hasRISCVVTypes() const
Returns whether or not the RISC-V V built-in types are available on this target.
bool makeUnavailableInSystemHeader(SourceLocation loc, UnavailableAttr::ImplicitReason reason)
makeUnavailableInSystemHeader - There is an error in the current context.
void setType(QualType newType)
void IssueWarnings(Policy P, FunctionScopeInfo *fscope, const Decl *D, QualType BlockType)
Represents a static or instance method of a struct/union/class.
DeclContext * getDeclContext()
ASTConsumer & getASTConsumer() const
SmallVector< std::pair< FunctionDecl *, FunctionDecl * >, 2 > DelayedEquivalentExceptionSpecChecks
All the function redeclarations seen during a class definition that had their exception spec checks d...
static bool ShouldRemoveFromUnused(Sema *SemaRef, const DeclaratorDecl *D)
Used to prune the decls of Sema's UnusedFileScopedDecls vector.
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
decl_iterator decls_begin() const