Lines Matching +full:fsi +full:- +full:attached

1 //===--- Sema.cpp - AST Builder and Semantic Analysis Implementation ------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
103 return CachedDarwinSDKInfo->get(); in getDarwinSDKInfoForAvailabilityChecking()
109 return CachedDarwinSDKInfo->get(); in getDarwinSDKInfoForAvailabilityChecking()
125 OS << ParamName->getName() << ":auto"; in InventAbbreviatedTemplateParameterTypeName()
139 Policy.Bool = BoolMacro->isObjectLike() && in getPrintingPolicy()
140 BoolMacro->getNumTokens() == 1 && in getPrintingPolicy()
141 BoolMacro->getReplacementToken(0).is(tok::kw__Bool); in getPrintingPolicy()
165 void set(Sema &S) { this->S = &S; } in set()
176 SourceManager &SM = S->getSourceManager(); in FileChanged()
182 "Source", FE ? FE->getName() : StringRef("<unknown>"))); in FileChanged()
186 S->DiagnoseNonDefaultPragmaAlignPack( in FileChanged()
197 S->DiagnoseNonDefaultPragmaAlignPack( in FileChanged()
267 ArgumentPackSubstitutionIndex(-1), SatisfactionCache(Context) { in Sema()
298 SemaPPCallbackHandler->set(*this); in Sema()
314 SC->InitializeSema(*this); in Initialize()
319 ExternalSema->InitializeSema(*this); in Initialize()
328 // Initialize predefined 128-bit integer types, if needed. in Initialize()
331 Context.getAuxTargetInfo()->hasInt128Type())) { in Initialize()
332 // If either of the 128-bit integer types are unavailable to name lookup, in Initialize()
344 // Initialize predefined Objective-C types: in Initialize()
358 // Create the built-in typedef for 'Class'. in Initialize()
363 // Create the built-in forward declaratino for 'Protocol'. in Initialize()
406 // 32-bit integer and OpenCLC v2.0, s6.1.1 int is always 32-bit wide. in Initialize()
411 // - The atomic_long and atomic_ulong types are supported if the in Initialize()
414 // - The atomic_double type is only supported if double precision in Initialize()
417 // - If the device address space is 64-bits, the data types in Initialize()
474 Context.getAuxTargetInfo()->hasAArch64SVETypes())) { in Initialize()
496 Context.getTargetInfo().hasFeature("reference-types")) { in Initialize()
504 Context.getAuxTargetInfo()->getTriple().isAMDGPU())) { in Initialize()
528 for (sema::FunctionScopeInfo *FSI : FunctionScopes) in ~Sema()
529 delete FSI; in ~Sema()
533 SC->ForgetSema(); in ~Sema()
538 ExternalSema->ForgetSema(); in ~Sema()
555 SemaPPCallbackHandler->reset(); in ~Sema()
586 if (fn->hasAttr<UnavailableAttr>()) return true; in makeUnavailableInSystemHeader()
588 fn->addAttr(UnavailableAttr::CreateImplicit(Context, "", reason, loc)); in makeUnavailableInSystemHeader()
605 Ex->AddSource(E); in addExternalSource()
621 std::optional<NullabilityKind> ExprNullability = SrcType->getNullability(); in diagnoseNullableToNonnullConversion()
626 std::optional<NullabilityKind> TypeNullability = DstType->getNullability(); in diagnoseNullableToNonnullConversion()
654 const Expr *EStripped = E->IgnoreParenImpCasts(); in diagnoseZeroToNullptrConversion()
655 if (EStripped->getType()->isNullPtrType()) in diagnoseZeroToNullptrConversion()
661 E->getBeginLoc())) in diagnoseZeroToNullptrConversion()
673 if (FD && FD->isDefaulted()) { in diagnoseZeroToNullptrConversion()
681 SourceLocation MaybeMacroLoc = E->getBeginLoc(); in diagnoseZeroToNullptrConversion()
687 Diag(E->getBeginLoc(), diag::warn_zero_as_null_pointer_constant) in diagnoseZeroToNullptrConversion()
688 << FixItHint::CreateReplacement(E->getSourceRange(), "nullptr"); in diagnoseZeroToNullptrConversion()
691 /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
699 if (VK == VK_PRValue && !E->isPRValue()) { in ImpCastExprToType()
717 assert((VK == VK_PRValue || Kind == CK_Dependent || !E->isPRValue()) && in ImpCastExprToType()
721 diagnoseNullableToNonnullConversion(Ty, E->getType(), E->getBeginLoc()); in ImpCastExprToType()
725 diagnoseFunctionEffectConversion(Ty, E->getType(), E->getBeginLoc()); in ImpCastExprToType()
727 QualType ExprTy = Context.getCanonicalType(E->getType()); in ImpCastExprToType()
736 if (getLangOpts().CPlusPlus && E->isPRValue()) { in ImpCastExprToType()
739 E->getType(), E, !getLangOpts().CPlusPlus11); in ImpCastExprToType()
747 // object declared with storage-class specifier register cannot be in ImpCastExprToType()
751 // array declared with storage-class specifier register is sizeof. in ImpCastExprToType()
752 if (VK == VK_PRValue && !getLangOpts().CPlusPlus && !E->isPRValue()) { in ImpCastExprToType()
754 if (const auto *VD = dyn_cast<VarDecl>(DRE->getDecl())) { in ImpCastExprToType()
755 if (VD->getStorageClass() == SC_Register) { in ImpCastExprToType()
756 Diag(E->getExprLoc(), diag::err_typecheck_address_of) in ImpCastExprToType()
757 << /*register variable*/ 3 << E->getSourceRange(); in ImpCastExprToType()
766 if (ImpCast->getCastKind() == Kind && (!BasePath || BasePath->empty())) { in ImpCastExprToType()
767 ImpCast->setType(Ty); in ImpCastExprToType()
768 ImpCast->setValueKind(VK); in ImpCastExprToType()
778 switch (ScalarTy->getScalarTypeKind()) { in ScalarTypeToBooleanCastKind()
795 if (D->getMostRecentDecl()->isUsed()) in ShouldRemoveFromUnused()
798 if (D->isExternallyVisible()) in ShouldRemoveFromUnused()
804 if (FunctionTemplateDecl *Template = FD->getDescribedFunctionTemplate()) in ShouldRemoveFromUnused()
805 for (const auto *Spec : Template->specializations()) in ShouldRemoveFromUnused()
812 if (FD->hasBody(DeclToCheck)) in ShouldRemoveFromUnused()
813 return !SemaRef->ShouldWarnIfUnusedFileScopedDecl(DeclToCheck); in ShouldRemoveFromUnused()
817 DeclToCheck = FD->getMostRecentDecl(); in ShouldRemoveFromUnused()
819 return !SemaRef->ShouldWarnIfUnusedFileScopedDecl(DeclToCheck); in ShouldRemoveFromUnused()
826 // warn even if the variable isn't odr-used. (isReferenced doesn't in ShouldRemoveFromUnused()
828 if (VD->isReferenced() && in ShouldRemoveFromUnused()
829 VD->mightBeUsableInConstantExpressions(SemaRef->Context)) in ShouldRemoveFromUnused()
832 if (VarTemplateDecl *Template = VD->getDescribedVarTemplate()) in ShouldRemoveFromUnused()
835 for (const auto *Spec : Template->specializations()) in ShouldRemoveFromUnused()
841 const VarDecl *DeclToCheck = VD->getDefinition(); in ShouldRemoveFromUnused()
843 return !SemaRef->ShouldWarnIfUnusedFileScopedDecl(DeclToCheck); in ShouldRemoveFromUnused()
847 DeclToCheck = VD->getMostRecentDecl(); in ShouldRemoveFromUnused()
849 return !SemaRef->ShouldWarnIfUnusedFileScopedDecl(DeclToCheck); in ShouldRemoveFromUnused()
857 return FD->isExternC(); in isFunctionOrVarDeclExternC()
858 return cast<VarDecl>(ND)->isExternC(); in isFunctionOrVarDeclExternC()
861 /// Determine whether ND is an external-linkage function or variable whose
867 return getLangOpts().CPlusPlus && VD->hasExternalFormalLinkage() && in isExternalWithNoLinkageType()
868 !isExternalFormalLinkage(VD->getType()->getLinkage()) && in isExternalWithNoLinkageType()
873 /// ODR-used.
880 if (ND->isInvalidDecl()) continue; in getUndefinedButUsed()
883 if (ND->hasAttr<WeakRefAttr>()) continue; in getUndefinedButUsed()
888 if (ND->hasAttr<DLLImportAttr>() || ND->hasAttr<DLLExportAttr>()) { in getUndefinedButUsed()
896 if (FD->isDefined()) in getUndefinedButUsed()
898 if (FD->isExternallyVisible() && in getUndefinedButUsed()
900 !FD->getMostRecentDecl()->isInlined() && in getUndefinedButUsed()
901 !FD->hasAttr<ExcludeFromExplicitInstantiationAttr>()) in getUndefinedButUsed()
903 if (FD->getBuiltinID()) in getUndefinedButUsed()
907 if (VD->hasDefinition() != VarDecl::DeclarationOnly) in getUndefinedButUsed()
909 if (VD->isExternallyVisible() && in getUndefinedButUsed()
911 !VD->getMostRecentDecl()->isInline() && in getUndefinedButUsed()
912 !VD->hasAttr<ExcludeFromExplicitInstantiationAttr>()) in getUndefinedButUsed()
917 if (VD->isKnownToBeDefined()) in getUndefinedButUsed()
925 /// checkUndefinedButUsed - Check for undefined objects with internal linkage
930 // Collect all the still-undefined entities with internal linkage. in checkUndefinedButUsed()
944 // -- the entity has C language linkage in checkUndefinedButUsed()
945 // -- the entity is not odr-used or is defined in the same TU in checkUndefinedButUsed()
950 S.Diag(VD->getLocation(), isExternallyVisible(VD->getType()->getLinkage()) in checkUndefinedButUsed()
954 } else if (!VD->isExternallyVisible()) { in checkUndefinedButUsed()
960 auto *DVAttr = BaseD->getAttr<OMPDeclareVariantAttr>(); in checkUndefinedButUsed()
961 if (DVAttr && !DVAttr->getTraitInfo().isExtensionActive( in checkUndefinedButUsed()
965 cast<DeclRefExpr>(DVAttr->getVariantFuncRef())->getDecl()); in checkUndefinedButUsed()
966 IsImplicitBase = BaseD->isImplicit() && in checkUndefinedButUsed()
967 Func->getIdentifier()->isMangledOpenMPVariantName(); in checkUndefinedButUsed()
971 S.Diag(VD->getLocation(), diag::warn_undefined_internal) in checkUndefinedButUsed()
975 assert(FD->getMostRecentDecl()->isInlined() && in checkUndefinedButUsed()
977 // FIXME: This is ill-formed; we should reject. in checkUndefinedButUsed()
978 S.Diag(VD->getLocation(), diag::warn_undefined_inline) << VD; in checkUndefinedButUsed()
980 assert(cast<VarDecl>(VD)->getMostRecentDecl()->isInline() && in checkUndefinedButUsed()
982 S.Diag(VD->getLocation(), diag::err_undefined_inline_var) << VD; in checkUndefinedButUsed()
994 ExternalSource->ReadWeakUndeclaredIdentifiers(WeakIDs); in LoadExternalWeakUndeclaredIdentifiers()
1011 return Cache->second; in MethodsAndNestedClassesComplete()
1012 if (!RD->isCompleteDefinition()) in MethodsAndNestedClassesComplete()
1015 for (DeclContext::decl_iterator I = RD->decls_begin(), in MethodsAndNestedClassesComplete()
1016 E = RD->decls_end(); in MethodsAndNestedClassesComplete()
1019 Complete = M->isDefined() || M->isDefaulted() || in MethodsAndNestedClassesComplete()
1020 (M->isPureVirtual() && !isa<CXXDestructorDecl>(M)); in MethodsAndNestedClassesComplete()
1026 Complete = !F->getTemplatedDecl()->isLateTemplateParsed() && in MethodsAndNestedClassesComplete()
1027 F->getTemplatedDecl()->isDefined(); in MethodsAndNestedClassesComplete()
1029 if (R->isInjectedClassName()) in MethodsAndNestedClassesComplete()
1031 if (R->hasDefinition()) in MethodsAndNestedClassesComplete()
1032 Complete = MethodsAndNestedClassesComplete(R->getDefinition(), in MethodsAndNestedClassesComplete()
1054 return Cache->second; in IsRecordFullyDefined()
1056 for (CXXRecordDecl::friend_iterator I = RD->friend_begin(), in IsRecordFullyDefined()
1057 E = RD->friend_end(); in IsRecordFullyDefined()
1060 if (TypeSourceInfo *TSI = (*I)->getFriendType()) { in IsRecordFullyDefined()
1062 if (CXXRecordDecl *FriendD = TSI->getType()->getAsCXXRecordDecl()) in IsRecordFullyDefined()
1069 dyn_cast<FunctionDecl>((*I)->getFriendDecl())) in IsRecordFullyDefined()
1070 Complete = FD->isDefined(); in IsRecordFullyDefined()
1082 ExternalSource->ReadUnusedLocalTypedefNameCandidates( in emitAndClearUnusedLocalTypedefWarnings()
1085 if (TD->isReferenced()) in emitAndClearUnusedLocalTypedefWarnings()
1087 Diag(TD->getLocation(), diag::warn_unused_local_typedef) in emitAndClearUnusedLocalTypedefWarnings()
1088 << isa<TypeAliasDecl>(TD) << TD->getDeclName(); in emitAndClearUnusedLocalTypedefWarnings()
1135 ExternalSource->ReadPendingInstantiations(Pending); in ActOnEndOfTranslationUnitFragment()
1138 Func->setInstantiationIsPending(true); in ActOnEndOfTranslationUnitFragment()
1152 "late-parsed templates"); in ActOnEndOfTranslationUnitFragment()
1166 && "reached end of translation unit with a pool attached?"); in ActOnEndOfTranslationUnit()
1168 // If code completion is enabled, don't perform any end-of-translation-unit in ActOnEndOfTranslationUnit()
1179 !ModuleScopes.empty() && ModuleScopes.back().Module->Kind == in ActOnEndOfTranslationUnit()
1259 ExternalSource->ReadUndefinedButUsed(UndefinedButUsed); in ActOnEndOfTranslationUnit()
1263 // A global-module-fragment is only permitted within a module unit. in ActOnEndOfTranslationUnit()
1264 if (!ModuleScopes.empty() && ModuleScopes.back().Module->Kind == in ActOnEndOfTranslationUnit()
1272 CurrentModule && CurrentModule->isInterfaceOrPartition()) { in ActOnEndOfTranslationUnit()
1276 for (auto [Exported, _] : M->Exports) in ActOnEndOfTranslationUnit()
1277 if (Exported->isNamedModuleInterfaceHasInit()) in ActOnEndOfTranslationUnit()
1279 for (Module *I : M->Imports) in ActOnEndOfTranslationUnit()
1280 if (I->isNamedModuleInterfaceHasInit()) in ActOnEndOfTranslationUnit()
1286 CurrentModule->NamedModuleHasInit = in ActOnEndOfTranslationUnit()
1288 llvm::any_of(CurrentModule->submodules(), in ActOnEndOfTranslationUnit()
1312 auto SubmodulesRange = Mod->submodules(); in ActOnEndOfTranslationUnit()
1329 if (auto *FDD = FD->getDefinition()) { in ActOnEndOfTranslationUnit()
1330 DefInPMF = FDD->getOwningModule()->isPrivateModule(); in ActOnEndOfTranslationUnit()
1334 Diag(FD->getLocation(), diag::err_export_inline_not_defined) in ActOnEndOfTranslationUnit()
1338 ModuleScopes.back().Module->Kind == Module::PrivateModuleFragment) { in ActOnEndOfTranslationUnit()
1349 // scope without an initializer, and without a storage-class in ActOnEndOfTranslationUnit()
1350 // specifier or with the storage-class specifier static, in ActOnEndOfTranslationUnit()
1363 VarDecl *VD = (*T)->getActingDefinition(); in ActOnEndOfTranslationUnit()
1368 if (!VD || VD->isInvalidDecl() || !Seen.insert(VD).second) in ActOnEndOfTranslationUnit()
1372 = Context.getAsIncompleteArrayType(VD->getType())) { in ActOnEndOfTranslationUnit()
1374 Diag(VD->getLocation(), diag::warn_tentative_incomplete_array); in ActOnEndOfTranslationUnit()
1377 ArrayT->getElementType(), One, nullptr, ArraySizeModifier::Normal, 0); in ActOnEndOfTranslationUnit()
1378 VD->setType(T); in ActOnEndOfTranslationUnit()
1379 } else if (RequireCompleteType(VD->getLocation(), VD->getType(), in ActOnEndOfTranslationUnit()
1381 VD->setInvalidDecl(); in ActOnEndOfTranslationUnit()
1387 if (!VD->isInvalidDecl()) in ActOnEndOfTranslationUnit()
1392 if (!D || D->isInvalidDecl() || D->getPreviousDecl() || !D->isUsed()) in ActOnEndOfTranslationUnit()
1404 // file-scope declarations in modules or not at all, but whether the in ActOnEndOfTranslationUnit()
1417 if (!FD->hasBody(DiagD)) in ActOnEndOfTranslationUnit()
1419 if (DiagD->isDeleted()) in ActOnEndOfTranslationUnit()
1421 SourceRange DiagRange = DiagD->getLocation(); in ActOnEndOfTranslationUnit()
1423 DiagD->getTemplateSpecializationArgsAsWritten()) in ActOnEndOfTranslationUnit()
1424 DiagRange.setEnd(ASTTAL->RAngleLoc); in ActOnEndOfTranslationUnit()
1425 if (DiagD->isReferenced()) { in ActOnEndOfTranslationUnit()
1427 Diag(DiagD->getLocation(), diag::warn_unneeded_member_function) in ActOnEndOfTranslationUnit()
1430 if (FD->getStorageClass() == SC_Static && in ActOnEndOfTranslationUnit()
1431 !FD->isInlineSpecified() && in ActOnEndOfTranslationUnit()
1433 SourceMgr.getExpansionLoc(FD->getLocation()))) in ActOnEndOfTranslationUnit()
1434 Diag(DiagD->getLocation(), in ActOnEndOfTranslationUnit()
1438 Diag(DiagD->getLocation(), diag::warn_unneeded_internal_decl) in ActOnEndOfTranslationUnit()
1441 } else if (!FD->isTargetMultiVersion() || in ActOnEndOfTranslationUnit()
1442 FD->isTargetMultiVersionDefault()) { in ActOnEndOfTranslationUnit()
1443 if (FD->getDescribedFunctionTemplate()) in ActOnEndOfTranslationUnit()
1444 Diag(DiagD->getLocation(), diag::warn_unused_template) in ActOnEndOfTranslationUnit()
1447 Diag(DiagD->getLocation(), isa<CXXMethodDecl>(DiagD) in ActOnEndOfTranslationUnit()
1453 const VarDecl *DiagD = cast<VarDecl>(*I)->getDefinition(); in ActOnEndOfTranslationUnit()
1456 SourceRange DiagRange = DiagD->getLocation(); in ActOnEndOfTranslationUnit()
1459 VTSD->getTemplateArgsAsWritten()) in ActOnEndOfTranslationUnit()
1460 DiagRange.setEnd(ASTTAL->RAngleLoc); in ActOnEndOfTranslationUnit()
1462 if (DiagD->isReferenced()) { in ActOnEndOfTranslationUnit()
1463 Diag(DiagD->getLocation(), diag::warn_unneeded_internal_decl) in ActOnEndOfTranslationUnit()
1465 } else if (DiagD->getDescribedVarTemplate()) { in ActOnEndOfTranslationUnit()
1466 Diag(DiagD->getLocation(), diag::warn_unused_template) in ActOnEndOfTranslationUnit()
1468 } else if (DiagD->getType().isConstQualified()) { in ActOnEndOfTranslationUnit()
1470 if (SM.getMainFileID() != SM.getFileID(DiagD->getLocation()) || in ActOnEndOfTranslationUnit()
1472 Diag(DiagD->getLocation(), diag::warn_unused_const_variable) in ActOnEndOfTranslationUnit()
1475 Diag(DiagD->getLocation(), diag::warn_unused_variable) in ActOnEndOfTranslationUnit()
1490 const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D->getDeclContext()); in ActOnEndOfTranslationUnit()
1491 if (RD && !RD->isUnion() && in ActOnEndOfTranslationUnit()
1493 Diag(D->getLocation(), diag::warn_unused_private_field) in ActOnEndOfTranslationUnit()
1494 << D->getDeclName(); in ActOnEndOfTranslationUnit()
1501 ExternalSource->ReadMismatchingDeleteExpressions(DeleteExprs); in ActOnEndOfTranslationUnit()
1514 // at worst a rejects-valid bug. in ActOnEndOfTranslationUnit()
1523 //===----------------------------------------------------------------------===//
1525 //===----------------------------------------------------------------------===//
1533 DC = DC->getParent(); in getFunctionLevelDeclContext()
1535 cast<CXXMethodDecl>(DC)->getOverloadedOperator() == OO_Call && in getFunctionLevelDeclContext()
1536 cast<CXXRecordDecl>(DC->getParent())->isLambda()) { in getFunctionLevelDeclContext()
1537 DC = DC->getParent()->getParent(); in getFunctionLevelDeclContext()
1544 /// getCurFunctionDecl - If inside of a function body, this returns a pointer
1555 DC = DC->getParent(); in getCurMethodDecl()
1593 // template-deduction information. in EmitCurrentDiagnostic()
1594 if (*Info && !(*Info)->hasSFINAEDiagnostic()) { in EmitCurrentDiagnostic()
1596 (*Info)->addSFINAEDiagnostic(DiagInfo.getLocation(), in EmitCurrentDiagnostic()
1618 // template-deduction information. in EmitCurrentDiagnostic()
1619 if (*Info && !(*Info)->hasSFINAEDiagnostic()) { in EmitCurrentDiagnostic()
1621 (*Info)->addSFINAEDiagnostic(DiagInfo.getLocation(), in EmitCurrentDiagnostic()
1633 // notes attached to it. in EmitCurrentDiagnostic()
1640 // template-deduction information; in EmitCurrentDiagnostic()
1643 (*Info)->addSuppressedDiagnostic(DiagInfo.getLocation(), in EmitCurrentDiagnostic()
1679 for (auto PDAt : Loc->second) { in hasUncompilableErrorOccurred()
1687 // known-callable function.
1695 S.Diags.Report(FnIt->second.Loc, diag::note_called_by)); in emitCallStackNotes()
1696 Builder << FnIt->second.FD; in emitCallStackNotes()
1697 FnIt = S.CUDA().DeviceKnownEmittedFns.find(FnIt->second.FD); in emitCallStackNotes()
1735 // Whether the function is already in the current use-path.
1738 // The current use-path.
1752 // it by 1. Non-zero value indicates it is currently in device context.
1763 --InOMPDeviceContext; in VisitOMPTargetDirective()
1776 assert(VD->isFileVarDecl() && in checkVar()
1777 "Should only check file-scope variables"); in checkVar()
1778 if (auto *Init = VD->getInit()) { in checkVar()
1784 this->Visit(Init); in checkVar()
1786 --InOMPDeviceContext; in checkVar()
1796 // Finalize analysis of OpenMP-specific constructs. in checkFunc()
1813 if (auto *S = FD->getBody()) { in checkFunc()
1814 this->Visit(S); in checkFunc()
1836 for (PartialDiagnosticAt &PDAt : It->second) { in emitDeferredDiags()
1862 ExternalSource->ReadDeclsToCheckForDeferredDiags( in emitDeferredDiags()
1874 // In CUDA, there are some constructs which may appear in semantically-valid
1884 // known-emitted function.
1886 // We also keep a partial call graph of which not-known-emitted functions call
1887 // which other not-known-emitted functions.
1891 // CheckCall), we first check if the current function is known-emitted. If
1895 // until we discover that the function is known-emitted, at which point we take
1934 // if Fn isn't a priori known-emitted. in ~SemaDiagnosticBuilder()
1982 if ((MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator()) && in checkTypeSupport()
1983 MD->isTrivial()) in checkTypeSupport()
1987 if (Ctor->isCopyOrMoveConstructor() && Ctor->isTrivial()) in checkTypeSupport()
1998 if (Ty->isDependentType()) in checkTypeSupport()
2001 if (Ty->isBitIntType()) { in checkTypeSupport()
2018 if (Ty->isRealFloatingType() && Context.getTypeSize(Ty) == 128) { in checkTypeSupport()
2027 if ((Ty->isFloat16Type() && !Context.getTargetInfo().hasFloat16Type()) || in checkTypeSupport()
2028 (Ty->isFloat128Type() && !Context.getTargetInfo().hasFloat128Type()) || in checkTypeSupport()
2029 (Ty->isIbm128Type() && !Context.getTargetInfo().hasIbm128Type()) || in checkTypeSupport()
2030 (Ty->isIntegerType() && Context.getTypeSize(Ty) == 128 && in checkTypeSupport()
2032 (Ty->isBFloat16Type() && !Context.getTargetInfo().hasBFloat16Type() && in checkTypeSupport()
2046 D->setInvalidDecl(); in checkTypeSupport()
2049 targetDiag(D->getLocation(), diag::note_defined_here, FD) << D; in checkTypeSupport()
2072 D->setInvalidDecl(); in checkTypeSupport()
2075 targetDiag(D->getLocation(), diag::note_defined_here, FD) << D; in checkTypeSupport()
2091 D->setInvalidDecl(); in checkTypeSupport()
2094 targetDiag(D->getLocation(), diag::note_defined_here, FD) << D; in checkTypeSupport()
2097 if (TI.hasRISCVVTypes() && Ty->isRVVSizelessBuiltinType() && FD) { in checkTypeSupport()
2104 if (Ty->isSVESizelessBuiltinType() && FD) { in checkTypeSupport()
2120 for (const auto &ParamTy : FPTy->param_types()) in checkTypeSupport()
2122 CheckType(FPTy->getReturnType(), /*IsRetTy=*/true); in checkTypeSupport()
2125 CheckType(FNPTy->getReturnType(), /*IsRetTy=*/true); in checkTypeSupport()
2150 Ctx = Ctx->getPrimaryContext(); in getScopeForContext()
2151 for (Scope *S = getCurScope(); S; S = S->getParent()) { in getScopeForContext()
2153 // out-of-line definitions of static class members. in getScopeForContext()
2154 if (S->getFlags() & (Scope::DeclScope | Scope::TemplateParamScope)) in getScopeForContext()
2155 if (DeclContext *Entity = S->getEntity()) in getScopeForContext()
2156 if (Ctx == Entity->getPrimaryContext()) in getScopeForContext()
2167 CachedFunctionScope->Clear(); in PushFunctionScope()
2191 LSI->AutoTemplateParameterDepth = Depth; in RecordParsingTemplateParameterDepth()
2195 "Remove assertion if intentionally called in a non-lambda context."); in RecordParsingTemplateParameterDepth()
2204 QualType T = VD->getType(); in checkEscapingByref()
2207 SourceLocation Loc = VD->getLocation(); in checkEscapingByref()
2230 if (const CXXRecordDecl *RD = T->getAsCXXRecordDecl()) in checkEscapingByref()
2231 if (CXXDestructorDecl *DD = RD->getDestructor()) { in checkEscapingByref()
2232 auto *FPT = DD->getType()->castAs<FunctionProtoType>(); in checkEscapingByref()
2237 static void markEscapingByrefs(const FunctionScopeInfo &FSI, Sema &S) { in markEscapingByrefs() argument
2240 for (const BlockDecl *BD : FSI.Blocks) { in markEscapingByrefs()
2241 for (const BlockDecl::Capture &BC : BD->captures()) { in markEscapingByrefs()
2243 if (VD->hasAttr<BlocksAttr>()) { in markEscapingByrefs()
2245 // non-escaping block. in markEscapingByrefs()
2246 if (BD->doesNotEscape()) in markEscapingByrefs()
2248 VD->setEscapingByref(); in markEscapingByrefs()
2251 // non-trivial C union type. in markEscapingByrefs()
2252 QualType CapType = BC.getVariable()->getType(); in markEscapingByrefs()
2255 S.checkNonTrivialCUnion(BC.getVariable()->getType(), in markEscapingByrefs()
2256 BD->getCaretLocation(), in markEscapingByrefs()
2262 for (VarDecl *VD : FSI.ByrefBlockVars) { in markEscapingByrefs()
2263 // __block variables might require us to capture a copy-initializer. in markEscapingByrefs()
2264 if (!VD->isEscapingByref()) in markEscapingByrefs()
2270 if (VD->getType()->isStructureOrClassType()) in markEscapingByrefs()
2288 // Issue any analysis-based warnings. in PopFunctionScopeInfo()
2292 for (const auto &PUD : Scope->PossiblyUnreachableDiags) in PopFunctionScopeInfo()
2300 if (!Scope->isPlainFunction()) in operator ()()
2301 Self->CapturingFunctionScopes--; in operator ()()
2303 if (Scope->isPlainFunction() && !Self->CachedFunctionScope) in operator ()()
2304 Self->CachedFunctionScope.reset(Scope); in operator ()()
2310 getCurFunction()->CompoundScopes.push_back( in PushCompoundScope()
2316 assert(!CurFunction->CompoundScopes.empty() && "mismatched push/pop"); in PopCompoundScope()
2318 CurFunction->CompoundScopes.pop_back(); in PopCompoundScope()
2322 return getCurFunction()->hasUnrecoverableErrorOccurred(); in hasAnyUnrecoverableErrorsInThisFunction()
2327 FunctionScopes.back()->setHasBranchIntoScope(); in setFunctionHasBranchIntoScope()
2332 FunctionScopes.back()->setHasBranchProtectedScope(); in setFunctionHasBranchProtectedScope()
2337 FunctionScopes.back()->setHasIndirectGoto(); in setFunctionHasIndirectGoto()
2342 FunctionScopes.back()->setHasMustTail(); in setFunctionHasMustTail()
2350 if (CurBSI && CurBSI->TheDecl && in getCurBlock()
2351 !CurBSI->TheDecl->Encloses(CurContext)) { in getCurBlock()
2364 for (int e = FunctionScopes.size() - 1; e >= 0; --e) { in getEnclosingFunction()
2375 if (LSI->Lambda && !LSI->Lambda->Encloses(CurContext) && in getEnclosingLambda()
2376 LSI->AfterParameterList) { in getEnclosingLambda()
2402 if (CurLSI && CurLSI->Lambda && CurLSI->CallOperator && in getCurLambda()
2403 !CurLSI->Lambda->Encloses(CurContext) && CurLSI->AfterParameterList) { in getCurLambda()
2416 return (LSI->TemplateParams.size() || in getCurGenericLambda()
2417 LSI->GLTemplateParameterList) ? LSI : nullptr; in getCurGenericLambda()
2481 // Ignore overloads that are pointer-to-member constants. in tryExprAsCall()
2495 for (OverloadExpr::decls_iterator it = Overloads->decls_begin(), in tryExprAsCall()
2496 DeclsEnd = Overloads->decls_end(); it != DeclsEnd; ++it) { in tryExprAsCall()
2499 // Check whether the function is a non-template, non-member which takes no in tryExprAsCall()
2504 = dyn_cast<FunctionDecl>((*it)->getUnderlyingDecl())) { in tryExprAsCall()
2505 if (OverloadDecl->getMinRequiredArguments() == 0) { in tryExprAsCall()
2507 (!IsMV || !(OverloadDecl->isCPUDispatchMultiVersion() || in tryExprAsCall()
2508 OverloadDecl->isCPUSpecificMultiVersion()))) { in tryExprAsCall()
2512 ZeroArgCallReturnTy = OverloadDecl->getReturnType(); in tryExprAsCall()
2513 IsMV = OverloadDecl->isCPUDispatchMultiVersion() || in tryExprAsCall()
2514 OverloadDecl->isCPUSpecificMultiVersion(); in tryExprAsCall()
2525 // Attempt to call the member with no arguments - this will correctly handle in tryExprAsCall()
2533 ZeroArgCallReturnTy = R.get()->getType(); in tryExprAsCall()
2540 if (const auto *Fun = dyn_cast<FunctionDecl>(DeclRef->getDecl())) { in tryExprAsCall()
2541 if (Fun->getMinRequiredArguments() == 0) in tryExprAsCall()
2542 ZeroArgCallReturnTy = Fun->getReturnType(); in tryExprAsCall()
2551 QualType PointeeTy = ExprTy->getPointeeType(); in tryExprAsCall()
2553 FunTy = PointeeTy->getAs<FunctionType>(); in tryExprAsCall()
2555 FunTy = ExprTy->getAs<FunctionType>(); in tryExprAsCall()
2558 if (FPT->getNumParams() == 0) in tryExprAsCall()
2559 ZeroArgCallReturnTy = FunTy->getReturnType(); in tryExprAsCall()
2572 /// \param Overloads - The overloads to note.
2573 /// \param FinalNoteLoc - If we've suppressed printing some overloads due to
2574 /// -fshow-overloads=best, this is the location to attach to the note about too
2576 /// ill-formed expression.
2588 const NamedDecl *Fn = (*It)->getUnderlyingDecl(); in noteOverloads()
2589 // Don't print overloads for non-default multiversioned functions. in noteOverloads()
2590 if (const auto *FD = Fn->getAsFunction()) { in noteOverloads()
2591 if (FD->isMultiVersion() && FD->hasAttr<TargetAttr>() && in noteOverloads()
2592 !FD->getAttr<TargetAttr>()->isDefaultVersion()) in noteOverloads()
2594 if (FD->isMultiVersion() && FD->hasAttr<TargetVersionAttr>() && in noteOverloads()
2595 !FD->getAttr<TargetVersionAttr>()->isDefaultVersion()) in noteOverloads()
2598 S.Diag(Fn->getLocation(), diag::note_possible_target_of_call); in noteOverloads()
2619 QualType OverloadResultTy = OverloadDecl->getReturnType(); in notePlausibleOverloads()
2631 E = E->IgnoreImplicit(); in IsCallableWithAppend()
2640 E = UO->getSubExpr(); in IsCPUDispatchCPUSpecificMultiVersion()
2643 if (ULE->getNumDecls() == 0) in IsCPUDispatchCPUSpecificMultiVersion()
2646 const NamedDecl *ND = *ULE->decls_begin(); in IsCPUDispatchCPUSpecificMultiVersion()
2648 return FD->isCPUDispatchMultiVersion() || FD->isCPUSpecificMultiVersion(); in IsCPUDispatchCPUSpecificMultiVersion()
2656 SourceLocation Loc = E.get()->getExprLoc(); in tryToRecoverWithCall()
2657 SourceRange Range = E.get()->getSourceRange(); in tryToRecoverWithCall()
2673 Diag(Loc, PD) << /*zero-arg*/ 1 << IsMV << Range in tryToRecoverWithCall()
2691 Diag(Loc, PD) << /*not zero-arg*/ 0 << IsMV << Range; in tryToRecoverWithCall()
2708 getDiagnostics(), S, CD, RD, CD->getContextParam(), K, in PushCapturedRegionScope()
2713 CSI->ReturnType = Context.VoidTy; in PushCapturedRegionScope()
2756 ND = ND->getUnderlyingDecl(); in isDeclaratorFunctionLike()
2780 cmp = -1; in FunctionEffectDifferences()
2785 cmp = -1; in FunctionEffectDifferences()
2842 // FIXME: Condition mismatches are too coarse right now -- expressions in shouldDiagnoseConversion()