Go to the documentation of this file.
47 #include "llvm/ADT/DenseMap.h"
48 #include "llvm/ADT/SmallPtrSet.h"
49 #include "llvm/Support/TimeProfiler.h"
51 using namespace clang;
63 auto *SDKInfo = getDarwinSDKInfoForAvailabilityChecking();
64 if (!SDKInfo && !WarnedDarwinSDKInfoMissing) {
65 Diag(Loc, diag::warn_missing_sdksettings_for_availability_checking)
67 WarnedDarwinSDKInfoMissing =
true;
73 if (CachedDarwinSDKInfo)
74 return CachedDarwinSDKInfo->get();
76 PP.getFileManager().getVirtualFileSystem(),
77 PP.getHeaderSearchInfo().getHeaderSearchOpts().Sysroot);
78 if (SDKInfo && *SDKInfo) {
79 CachedDarwinSDKInfo = std::make_unique<DarwinSDKInfo>(std::move(**SDKInfo));
80 return CachedDarwinSDKInfo->get();
83 llvm::consumeError(SDKInfo.takeError());
84 CachedDarwinSDKInfo = std::unique_ptr<DarwinSDKInfo>();
92 llvm::raw_string_ostream OS(InventedName);
95 OS <<
"auto:" << Index + 1;
97 OS << ParamName->
getName() <<
":auto";
111 Policy.
Bool = BoolMacro->isObjectLike() &&
112 BoolMacro->getNumTokens() == 1 &&
113 BoolMacro->getReplacementToken(0).is(tok::kw__Bool);
142 FileID PrevFID)
override {
150 if (llvm::timeTraceProfilerEnabled()) {
151 const FileEntry *FE =
SM.getFileEntryForID(
SM.getFileID(Loc));
152 llvm::timeTraceProfilerBegin(
153 "Source", FE !=
nullptr ? FE->
getName() : StringRef(
"<unknown>"));
156 IncludeStack.push_back(IncludeLoc);
164 if (!IncludeStack.empty()) {
165 if (llvm::timeTraceProfilerEnabled())
166 llvm::timeTraceProfilerEnd();
170 IncludeStack.pop_back_val());
187 : ExternalSource(nullptr), isMultiplexExternalSource(
false),
188 CurFPFeatures(pp.getLangOpts()), LangOpts(pp.getLangOpts()), PP(pp),
189 Context(ctxt), Consumer(consumer), Diags(PP.getDiagnostics()),
190 SourceMgr(PP.getSourceManager()), CollectStats(
false),
191 CodeCompleter(CodeCompleter), CurContext(nullptr),
192 OriginalLexicalContext(nullptr), MSStructPragmaOn(
false),
193 MSPointerToMemberRepresentationMethod(
194 LangOpts.getMSPointerToMemberRepresentationMethod()),
195 VtorDispStack(LangOpts.getVtorDispMode()),
197 DataSegStack(nullptr), BSSSegStack(nullptr), ConstSegStack(nullptr),
199 CurInitSeg(nullptr), VisContext(nullptr),
200 PragmaAttributeCurrentTargetDecl(nullptr),
201 IsBuildingRecoveryCallExpr(
false), LateTemplateParser(nullptr),
202 LateTemplateParserCleanup(nullptr), OpaqueParser(nullptr), IdResolver(pp),
203 StdExperimentalNamespaceCache(nullptr), StdInitializerList(nullptr),
204 StdCoroutineTraitsCache(nullptr), CXXTypeInfoDecl(nullptr),
205 MSVCGuidDecl(nullptr), StdSourceLocationImplDecl(nullptr),
206 NSNumberDecl(nullptr), NSValueDecl(nullptr), NSStringDecl(nullptr),
207 StringWithUTF8StringMethod(nullptr),
208 ValueWithBytesObjCTypeMethod(nullptr), NSArrayDecl(nullptr),
209 ArrayWithObjectsMethod(nullptr), NSDictionaryDecl(nullptr),
210 DictionaryWithObjectsMethod(nullptr), GlobalNewDeleteDeclared(
false),
211 TUKind(TUKind), NumSFINAEErrors(0),
212 FullyCheckedComparisonCategories(
214 SatisfactionCache(Context), AccessCheckingSFINAE(
false),
215 InNonInstantiationSFINAEContext(
false), NonInstantiationEntries(0),
216 ArgumentPackSubstitutionIndex(-1), CurrentInstantiationScope(nullptr),
217 DisableTypoCorrection(
false), TyposCorrected(0), AnalysisWarnings(*this),
218 ThreadSafetyDeclCache(nullptr), VarDataSharingAttributesStack(nullptr),
219 CurScope(nullptr), Ident_super(nullptr), Ident___float128(nullptr) {
224 LoadedExternalKnownNamespaces =
false;
245 InitDataSharingAttributesStack();
247 std::unique_ptr<sema::SemaPPCallbacks> Callbacks =
248 std::make_unique<sema::SemaPPCallbacks>();
249 SemaPPCallbackHandler = Callbacks.get();
251 SemaPPCallbackHandler->
set(*
this);
280 SC->InitializeSema(*
this);
285 ExternalSema->InitializeSema(*
this);
358 if (OCLCompatibleVersion >= 200) {
387 auto AddPointerSizeDependentTypes = [&]() {
391 auto AtomicPtrDiffT =
400 AddPointerSizeDependentTypes();
408 std::vector<QualType> Atomic64BitTypes;
416 Atomic64BitTypes.push_back(AtomicDoubleT);
425 AddPointerSizeDependentTypes();
430 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
431 if (getOpenCLOptions().isSupported(#Ext, getLangOpts())) { \
432 addImplicitTypedef(#ExtType, Context.Id##Ty); \
434 #include "clang/Basic/OpenCLExtensionTypes.def"
438 #define SVE_TYPE(Name, Id, SingletonId) \
439 addImplicitTypedef(Name, Context.SingletonId);
440 #include "clang/Basic/AArch64SVEACLETypes.def"
444 #define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \
445 addImplicitTypedef(#Name, Context.Id##Ty);
446 #include "clang/Basic/PPCTypes.def"
447 #define PPC_VECTOR_VSX_TYPE(Name, Id, Size) \
448 addImplicitTypedef(#Name, Context.Id##Ty);
449 #include "clang/Basic/PPCTypes.def"
453 #define RVV_TYPE(Name, Id, SingletonId) \
454 addImplicitTypedef(Name, Context.SingletonId);
455 #include "clang/Basic/RISCVVTypes.def"
471 "failed to clean up an InstantiatingTemplate?");
486 ExternalSema->ForgetSema();
489 if (isMultiplexExternalSource)
490 delete ExternalSource;
493 std::vector<ConstraintSatisfaction *> Satisfactions;
494 Satisfactions.reserve(Satisfactions.size());
495 for (
auto &
Node : SatisfactionCache)
496 Satisfactions.push_back(&
Node);
497 for (
auto *
Node : Satisfactions)
503 DestroyDataSharingAttributesStack();
507 SemaPPCallbackHandler->
reset();
513 Diag(Loc, diag::warn_stack_exhausted);
519 llvm::function_ref<
void()> Fn) {
528 UnavailableAttr::ImplicitReason reason) {
531 if (!fn)
return false;
542 if (fn->
hasAttr<UnavailableAttr>())
return true;
544 fn->
addAttr(UnavailableAttr::CreateImplicit(
Context,
"", reason, loc));
558 assert(E &&
"Cannot use with NULL ptr");
560 if (!ExternalSource) {
565 if (isMultiplexExternalSource)
569 isMultiplexExternalSource =
true;
575 llvm::errs() <<
"\n*** Semantic Analysis Stats:\n";
594 Diag(Loc, diag::warn_nullability_lost) << SrcType << DstType;
605 if (
Kind != CK_NullToPointer &&
Kind != CK_NullToMemberPointer)
641 (
"can't implicitly cast glvalue to prvalue with this cast "
646 case CK_LValueToRValue:
647 case CK_ArrayToPointerDecay:
648 case CK_FunctionToPointerDecay:
650 case CK_NonAtomicToAtomic:
655 "can't cast prvalue to glvalue");
667 if (
Kind == CK_ArrayToPointerDecay) {
676 E = Materialized.
get();
687 if (
const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
688 if (
const auto *VD = dyn_cast<VarDecl>(DRE->getDecl())) {
700 if (ImpCast->getCastKind() ==
Kind && (!BasePath || BasePath->empty())) {
701 ImpCast->setType(Ty);
702 ImpCast->setValueKind(VK);
726 llvm_unreachable(
"unknown scalar type kind");
737 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
741 for (
const auto *Spec : Template->specializations())
748 if (FD->hasBody(DeclToCheck))
754 if (DeclToCheck != FD)
758 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
764 if (VD->isReferenced() &&
765 VD->mightBeUsableInConstantExpressions(SemaRef->
Context))
771 for (
const auto *Spec : Template->specializations())
784 if (DeclToCheck != VD)
792 if (
auto *FD = dyn_cast<FunctionDecl>(ND))
793 return FD->isExternC();
794 return cast<VarDecl>(ND)->isExternC();
819 if (ND->
hasAttr<WeakRefAttr>())
continue;
821 if (isa<CXXDeductionGuideDecl>(ND))
824 if (ND->
hasAttr<DLLImportAttr>() || ND->
hasAttr<DLLExportAttr>()) {
834 if (FD->isExternallyVisible() &&
836 !FD->getMostRecentDecl()->isInlined() &&
837 !FD->hasAttr<ExcludeFromExplicitInstantiationAttr>())
839 if (FD->getBuiltinID())
842 auto *VD = cast<VarDecl>(ND);
845 if (VD->isExternallyVisible() &&
847 !VD->getMostRecentDecl()->isInline() &&
848 !VD->hasAttr<ExcludeFromExplicitInstantiationAttr>())
853 if (VD->isKnownToBeDefined())
857 Undefined.push_back(std::make_pair(ND, UndefinedUse.second));
869 if (Undefined.empty())
return;
871 for (
auto Undef : Undefined) {
872 ValueDecl *VD = cast<ValueDecl>(Undef.first);
886 ? diag::ext_undefined_internal_type
887 : diag::err_undefined_internal_type)
888 << isa<VarDecl>(VD) << VD;
893 bool IsImplicitBase =
false;
894 if (
const auto *BaseD = dyn_cast<FunctionDecl>(VD)) {
895 auto *DVAttr = BaseD->
getAttr<OMPDeclareVariantAttr>();
896 if (DVAttr && !DVAttr->getTraitInfo().isExtensionActive(
897 llvm::omp::TraitProperty::
898 implementation_extension_disable_implicit_base)) {
899 const auto *Func = cast<FunctionDecl>(
900 cast<DeclRefExpr>(DVAttr->getVariantFuncRef())->getDecl());
901 IsImplicitBase = BaseD->isImplicit() &&
902 Func->getIdentifier()->isMangledOpenMPVariantName();
907 << isa<VarDecl>(VD) << VD;
908 }
else if (
auto *FD = dyn_cast<FunctionDecl>(VD)) {
910 assert(FD->getMostRecentDecl()->isInlined() &&
911 "used object requires definition but isn't inline or internal?");
915 assert(cast<VarDecl>(VD)->getMostRecentDecl()->isInline() &&
916 "used var requires definition but isn't inline or internal?");
920 S.
Diag(UseLoc, diag::note_used_here);
932 for (
auto &WeakID : WeakIDs)
946 RecordCompleteMap::iterator
Cache = MNCComplete.find(RD);
947 if (
Cache != MNCComplete.end())
948 return Cache->second;
951 bool Complete =
true;
954 I != E && Complete; ++I) {
956 Complete = M->isDefined() || M->isDefaulted() ||
957 (M->isPure() && !isa<CXXDestructorDecl>(M));
963 Complete = !F->getTemplatedDecl()->isLateTemplateParsed() &&
964 F->getTemplatedDecl()->isDefined();
965 else if (
const CXXRecordDecl *R = dyn_cast<CXXRecordDecl>(*I)) {
966 if (R->isInjectedClassName())
968 if (R->hasDefinition())
975 MNCComplete[RD] = Complete;
989 RecordCompleteMap::iterator
Cache = RecordsComplete.find(RD);
990 if (
Cache != RecordsComplete.end())
991 return Cache->second;
995 I != E && Complete; ++I) {
999 if (
CXXRecordDecl *FriendD = TSI->getType()->getAsCXXRecordDecl())
1006 dyn_cast<FunctionDecl>((*I)->getFriendDecl()))
1007 Complete = FD->isDefined();
1013 RecordsComplete[RD] = Complete;
1022 if (TD->isReferenced())
1024 Diag(TD->getLocation(), diag::warn_unused_local_typedef)
1025 << isa<TypeAliasDecl>(TD) << TD->getDeclName();
1036 HandleStartOfHeaderUnit();
1045 ModuleScopes.back().ImplicitGlobalModuleFragment =
true;
1051 if (
Kind == TUFragmentKind::Global)
1082 if (ExternalSource) {
1086 for (
auto PII : Pending)
1087 if (
auto Func = dyn_cast<FunctionDecl>(PII.first))
1088 Func->setInstantiationIsPending(
true);
1090 Pending.begin(), Pending.end());
1094 llvm::TimeTraceScope TimeScope(
"PerformPendingInstantiations");
1101 "end of TU template instantiation should not create more "
1102 "late-parsed templates");
1107 for (
const auto &Typo : DelayedTypos) {
1111 DelayedTypos.clear();
1119 &&
"reached end of translation unit with a pool attached?");
1132 !ModuleScopes.empty() && ModuleScopes.back().Module->Kind ==
1134 ? TUFragmentKind::Private
1135 : TUFragmentKind::Normal);
1152 if (
LangOpts.PCHInstantiateTemplates) {
1153 llvm::TimeTraceScope TimeScope(
"PerformPendingInstantiations");
1175 return ShouldRemoveFromUnused(this, DD);
1189 if (WeakIDs.second.empty())
1194 if (PrevDecl !=
nullptr &&
1195 !(isa<FunctionDecl>(PrevDecl) || isa<VarDecl>(PrevDecl)))
1196 for (
const auto &WI : WeakIDs.second)
1197 Diag(WI.getLocation(), diag::warn_attribute_wrong_decl_type)
1200 for (
const auto &WI : WeakIDs.second)
1201 Diag(WI.getLocation(), diag::warn_weak_identifier_undeclared)
1216 bool DiagnosedMissingModuleDeclaration =
false;
1217 if (!ModuleScopes.empty() &&
1219 !ModuleScopes.back().ImplicitGlobalModuleFragment) {
1220 Diag(ModuleScopes.back().BeginLoc,
1221 diag::err_module_declaration_missing_after_global_module_introducer);
1222 DiagnosedMissingModuleDeclaration =
true;
1230 (ModuleScopes.empty() ||
1231 !ModuleScopes.back().Module->isModulePurview()) &&
1232 !DiagnosedMissingModuleDeclaration) {
1236 diag::err_module_declaration_missing);
1245 Stack.push_back(CurrentModule);
1246 while (!Stack.empty()) {
1247 Module *Mod = Stack.pop_back_val();
1278 llvm::SmallSet<VarDecl *, 32> Seen;
1279 for (TentativeDefinitionsType::iterator
1300 diag::err_tentative_def_incomplete_type))
1312 if (!D || D->isInvalidDecl() || D->getPreviousDecl() || !D->isUsed())
1324 for (UnusedFileScopedDeclsType::iterator
1330 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(*I)) {
1332 if (!FD->hasBody(DiagD))
1337 if (isa<CXXMethodDecl>(DiagD))
1341 if (FD->getStorageClass() ==
SC_Static &&
1342 !FD->isInlineSpecified() &&
1346 diag::warn_unneeded_static_internal_decl)
1353 if (FD->getDescribedFunctionTemplate())
1358 ? diag::warn_unused_member_function
1359 : diag::warn_unused_function)
1365 DiagD = cast<VarDecl>(*I);
1408 for (
const auto &DeletedFieldInfo :
DeleteExprs) {
1410 AnalyzeDeleteExprMismatch(DeletedFieldInfo.first,
DeleteExprLoc.first,
1420 "Didn't unmark var as having its initializer parsed");
1435 if (isa<BlockDecl>(DC) || isa<EnumDecl>(DC) || isa<CapturedDecl>(DC) ||
1436 isa<RequiresExprBodyDecl>(DC)) {
1438 }
else if (!AllowLambda && isa<CXXMethodDecl>(DC) &&
1439 cast<CXXMethodDecl>(DC)->getOverloadedOperator() == OO_Call &&
1440 cast<CXXRecordDecl>(DC->
getParent())->isLambda()) {
1453 return dyn_cast<FunctionDecl>(DC);
1458 while (isa<RecordDecl>(DC))
1460 return dyn_cast<ObjCMethodDecl>(DC);
1465 if (isa<ObjCMethodDecl>(DC) || isa<FunctionDecl>(DC))
1466 return cast<NamedDecl>(DC);
1498 if (*Info && !(*Info)->hasSFINAEDiagnostic()) {
1500 (*Info)->addSFINAEDiagnostic(DiagInfo.
getLocation(),
1523 if (*Info && !(*Info)->hasSFINAEDiagnostic()) {
1525 (*Info)->addSFINAEDiagnostic(DiagInfo.
getLocation(),
1534 Diag(Loc, diag::warn_cxx98_compat_sfinae_access_control);
1547 (*Info)->addSuppressedDiagnostic(DiagInfo.
getLocation(),
1582 auto *FD = dyn_cast<FunctionDecl>(
CurContext);
1588 for (
auto PDAt : Loc->second) {
1604 S.
Diags.
Report(FnIt->second.Loc, diag::note_called_by));
1605 Builder << FnIt->second.FD;
1639 class DeferredDiagnosticsEmitter
1657 bool ShouldEmitRootNode;
1662 unsigned InOMPDeviceContext;
1664 DeferredDiagnosticsEmitter(
Sema &S)
1665 : Inherited(S), ShouldEmitRootNode(
false), InOMPDeviceContext(0) {}
1667 bool shouldVisitDiscardedStmt()
const {
return false; }
1670 ++InOMPDeviceContext;
1671 Inherited::VisitOMPTargetDirective(
Node);
1672 --InOMPDeviceContext;
1676 if (isa<VarDecl>(D))
1678 if (
auto *FD = dyn_cast<FunctionDecl>(D))
1681 Inherited::visitUsedDecl(Loc, D);
1686 "Should only check file-scope variables");
1687 if (
auto *Init = VD->
getInit()) {
1688 auto DevTy = OMPDeclareTargetDeclAttr::getDeviceType(VD);
1689 bool IsDev = DevTy && (*DevTy == OMPDeclareTargetDeclAttr::DT_NoHost ||
1690 *DevTy == OMPDeclareTargetDeclAttr::DT_Any);
1692 ++InOMPDeviceContext;
1695 --InOMPDeviceContext;
1700 auto &Done = DoneMap[InOMPDeviceContext > 0 ? 1 : 0];
1701 FunctionDecl *Caller = UsePath.empty() ? nullptr : UsePath.back();
1702 if ((!ShouldEmitRootNode && !S.
getLangOpts().OpenMP && !Caller) ||
1706 if (Caller && S.
LangOpts.OpenMP && UsePath.size() == 1 &&
1707 (ShouldEmitRootNode || InOMPDeviceContext))
1714 if (ShouldEmitRootNode || InOMPDeviceContext)
1715 emitDeferredDiags(FD, Caller);
1718 if (!Done.insert(FD).second)
1720 InUsePath.insert(FD);
1721 UsePath.push_back(FD);
1722 if (
auto *S = FD->
getBody()) {
1726 InUsePath.erase(FD);
1729 void checkRecordedDecl(
Decl *D) {
1730 if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
1735 checkVar(cast<VarDecl>(D));
1739 void emitDeferredDiags(
FunctionDecl *FD,
bool ShowCallStack) {
1743 bool HasWarningOrError =
false;
1744 bool FirstDiag =
true;
1751 HasWarningOrError |=
1760 if (FirstDiag && HasWarningOrError && ShowCallStack) {
1772 DeclsToCheckForDeferredDiags);
1775 DeclsToCheckForDeferredDiags.empty())
1778 DeferredDiagnosticsEmitter DDE(*
this);
1779 for (
auto D : DeclsToCheckForDeferredDiags)
1780 DDE.checkRecordedDecl(D);
1810 : S(S), Loc(Loc), DiagID(DiagID), Fn(Fn),
1811 ShowCallStack(K == K_ImmediateWithCallStack || K == K_Deferred) {
1817 ImmediateDiag.emplace(
1821 assert(Fn &&
"Must have a function to attach the deferred diag to.");
1823 PartialDiagId.emplace(
Diags.size());
1830 : S(D.S), Loc(D.Loc), DiagID(D.DiagID), Fn(D.Fn),
1831 ShowCallStack(D.ShowCallStack), ImmediateDiag(D.ImmediateDiag),
1832 PartialDiagId(D.PartialDiagId) {
1834 D.ShowCallStack =
false;
1835 D.ImmediateDiag.reset();
1836 D.PartialDiagId.reset();
1840 if (ImmediateDiag) {
1845 ImmediateDiag.reset();
1846 if (IsWarningOrError && ShowCallStack)
1849 assert((!PartialDiagId || ShowCallStack) &&
1850 "Must always show call stack for deferred diags.");
1877 auto SetIsLastErrorImmediate = [&](
bool Flag) {
1882 SetIsLastErrorImmediate(
true);
1911 if (
const auto *MD = dyn_cast<CXXMethodDecl>(C)) {
1912 if ((MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator()) &&
1916 if (
const auto *Ctor = dyn_cast<CXXConstructorDecl>(MD))
1917 if (Ctor->isCopyOrMoveConstructor() && Ctor->isTrivial())
1923 FunctionDecl *FD = isa<FunctionDecl>(C) ? cast<FunctionDecl>(C)
1924 : dyn_cast_or_null<FunctionDecl>(D);
1926 auto CheckDeviceType = [&](
QualType Ty) {
1938 <<
false << 0 <<
false
1946 bool LongDoubleMismatched =
false;
1949 if ((&Sem != &llvm::APFloat::PPCDoubleDouble() &&
1951 (&Sem == &llvm::APFloat::PPCDoubleDouble() &&
1953 LongDoubleMismatched =
true;
1961 LongDoubleMismatched) {
1973 D->setInvalidDecl();
1976 targetDiag(D->getLocation(), diag::note_defined_here, FD) << D;
1980 auto CheckType = [&](
QualType Ty,
bool IsRetTy =
false) {
1983 CheckDeviceType(Ty);
1994 if (
Diag(Loc, PD, FD)
1995 <<
false << 0 << Ty <<
false
1998 D->setInvalidDecl();
2001 targetDiag(D->getLocation(), diag::note_defined_here, FD) << D;
2006 if (IsRetTy && !TI.
hasFPReturn() && (IsDouble || IsFloat)) {
2013 if (
Diag(Loc, PD, FD)
2014 <<
false << 0 << Ty <<
true
2017 D->setInvalidDecl();
2020 targetDiag(D->getLocation(), diag::note_defined_here, FD) << D;
2025 if (
const auto *FPTy = dyn_cast<FunctionProtoType>(Ty)) {
2026 for (
const auto &ParamTy : FPTy->param_types())
2028 CheckType(FPTy->getReturnType(),
true);
2030 if (
const auto *FNPTy = dyn_cast<FunctionNoProtoType>(Ty))
2031 CheckType(FNPTy->getReturnType(),
true);
2094 pushOpenMPFunctionRegion();
2099 BlockScope,
Block));
2110 LSI->AutoTemplateParameterDepth =
Depth;
2114 "Remove assertion if intentionally called in a non-lambda context.");
2141 if (!Result.isInvalid()) {
2161 VarDecl *VD = BC.getVariable();
2162 if (VD->
hasAttr<BlocksAttr>()) {
2171 QualType CapType = BC.getVariable()->getType();
2212 popOpenMPFunctionRegion(
Scope.get());
2218 for (
const auto &PUD :
Scope->PossiblyUnreachableDiags)
2219 Diag(PUD.Loc, PUD.PD);
2227 if (
Scope->isPlainFunction() && !Self->CachedFunctionScope)
2228 Self->CachedFunctionScope.reset(
Scope);
2239 assert(!CurFunction->
CompoundScopes.empty() &&
"mismatched push/pop");
2275 if (CurBSI && CurBSI->TheDecl &&
2299 if (
auto *LSI = dyn_cast<sema::LambdaScopeInfo>(
Scope)) {
2300 if (LSI->Lambda && !LSI->Lambda->Encloses(
CurContext)) {
2318 if (IgnoreNonLambdaCapturingScope) {
2320 while (I != E && isa<CapturingScopeInfo>(*I) && !isa<LambdaScopeInfo>(*I))
2325 auto *CurLSI = dyn_cast<LambdaScopeInfo>(*I);
2326 if (CurLSI && CurLSI->Lambda &&
2340 return (LSI->TemplateParams.size() ||
2341 LSI->GLTemplateParameterList) ? LSI :
nullptr;
2348 if (!
LangOpts.RetainCommentsFromSystemHeaders &&
2355 StringRef MagicMarkerText;
2358 MagicMarkerText =
"///<";
2361 MagicMarkerText =
"/**<";
2364 llvm_unreachable(
"if this is an almost Doxygen comment, "
2365 "it should be ordinary");
2367 Diag(Comment.
getBegin(), diag::warn_not_a_doxygen_trailing_member_comment) <<
2375 char ExternalSemaSource::ID;
2385 llvm::MapVector<NamedDecl *, SourceLocation> &Undefined) {}
2404 OverloadSet.
clear();
2407 bool IsMemExpr =
false;
2417 Overloads = dyn_cast<UnresolvedMemberExpr>(E.
IgnoreParens());
2421 bool Ambiguous =
false;
2426 DeclsEnd = Overloads->
decls_end(); it != DeclsEnd; ++it) {
2434 = dyn_cast<FunctionDecl>((*it)->getUnderlyingDecl())) {
2435 if (OverloadDecl->getMinRequiredArguments() == 0) {
2436 if (!ZeroArgCallReturnTy.
isNull() && !Ambiguous &&
2437 (!IsMV || !(OverloadDecl->isCPUDispatchMultiVersion() ||
2438 OverloadDecl->isCPUSpecificMultiVersion()))) {
2442 ZeroArgCallReturnTy = OverloadDecl->getReturnType();
2443 IsMV = OverloadDecl->isCPUDispatchMultiVersion() ||
2444 OverloadDecl->isCPUSpecificMultiVersion();
2452 return !ZeroArgCallReturnTy.
isNull();
2470 if (
const FunctionDecl *Fun = dyn_cast<FunctionDecl>(DeclRef->getDecl())) {
2471 if (Fun->getMinRequiredArguments() == 0)
2472 ZeroArgCallReturnTy = Fun->getReturnType();
2488 dyn_cast_or_null<FunctionProtoType>(FunTy)) {
2489 if (FPT->getNumParams() == 0)
2510 unsigned ShownOverloads = 0;
2511 unsigned SuppressedOverloads = 0;
2513 DeclsEnd = Overloads.
end(); It != DeclsEnd; ++It) {
2515 ++SuppressedOverloads;
2523 !FD->
getAttr<TargetAttr>()->isDefaultVersion())
2532 if (SuppressedOverloads)
2533 S.
Diag(FinalNoteLoc, diag::note_ovl_too_many_candidates)
2534 << SuppressedOverloads;
2539 bool (*IsPlausibleResult)(
QualType)) {
2540 if (!IsPlausibleResult)
2545 DeclsEnd = Overloads.
end(); It != DeclsEnd; ++It) {
2546 const FunctionDecl *OverloadDecl = cast<FunctionDecl>(*It);
2548 if (IsPlausibleResult(OverloadResultTy))
2549 PlausibleOverloads.
addDecl(It.getDecl());
2560 return (!isa<CStyleCastExpr>(E) &&
2561 !isa<UnaryOperator>(E) &&
2562 !isa<BinaryOperator>(E) &&
2563 !isa<CXXOperatorCallExpr>(E));
2567 if (
const auto *UO = dyn_cast<UnaryOperator>(E))
2568 E = UO->getSubExpr();
2570 if (
const auto *ULE = dyn_cast<UnresolvedLookupExpr>(E)) {
2571 if (ULE->getNumDecls() == 0)
2574 const NamedDecl *ND = *ULE->decls_begin();
2575 if (
const auto *FD = dyn_cast<FunctionDecl>(ND))
2583 bool (*IsPlausibleResult)(
QualType)) {
2593 !ZeroArgCallTy.
isNull() &&
2594 (!IsPlausibleResult || IsPlausibleResult(ZeroArgCallTy))) {
2601 Diag(Loc, PD) << 1 << IsMV << Range
2612 Range.getEnd().getLocWithOffset(1));
2616 if (!ForceComplain)
return false;
2619 Diag(Loc, PD) << 0 << IsMV << Range;
2633 if (!Ident___float128)
2635 return Ident___float128;
2640 unsigned OpenMPCaptureLevel) {
2644 OpenMPCaptureLevel);
2656 const llvm::MapVector<FieldDecl *, Sema::DeleteLocs> &
2664 OldEvalMethod(S.
PP.getCurrentFPEvalMethod()),
2665 OldFPPragmaLocation(S.
PP.getLastFPEvalPragmaLocation()) {}
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.
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
bool resolveConflicts(Module *Mod, bool Complain)
Resolve all of the unresolved conflicts in the given module.
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.
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 TS module 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...
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
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.
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
virtual void ReadUnusedLocalTypedefNameCandidates(llvm::SmallSetVector< const TypedefNameDecl *, 4 > &Decls)
Read the set of potentially unused typedefs known to the source.
submodule_iterator submodule_begin()
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.
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.
bool isRealFloatingType() const
Floating point categories.
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 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.
~ExternalSemaSource() override
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
bool WarnedStackExhausted
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
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
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()
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.
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()
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.
@ FEM_UnsetOnCommandLine
Used only for FE option processing; this is only used to indicate that the user did not specify an ex...
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.
@ FEM_Indeterminable
The evaluation method cannot be determined or is inconsistent for this 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...
virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, SrcMgr::CharacteristicKind FileType, FileID PrevFID) override
Callback invoked whenever a source file is entered or exited.
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.
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.
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.
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.
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.
virtual void ReadPendingInstantiations(SmallVectorImpl< std::pair< ValueDecl *, SourceLocation > > &Pending)
Read the set of pending instantiations known to the external Sema source.
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>.
Optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
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
virtual LangOptions::FPEvalMethodKind getFPEvalMethod() const
Return the value for the C99 FLT_EVAL_METHOD macro.
@ 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.
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...
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.
virtual void ReadDeclsToCheckForDeferredDiags(llvm::SmallSetVector< Decl *, 4 > &Decls)
Read the set of decls to be checked for deferred diags.
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)
Expected< Optional< DarwinSDKInfo > > parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS, StringRef SDKRootPath)
Parse the SDK information from the SDKSettings.json file.
virtual void ReadWeakUndeclaredIdentifiers(SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo > > &WI)
Read the set of weak, undeclared identifiers known to the external Sema source.
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