49#include "llvm/ADT/DenseMap.h"
50#include "llvm/ADT/STLExtras.h"
51#include "llvm/ADT/SmallPtrSet.h"
52#include "llvm/Support/TimeProfiler.h"
68 if (!SDKInfo && !WarnedDarwinSDKInfoMissing) {
69 Diag(Loc, diag::warn_missing_sdksettings_for_availability_checking)
71 WarnedDarwinSDKInfoMissing =
true;
77 if (CachedDarwinSDKInfo)
78 return CachedDarwinSDKInfo->get();
82 if (SDKInfo && *SDKInfo) {
83 CachedDarwinSDKInfo = std::make_unique<DarwinSDKInfo>(std::move(**SDKInfo));
84 return CachedDarwinSDKInfo->get();
87 llvm::consumeError(SDKInfo.takeError());
88 CachedDarwinSDKInfo = std::unique_ptr<DarwinSDKInfo>();
95 std::string InventedName;
96 llvm::raw_string_ostream
OS(InventedName);
99 OS <<
"auto:" << Index + 1;
115 Policy.
Bool = BoolMacro->isObjectLike() &&
116 BoolMacro->getNumTokens() == 1 &&
117 BoolMacro->getReplacementToken(0).is(tok::kw__Bool);
146 FileID PrevFID)
override {
154 if (llvm::timeTraceProfilerEnabled()) {
155 const FileEntry *FE =
SM.getFileEntryForID(
SM.getFileID(Loc));
156 llvm::timeTraceProfilerBegin(
157 "Source", FE !=
nullptr ? FE->
getName() : StringRef(
"<unknown>"));
160 IncludeStack.push_back(IncludeLoc);
168 if (!IncludeStack.empty()) {
169 if (llvm::timeTraceProfilerEnabled())
170 llvm::timeTraceProfilerEnd();
174 IncludeStack.pop_back_val());
191 : ExternalSource(nullptr), CurFPFeatures(pp.getLangOpts()),
192 LangOpts(pp.getLangOpts()), PP(pp), Context(ctxt), Consumer(consumer),
193 Diags(PP.getDiagnostics()), SourceMgr(PP.getSourceManager()),
194 CollectStats(
false), CodeCompleter(CodeCompleter), CurContext(nullptr),
195 OriginalLexicalContext(nullptr), MSStructPragmaOn(
false),
196 MSPointerToMemberRepresentationMethod(
197 LangOpts.getMSPointerToMemberRepresentationMethod()),
198 VtorDispStack(LangOpts.getVtorDispMode()),
200 DataSegStack(nullptr), BSSSegStack(nullptr), ConstSegStack(nullptr),
201 CodeSegStack(nullptr), StrictGuardStackCheckStack(
false),
203 VisContext(nullptr), PragmaAttributeCurrentTargetDecl(nullptr),
204 IsBuildingRecoveryCallExpr(
false), LateTemplateParser(nullptr),
205 LateTemplateParserCleanup(nullptr), OpaqueParser(nullptr), IdResolver(pp),
206 StdInitializerList(nullptr),
207 StdCoroutineTraitsCache(nullptr), CXXTypeInfoDecl(nullptr),
208 MSVCGuidDecl(nullptr), StdSourceLocationImplDecl(nullptr),
209 NSNumberDecl(nullptr), NSValueDecl(nullptr), NSStringDecl(nullptr),
210 StringWithUTF8StringMethod(nullptr),
211 ValueWithBytesObjCTypeMethod(nullptr), NSArrayDecl(nullptr),
212 ArrayWithObjectsMethod(nullptr), NSDictionaryDecl(nullptr),
213 DictionaryWithObjectsMethod(nullptr), GlobalNewDeleteDeclared(
false),
214 TUKind(TUKind), NumSFINAEErrors(0),
215 FullyCheckedComparisonCategories(
217 SatisfactionCache(Context), AccessCheckingSFINAE(
false),
218 InNonInstantiationSFINAEContext(
false), NonInstantiationEntries(0),
219 ArgumentPackSubstitutionIndex(-1), CurrentInstantiationScope(nullptr),
220 DisableTypoCorrection(
false), TyposCorrected(0), AnalysisWarnings(*this),
221 ThreadSafetyDeclCache(nullptr), VarDataSharingAttributesStack(nullptr),
222 CurScope(nullptr), Ident_super(nullptr) {
227 LoadedExternalKnownNamespaces =
false;
248 InitDataSharingAttributesStack();
250 std::unique_ptr<sema::SemaPPCallbacks> Callbacks =
251 std::make_unique<sema::SemaPPCallbacks>();
252 SemaPPCallbackHandler = Callbacks.get();
254 SemaPPCallbackHandler->
set(*
this);
270 SC->InitializeSema(*
this);
275 ExternalSema->InitializeSema(*
this);
348 if (OCLCompatibleVersion >= 200) {
377 auto AddPointerSizeDependentTypes = [&]() {
381 auto AtomicPtrDiffT =
390 AddPointerSizeDependentTypes();
398 std::vector<QualType> Atomic64BitTypes;
406 Atomic64BitTypes.push_back(AtomicDoubleT);
415 AddPointerSizeDependentTypes();
420#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
421 if (getOpenCLOptions().isSupported(#Ext, getLangOpts())) { \
422 addImplicitTypedef(#ExtType, Context.Id##Ty); \
424#include "clang/Basic/OpenCLExtensionTypes.def"
428#define SVE_TYPE(Name, Id, SingletonId) \
429 addImplicitTypedef(Name, Context.SingletonId);
430#include "clang/Basic/AArch64SVEACLETypes.def"
434#define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \
435 addImplicitTypedef(#Name, Context.Id##Ty);
436#include "clang/Basic/PPCTypes.def"
437#define PPC_VECTOR_VSX_TYPE(Name, Id, Size) \
438 addImplicitTypedef(#Name, Context.Id##Ty);
439#include "clang/Basic/PPCTypes.def"
443#define RVV_TYPE(Name, Id, SingletonId) \
444 addImplicitTypedef(Name, Context.SingletonId);
445#include "clang/Basic/RISCVVTypes.def"
450#define WASM_TYPE(Name, Id, SingletonId) \
451 addImplicitTypedef(Name, Context.SingletonId);
452#include "clang/Basic/WebAssemblyReferenceTypes.def"
468 "failed to clean up an InstantiatingTemplate?");
483 ExternalSema->ForgetSema();
486 std::vector<ConstraintSatisfaction *> Satisfactions;
487 Satisfactions.reserve(Satisfactions.size());
488 for (
auto &
Node : SatisfactionCache)
489 Satisfactions.push_back(&
Node);
490 for (
auto *
Node : Satisfactions)
496 DestroyDataSharingAttributesStack();
500 SemaPPCallbackHandler->
reset();
506 Diag(Loc, diag::warn_stack_exhausted);
512 llvm::function_ref<
void()> Fn) {
521 UnavailableAttr::ImplicitReason reason) {
524 if (!fn)
return false;
535 if (fn->
hasAttr<UnavailableAttr>())
return true;
537 fn->
addAttr(UnavailableAttr::CreateImplicit(
Context,
"", reason, loc));
551 assert(E &&
"Cannot use with NULL ptr");
553 if (!ExternalSource) {
558 if (
auto *Ex = dyn_cast<MultiplexExternalSemaSource>(ExternalSource))
566 llvm::errs() <<
"\n*** Semantic Analysis Stats:\n";
576 std::optional<NullabilityKind> ExprNullability = SrcType->
getNullability();
581 std::optional<NullabilityKind> TypeNullability = DstType->
getNullability();
585 Diag(Loc, diag::warn_nullability_lost) << SrcType << DstType;
593 if (Kind != CK_NullToPointer && Kind != CK_NullToMemberPointer)
639 (
"can't implicitly cast glvalue to prvalue with this cast "
644 case CK_LValueToRValue:
645 case CK_ArrayToPointerDecay:
646 case CK_FunctionToPointerDecay:
648 case CK_NonAtomicToAtomic:
653 "can't cast prvalue to glvalue");
665 if (Kind == CK_ArrayToPointerDecay) {
674 E = Materialized.
get();
685 if (
const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
686 if (
const auto *VD = dyn_cast<VarDecl>(DRE->getDecl())) {
698 if (ImpCast->getCastKind() == Kind && (!BasePath || BasePath->empty())) {
699 ImpCast->setType(Ty);
700 ImpCast->setValueKind(VK);
724 llvm_unreachable(
"unknown scalar type kind");
735 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
739 for (
const auto *Spec : Template->specializations())
746 if (FD->hasBody(DeclToCheck))
752 if (DeclToCheck != FD)
756 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
762 if (VD->isReferenced() &&
763 VD->mightBeUsableInConstantExpressions(SemaRef->
Context))
769 for (
const auto *Spec : Template->specializations())
782 if (DeclToCheck != VD)
790 if (
const auto *FD = dyn_cast<FunctionDecl>(ND))
791 return FD->isExternC();
792 return cast<VarDecl>(ND)->isExternC();
817 if (ND->
hasAttr<WeakRefAttr>())
continue;
819 if (isa<CXXDeductionGuideDecl>(ND))
822 if (ND->
hasAttr<DLLImportAttr>() || ND->
hasAttr<DLLExportAttr>()) {
832 if (FD->isExternallyVisible() &&
834 !FD->getMostRecentDecl()->isInlined() &&
835 !FD->hasAttr<ExcludeFromExplicitInstantiationAttr>())
837 if (FD->getBuiltinID())
840 auto *VD = cast<VarDecl>(ND);
843 if (VD->isExternallyVisible() &&
845 !VD->getMostRecentDecl()->isInline() &&
846 !VD->hasAttr<ExcludeFromExplicitInstantiationAttr>())
851 if (VD->isKnownToBeDefined())
855 Undefined.push_back(std::make_pair(ND, UndefinedUse.second));
867 if (Undefined.empty())
return;
869 for (
const auto &Undef : Undefined) {
870 ValueDecl *VD = cast<ValueDecl>(Undef.first);
884 ? diag::ext_undefined_internal_type
885 : diag::err_undefined_internal_type)
886 << isa<VarDecl>(VD) << VD;
891 bool IsImplicitBase =
false;
892 if (
const auto *BaseD = dyn_cast<FunctionDecl>(VD)) {
893 auto *DVAttr = BaseD->
getAttr<OMPDeclareVariantAttr>();
894 if (DVAttr && !DVAttr->getTraitInfo().isExtensionActive(
895 llvm::omp::TraitProperty::
896 implementation_extension_disable_implicit_base)) {
897 const auto *Func = cast<FunctionDecl>(
898 cast<DeclRefExpr>(DVAttr->getVariantFuncRef())->getDecl());
899 IsImplicitBase = BaseD->isImplicit() &&
900 Func->getIdentifier()->isMangledOpenMPVariantName();
905 << isa<VarDecl>(VD) << VD;
906 }
else if (
auto *FD = dyn_cast<FunctionDecl>(VD)) {
908 assert(FD->getMostRecentDecl()->isInlined() &&
909 "used object requires definition but isn't inline or internal?");
913 assert(cast<VarDecl>(VD)->getMostRecentDecl()->isInline() &&
914 "used var requires definition but isn't inline or internal?");
918 S.
Diag(UseLoc, diag::note_used_here);
929 ExternalSource->ReadWeakUndeclaredIdentifiers(WeakIDs);
930 for (
auto &WeakID : WeakIDs)
944 RecordCompleteMap::iterator
Cache = MNCComplete.find(RD);
945 if (
Cache != MNCComplete.end())
946 return Cache->second;
949 bool Complete =
true;
952 I != E && Complete; ++I) {
954 Complete = M->isDefined() || M->isDefaulted() ||
955 (M->isPure() && !isa<CXXDestructorDecl>(M));
961 Complete = !F->getTemplatedDecl()->isLateTemplateParsed() &&
962 F->getTemplatedDecl()->isDefined();
963 else if (
const CXXRecordDecl *R = dyn_cast<CXXRecordDecl>(*I)) {
964 if (R->isInjectedClassName())
966 if (R->hasDefinition())
973 MNCComplete[RD] = Complete;
987 RecordCompleteMap::iterator
Cache = RecordsComplete.find(RD);
988 if (
Cache != RecordsComplete.end())
989 return Cache->second;
993 I != E && Complete; ++I) {
997 if (
CXXRecordDecl *FriendD = TSI->getType()->getAsCXXRecordDecl())
1004 dyn_cast<FunctionDecl>((*I)->getFriendDecl()))
1005 Complete = FD->isDefined();
1011 RecordsComplete[RD] = Complete;
1017 ExternalSource->ReadUnusedLocalTypedefNameCandidates(
1020 if (TD->isReferenced())
1022 Diag(TD->getLocation(), diag::warn_unused_local_typedef)
1023 << isa<TypeAliasDecl>(TD) << TD->getDeclName();
1034 HandleStartOfHeaderUnit();
1070 if (ExternalSource) {
1073 ExternalSource->ReadPendingInstantiations(Pending);
1074 for (
auto PII : Pending)
1075 if (
auto Func = dyn_cast<FunctionDecl>(PII.first))
1076 Func->setInstantiationIsPending(
true);
1078 Pending.begin(), Pending.end());
1082 llvm::TimeTraceScope TimeScope(
"PerformPendingInstantiations");
1089 "end of TU template instantiation should not create more "
1090 "late-parsed templates");
1095 for (
const auto &Typo : DelayedTypos) {
1099 DelayedTypos.clear();
1107 &&
"reached end of translation unit with a pool attached?");
1120 !ModuleScopes.empty() && ModuleScopes.back().Module->Kind ==
1140 if (
LangOpts.PCHInstantiateTemplates) {
1141 llvm::TimeTraceScope TimeScope(
"PerformPendingInstantiations");
1164 return ShouldRemoveFromUnused(this, DD);
1178 if (WeakIDs.second.empty())
1183 if (PrevDecl !=
nullptr &&
1184 !(isa<FunctionDecl>(PrevDecl) || isa<VarDecl>(PrevDecl)))
1185 for (
const auto &WI : WeakIDs.second)
1186 Diag(WI.getLocation(), diag::warn_attribute_wrong_decl_type)
1189 for (
const auto &WI : WeakIDs.second)
1190 Diag(WI.getLocation(), diag::warn_weak_identifier_undeclared)
1205 bool DiagnosedMissingModuleDeclaration =
false;
1206 if (!ModuleScopes.empty() && ModuleScopes.back().Module->Kind ==
1208 Diag(ModuleScopes.back().BeginLoc,
1209 diag::err_module_declaration_missing_after_global_module_introducer);
1210 DiagnosedMissingModuleDeclaration =
true;
1218 !isCurrentModulePurview() && !DiagnosedMissingModuleDeclaration) {
1222 diag::err_module_declaration_missing);
1231 Stack.push_back(CurrentModule);
1232 while (!Stack.empty()) {
1233 Module *Mod = Stack.pop_back_val();
1245 Stack.append(SubmodulesRange.begin(), SubmodulesRange.end());
1257 if (!PendingInlineFuncDecls.empty()) {
1258 for (
auto *D : PendingInlineFuncDecls) {
1259 if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
1260 bool DefInPMF =
false;
1261 if (
auto *FDD = FD->getDefinition()) {
1262 assert(FDD->getOwningModule() &&
1263 FDD->getOwningModule()->isModulePurview());
1264 DefInPMF = FDD->getOwningModule()->isPrivateModule();
1268 Diag(FD->getLocation(), diag::err_export_inline_not_defined)
1273 Diag(ModuleScopes.back().BeginLoc,
1274 diag::note_private_module_fragment);
1278 PendingInlineFuncDecls.clear();
1292 llvm::SmallSet<VarDecl *, 32> Seen;
1293 for (TentativeDefinitionsType::iterator
1314 diag::err_tentative_def_incomplete_type))
1326 if (!D || D->isInvalidDecl() || D->getPreviousDecl() || !D->isUsed())
1338 for (UnusedFileScopedDeclsType::iterator
1345 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(*I)) {
1347 if (!FD->hasBody(DiagD))
1352 if (isa<CXXMethodDecl>(DiagD))
1356 if (FD->getStorageClass() ==
SC_Static &&
1357 !FD->isInlineSpecified() &&
1361 diag::warn_unneeded_static_internal_decl)
1368 if (FD->getDescribedFunctionTemplate())
1373 ? diag::warn_unused_member_function
1374 : diag::warn_unused_function)
1380 DiagD = cast<VarDecl>(*I);
1409 const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D->getDeclContext());
1412 Diag(D->getLocation(), diag::warn_unused_private_field)
1413 << D->getDeclName();
1420 ExternalSource->ReadMismatchingDeleteExpressions(
DeleteExprs);
1421 for (
const auto &DeletedFieldInfo :
DeleteExprs) {
1423 AnalyzeDeleteExprMismatch(DeletedFieldInfo.first,
DeleteExprLoc.first,
1435 "Didn't unmark var as having its initializer parsed");
1450 if (isa<BlockDecl>(DC) || isa<EnumDecl>(DC) || isa<CapturedDecl>(DC) ||
1451 isa<RequiresExprBodyDecl>(DC)) {
1453 }
else if (!AllowLambda && isa<CXXMethodDecl>(DC) &&
1454 cast<CXXMethodDecl>(DC)->getOverloadedOperator() == OO_Call &&
1455 cast<CXXRecordDecl>(DC->
getParent())->isLambda()) {
1468 return dyn_cast<FunctionDecl>(DC);
1473 while (isa<RecordDecl>(DC))
1475 return dyn_cast<ObjCMethodDecl>(DC);
1480 if (isa<ObjCMethodDecl>(DC) || isa<FunctionDecl>(DC))
1481 return cast<NamedDecl>(DC);
1499 if (std::optional<TemplateDeductionInfo *> Info =
isSFINAEContext()) {
1513 if (*Info && !(*Info)->hasSFINAEDiagnostic()) {
1515 (*Info)->addSFINAEDiagnostic(DiagInfo.
getLocation(),
1538 if (*Info && !(*Info)->hasSFINAEDiagnostic()) {
1540 (*Info)->addSFINAEDiagnostic(DiagInfo.
getLocation(),
1549 Diag(Loc, diag::warn_cxx98_compat_sfinae_access_control);
1562 (*Info)->addSuppressedDiagnostic(DiagInfo.
getLocation(),
1597 auto *FD = dyn_cast<FunctionDecl>(
CurContext);
1603 for (
auto PDAt : Loc->second) {
1619 S.
Diags.
Report(FnIt->second.Loc, diag::note_called_by));
1620 Builder << FnIt->second.FD;
1654class DeferredDiagnosticsEmitter
1672 bool ShouldEmitRootNode;
1677 unsigned InOMPDeviceContext;
1679 DeferredDiagnosticsEmitter(
Sema &S)
1680 : Inherited(S), ShouldEmitRootNode(
false), InOMPDeviceContext(0) {}
1682 bool shouldVisitDiscardedStmt()
const {
return false; }
1685 ++InOMPDeviceContext;
1686 Inherited::VisitOMPTargetDirective(
Node);
1687 --InOMPDeviceContext;
1691 if (isa<VarDecl>(D))
1693 if (
auto *FD = dyn_cast<FunctionDecl>(D))
1696 Inherited::visitUsedDecl(Loc, D);
1701 "Should only check file-scope variables");
1702 if (
auto *Init = VD->
getInit()) {
1703 auto DevTy = OMPDeclareTargetDeclAttr::getDeviceType(VD);
1704 bool IsDev = DevTy && (*DevTy == OMPDeclareTargetDeclAttr::DT_NoHost ||
1705 *DevTy == OMPDeclareTargetDeclAttr::DT_Any);
1707 ++InOMPDeviceContext;
1710 --InOMPDeviceContext;
1715 auto &Done = DoneMap[InOMPDeviceContext > 0 ? 1 : 0];
1716 FunctionDecl *Caller = UsePath.empty() ? nullptr : UsePath.back();
1717 if ((!ShouldEmitRootNode && !S.
getLangOpts().OpenMP && !Caller) ||
1721 if (Caller && S.
LangOpts.OpenMP && UsePath.size() == 1 &&
1722 (ShouldEmitRootNode || InOMPDeviceContext))
1729 if (ShouldEmitRootNode || InOMPDeviceContext)
1730 emitDeferredDiags(FD, Caller);
1733 if (!Done.insert(FD).second)
1735 InUsePath.insert(FD);
1736 UsePath.push_back(FD);
1737 if (
auto *S = FD->
getBody()) {
1741 InUsePath.erase(FD);
1744 void checkRecordedDecl(
Decl *D) {
1745 if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
1747 Sema::FunctionEmissionStatus::Emitted;
1750 checkVar(cast<VarDecl>(D));
1754 void emitDeferredDiags(
FunctionDecl *FD,
bool ShowCallStack) {
1758 bool HasWarningOrError =
false;
1759 bool FirstDiag =
true;
1766 HasWarningOrError |=
1775 if (FirstDiag && HasWarningOrError && ShowCallStack) {
1786 ExternalSource->ReadDeclsToCheckForDeferredDiags(
1787 DeclsToCheckForDeferredDiags);
1790 DeclsToCheckForDeferredDiags.empty())
1793 DeferredDiagnosticsEmitter DDE(*
this);
1794 for (
auto *D : DeclsToCheckForDeferredDiags)
1795 DDE.checkRecordedDecl(D);
1826 : S(S), Loc(Loc), DiagID(DiagID), Fn(Fn),
1827 ShowCallStack(K == K_ImmediateWithCallStack || K == K_Deferred) {
1833 ImmediateDiag.emplace(
1837 assert(Fn &&
"Must have a function to attach the deferred diag to.");
1839 PartialDiagId.emplace(
Diags.size());
1846 : S(D.S), Loc(D.Loc), DiagID(D.DiagID), Fn(D.Fn),
1847 ShowCallStack(D.ShowCallStack), ImmediateDiag(D.ImmediateDiag),
1848 PartialDiagId(D.PartialDiagId) {
1850 D.ShowCallStack =
false;
1851 D.ImmediateDiag.reset();
1852 D.PartialDiagId.reset();
1856 if (ImmediateDiag) {
1861 ImmediateDiag.reset();
1862 if (IsWarningOrError && ShowCallStack)
1865 assert((!PartialDiagId || ShowCallStack) &&
1866 "Must always show call stack for deferred diags.");
1893 auto SetIsLastErrorImmediate = [&](
bool Flag) {
1898 SetIsLastErrorImmediate(
true);
1927 if (
const auto *MD = dyn_cast<CXXMethodDecl>(
C)) {
1928 if ((MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator()) &&
1932 if (
const auto *Ctor = dyn_cast<CXXConstructorDecl>(MD))
1933 if (Ctor->isCopyOrMoveConstructor() && Ctor->isTrivial())
1940 ? 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;
2045 Diag(Loc, diag::err_riscv_type_requires_extension, FD) << Ty <<
"zve64x";
2048 Diag(Loc, diag::err_riscv_type_requires_extension, FD)
2052 Diag(Loc, diag::err_riscv_type_requires_extension, FD) << Ty <<
"zve32f";
2055 Diag(Loc, diag::err_riscv_type_requires_extension, FD) << Ty <<
"zve64d";
2059 llvm::StringMap<bool> CallerFeatureMap;
2062 "sve", CallerFeatureMap))
2068 if (
const auto *FPTy = dyn_cast<FunctionProtoType>(Ty)) {
2069 for (
const auto &ParamTy : FPTy->param_types())
2071 CheckType(FPTy->getReturnType(),
true);
2073 if (
const auto *FNPTy = dyn_cast<FunctionNoProtoType>(Ty))
2074 CheckType(FNPTy->getReturnType(),
true);
2137 pushOpenMPFunctionRegion();
2142 BlockScope,
Block));
2155 LSI->AutoTemplateParameterDepth = Depth;
2159 "Remove assertion if intentionally called in a non-lambda context.");
2186 if (!
Result.isInvalid()) {
2206 VarDecl *VD = BC.getVariable();
2207 if (VD->
hasAttr<BlocksAttr>()) {
2216 QualType CapType = BC.getVariable()->getType();
2257 popOpenMPFunctionRegion(
Scope.get());
2263 for (
const auto &PUD :
Scope->PossiblyUnreachableDiags)
2264 Diag(PUD.Loc, PUD.PD);
2271 if (!
Scope->isPlainFunction())
2272 Self->CapturingFunctionScopes--;
2274 if (
Scope->isPlainFunction() && !Self->CachedFunctionScope)
2275 Self->CachedFunctionScope.reset(
Scope);
2287 assert(!CurFunction->
CompoundScopes.empty() &&
"mismatched push/pop");
2323 if (CurBSI && CurBSI->TheDecl &&
2347 if (
auto *LSI = dyn_cast<sema::LambdaScopeInfo>(
Scope)) {
2348 if (LSI->Lambda && !LSI->Lambda->Encloses(
CurContext) &&
2349 LSI->AfterParameterList) {
2367 if (IgnoreNonLambdaCapturingScope) {
2369 while (I != E && isa<CapturingScopeInfo>(*I) && !isa<LambdaScopeInfo>(*I))
2374 auto *CurLSI = dyn_cast<LambdaScopeInfo>(*I);
2375 if (CurLSI && CurLSI->Lambda && CurLSI->CallOperator &&
2376 !CurLSI->Lambda->Encloses(
CurContext) && CurLSI->AfterParameterList) {
2389 return (LSI->TemplateParams.size() ||
2390 LSI->GLTemplateParameterList) ? LSI :
nullptr;
2397 if (!
LangOpts.RetainCommentsFromSystemHeaders &&
2404 StringRef MagicMarkerText;
2407 MagicMarkerText =
"///<";
2410 MagicMarkerText =
"/**<";
2415 Diag(Comment.
getBegin(), diag::warn_splice_in_doxygen_comment);
2418 llvm_unreachable(
"if this is an almost Doxygen comment, "
2419 "it should be ordinary");
2421 Diag(Comment.
getBegin(), diag::warn_not_a_doxygen_trailing_member_comment) <<
2429char ExternalSemaSource::ID;
2439 llvm::MapVector<NamedDecl *, SourceLocation> &Undefined) {}
2458 OverloadSet.
clear();
2461 bool IsMemExpr =
false;
2471 Overloads = dyn_cast<UnresolvedMemberExpr>(E.
IgnoreParens());
2475 bool Ambiguous =
false;
2480 DeclsEnd = Overloads->
decls_end(); it != DeclsEnd; ++it) {
2488 = dyn_cast<FunctionDecl>((*it)->getUnderlyingDecl())) {
2489 if (OverloadDecl->getMinRequiredArguments() == 0) {
2490 if (!ZeroArgCallReturnTy.
isNull() && !Ambiguous &&
2491 (!IsMV || !(OverloadDecl->isCPUDispatchMultiVersion() ||
2492 OverloadDecl->isCPUSpecificMultiVersion()))) {
2496 ZeroArgCallReturnTy = OverloadDecl->getReturnType();
2497 IsMV = OverloadDecl->isCPUDispatchMultiVersion() ||
2498 OverloadDecl->isCPUSpecificMultiVersion();
2506 return !ZeroArgCallReturnTy.
isNull();
2523 if (
const auto *DeclRef = dyn_cast<DeclRefExpr>(E.
IgnoreParens())) {
2524 if (
const auto *Fun = dyn_cast<FunctionDecl>(DeclRef->getDecl())) {
2525 if (Fun->getMinRequiredArguments() == 0)
2526 ZeroArgCallReturnTy = Fun->getReturnType();
2541 if (
const auto *FPT = dyn_cast_if_present<FunctionProtoType>(FunTy)) {
2542 if (FPT->getNumParams() == 0)
2563 unsigned ShownOverloads = 0;
2564 unsigned SuppressedOverloads = 0;
2566 DeclsEnd = Overloads.
end(); It != DeclsEnd; ++It) {
2568 ++SuppressedOverloads;
2576 !FD->
getAttr<TargetAttr>()->isDefaultVersion())
2579 !FD->
getAttr<TargetVersionAttr>()->isDefaultVersion())
2588 if (SuppressedOverloads)
2589 S.
Diag(FinalNoteLoc, diag::note_ovl_too_many_candidates)
2590 << SuppressedOverloads;
2595 bool (*IsPlausibleResult)(
QualType)) {
2596 if (!IsPlausibleResult)
2601 DeclsEnd = Overloads.
end(); It != DeclsEnd; ++It) {
2602 const auto *OverloadDecl = cast<FunctionDecl>(*It);
2603 QualType OverloadResultTy = OverloadDecl->getReturnType();
2604 if (IsPlausibleResult(OverloadResultTy))
2605 PlausibleOverloads.
addDecl(It.getDecl());
2616 return (!isa<CStyleCastExpr>(E) &&
2617 !isa<UnaryOperator>(E) &&
2618 !isa<BinaryOperator>(E) &&
2619 !isa<CXXOperatorCallExpr>(E));
2623 if (
const auto *UO = dyn_cast<UnaryOperator>(E))
2624 E = UO->getSubExpr();
2626 if (
const auto *ULE = dyn_cast<UnresolvedLookupExpr>(E)) {
2627 if (ULE->getNumDecls() == 0)
2630 const NamedDecl *ND = *ULE->decls_begin();
2631 if (
const auto *FD = dyn_cast<FunctionDecl>(ND))
2639 bool (*IsPlausibleResult)(
QualType)) {
2649 !ZeroArgCallTy.
isNull() &&
2650 (!IsPlausibleResult || IsPlausibleResult(ZeroArgCallTy))) {
2657 Diag(Loc, PD) << 1 << IsMV << Range
2668 Range.getEnd().getLocWithOffset(1));
2672 if (!ForceComplain)
return false;
2675 Diag(Loc, PD) << 0 << IsMV << Range;
2690 unsigned OpenMPCaptureLevel) {
2694 OpenMPCaptureLevel);
2707const llvm::MapVector<FieldDecl *, Sema::DeleteLocs> &
2715 OldEvalMethod(S.
PP.getCurrentFPEvalMethod()),
2716 OldFPPragmaLocation(S.
PP.getLastFPEvalPragmaLocation()) {}
2726 "can only be called for qualified names");
2736 bool Result = std::all_of(LR.begin(), LR.end(), [](
Decl *Dcl) {
2737 if (NamedDecl *ND = dyn_cast<NamedDecl>(Dcl)) {
2738 ND = ND->getUnderlyingDecl();
2739 return isa<FunctionDecl>(ND) || isa<FunctionTemplateDecl>(ND) ||
Defines the clang::ASTContext interface.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the classes clang::DelayedDiagnostic and clang::AccessedEntity.
Defines the clang::Expr interface and subclasses for C++ expressions.
llvm::DenseSet< const void * > Visited
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
Defines the clang::Preprocessor interface.
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.
Defines utilities for dealing with stack allocation and stack space.
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(VarDecl *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 ...
void addComment(const RawComment &RC)
const IncompleteArrayType * getAsIncompleteArrayType(QualType T) const
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
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.
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.
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'.
RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=TTK_Struct) const
Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.
void setPrintingPolicy(const clang::PrintingPolicy &Policy)
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
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
bool isSet() const
Deprecated.
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.
FriendSpecified isFriendSpecified() const
Decl - This represents one declaration (or definition), e.g.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
bool isReferenced() const
Whether any declaration of this entity was referenced.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
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.
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.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
SourceLocation getBeginLoc() const LLVM_READONLY
const CXXScopeSpec & getCXXScopeSpec() const
getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part...
IdentifierInfo * getIdentifier() const
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.
static bool isDeferrable(unsigned DiagID)
Whether the diagnostic message can be deferred.
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
const SourceLocation & getLocation() const
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
void SetArgToStringFn(ArgToStringFnTy Fn, void *Cookie)
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.
SourceLocation getCurrentDiagLoc() const
void Clear()
Clear out the current diagnostic.
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 EmitCurrentDiagnostic(bool Force=false)
Emit the current diagnostic and clear the diagnostic state.
bool getSuppressSystemWarnings() const
unsigned getCurrentDiagID() const
const IntrusiveRefCntPtr< DiagnosticIDs > & getDiagnosticIDs() 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.
Cached information about one file (either on disk or in the virtual file system).
StringRef getName() const
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.
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body.
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)
bool IsHeaderFile
Indicates whether the front-end is explicitly told that the input is a header file (i....
CommentOptions CommentOpts
Options for parsing comments.
@ CMK_HeaderUnit
Compiling a module header unit.
@ CMK_ModuleInterface
Compiling a C++ modules interface unit.
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.
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.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
bool hasExternalFormalLinkage() const
True if this decl has external linkage.
NamedDecl * getMostRecentDecl()
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.
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.
An abstract interface that should be implemented by clients that read ASTs and then require further s...
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
A generic diagnostic builder for errors which may or may not be deferred.
SemaDiagnosticBuilder(Kind K, SourceLocation Loc, unsigned DiagID, const FunctionDecl *Fn, Sema &S)
@ K_Nop
Emit no diagnostics.
@ K_Deferred
Create a deferred diagnostic, which is emitted only if the function it's attached to is codegen'ed.
@ K_ImmediateWithCallStack
Emit the diagnostic immediately, and, if it's a warning or error, also emit a call stack showing how ...
@ K_Immediate
Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
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< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
Scope * getCurScope() const
Retrieve the parser's current scope.
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....
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...
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
void addImplicitTypedef(StringRef Name, QualType T)
void CheckDelegatingCtorCycles()
bool IsLastErrorImmediate
Is the last error level diagnostic immediate.
void DiagnoseUnterminatedOpenMPDeclareTarget()
Report unterminated 'omp declare target' or 'omp begin declare target' at the end of a compilation un...
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.
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
unsigned CapturingFunctionScopes
Track the number of currently active capturing scopes.
llvm::DenseMap< CanonicalDeclPtr< const FunctionDecl >, std::vector< PartialDiagnosticAt > > DeviceDeferredDiags
Diagnostics that are emitted only if we discover that the given function must be codegen'ed.
void Initialize()
Perform initialization that occurs after the parser has been initialized but before it parses anythin...
llvm::SmallPtrSet< const Decl *, 4 > ParsingInitForAutoVars
ParsingInitForAutoVars - a set of declarations with auto types for which we are currently parsing the...
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.
Preprocessor & getPreprocessor() const
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()
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.
void ActOnTranslationUnitScope(Scope *S)
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 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
SemaDiagnosticBuilder diagIfOpenMPHostCode(SourceLocation Loc, unsigned DiagID, const FunctionDecl *FD)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host cod...
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.
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
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...
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=NotForRedeclaration)
Look up a name, looking for a single declaration.
bool isConstantEvaluatedOverride
Used to change context to isConstantEvaluated without pushing a heavy ExpressionEvaluationContextReco...
SmallVector< VarDecl *, 4 > ExternalDeclarations
All the external declarations encoutered and used in the TU.
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.
void EmitCurrentDiagnostic(unsigned DiagID)
Cause the active diagnostic on the DiagosticsEngine to be emitted.
std::unique_ptr< sema::FunctionScopeInfo, PoppedFunctionScopeDeleter > PoppedFunctionScopePtr
FPOptions & getCurFPFeatures()
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
sema::LambdaScopeInfo * PushLambdaScope()
const LangOptions & getLangOpts() const
SemaDiagnosticBuilder CUDADiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
ASTConsumer & getASTConsumer() const
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.
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.
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.
ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]
The Objective-C NSNumber methods used to create NSNumber literals.
const LangOptions & LangOpts
std::unique_ptr< sema::FunctionScopeInfo > CachedFunctionScope
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
static const uint64_t MaximumAlignment
SmallVector< std::pair< FunctionDecl *, FunctionDecl * >, 2 > DelayedEquivalentExceptionSpecChecks
All the function redeclarations seen during a class definition that had their exception spec checks d...
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
SemaDiagnosticBuilder diagIfOpenMPDeviceCode(SourceLocation Loc, unsigned DiagID, const FunctionDecl *FD)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
SmallVector< PendingImplicitInstantiation, 1 > LateParsedInstantiations
Queue of implicit template instantiations that cannot be performed eagerly.
DeclContext * getCurLexicalContext() const
NamedDecl * getCurFunctionOrMethodDecl() const
getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method or C function we're in,...
void deepTypeCheckForSYCLDevice(SourceLocation UsedAt, llvm::DenseSet< QualType > Visited, ValueDecl *DeclToCheck)
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
sema::FunctionScopeInfo * getCurFunction() const
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...
SmallVector< CXXRecordDecl *, 4 > DelayedDllExportClasses
FunctionEmissionStatus getEmissionStatus(const FunctionDecl *Decl, bool Final=false)
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)
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
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...
CheckedConversionKind
The kind of conversion being performed.
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.
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)
RedeclarationKind forRedeclarationInCurContext() const
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.
SemaDiagnosticBuilder CUDADiagIfHostCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host cod...
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()
bool WarnedStackExhausted
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()
void ActOnStartOfTranslationUnit()
This is called before the very first declaration in the translation unit is parsed.
@ 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
Delete-expressions to be analyzed at the end of translation unit.
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.
void DiagnoseUseOfUnimplementedSelectors()
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
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
TentativeDefinitionsType TentativeDefinitions
All the tentative definitions encountered in the TU.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
bool DeferDiags
Whether deferrable diagnostics should be deferred.
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
SmallVector< CXXMethodDecl *, 4 > DelayedDllExportMemberFunctions
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
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
sema::LambdaScopeInfo * getEnclosingLambda() const
Get the innermost lambda enclosing the current location, if any.
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
void addExternalSource(ExternalSemaSource *E)
Registers an external source.
IdentifierInfo * InventAbbreviatedTemplateParameterTypeName(IdentifierInfo *ParamName, unsigned Index)
Invent a new identifier for parameters of abbreviated templates.
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
llvm::DenseMap< CanonicalDeclPtr< const FunctionDecl >, FunctionDeclAndLoc > DeviceKnownEmittedFns
An inverse call graph, mapping known-emitted functions to one of their known-emitted callers (plus th...
sema::CapturedRegionScopeInfo * getCurCapturedRegion()
Retrieve the current captured region, if any.
void warnStackExhausted(SourceLocation Loc)
Warn that the stack is nearly exhausted.
void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E)
Warn when implicitly casting 0 to nullptr.
SemaDiagnosticBuilder SYCLDiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
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.
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 getBegin() const
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.
Linkage getLinkage() const
Determine the linkage of this type.
const T * getAs() const
Member-template getAs<specific type>'.
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.
bool hasUnrecoverableErrorOccurred() const
Determine whether an unrecoverable error has occurred within this function.
SmallVector< CompoundScopeInfo, 4 > CompoundScopes
The stack of currently active compound stamement 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)
@ 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.
CapturedRegionKind
The different kinds of captured statement.
@ C
Languages that the frontend can parse and compile.
@ Result
The result type of a method or function.
@ TTK_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_Module
The translation unit is a 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.
bool isExternalFormalLinkage(Linkage L)
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
void runWithSufficientStackSpace(llvm::function_ref< void()> Diag, llvm::function_ref< void()> Fn)
Run a given function on a stack with "sufficient" space.
bool isExternallyVisible(Linkage L)
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<=>.