Home | History | Annotate | Download | only in Sema

Lines Matching defs:MD

514         CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(New);
515 if (MD && MD->getParent()->getDescribedClassTemplate()) {
804 MD = dyn_cast<CXXMethodDecl>(NewFD);
805 if (MD && MD->isInstance()) {
810 const CXXRecordDecl *RD = MD->getParent();
1878 CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D);
1881 if (MD && MD->isInstance() &&
1882 (MD->getParent()->hasAnyDependentBases() ||
1883 MD->getType()->isDependentType()))
1886 if (MD && !MD->isVirtual()) {
1890 FindHiddenVirtualMethods(MD, OverloadedMethods);
1903 NoteHiddenVirtualMethods(MD, OverloadedMethods);
1904 MD->setInvalidDecl();
1911 if (!MD || !MD->isVirtual()) {
1933 MD->begin_overridden_methods() != MD->end_overridden_methods();
1934 if (MD->hasAttr<OverrideAttr>() && !HasOverriddenMethods)
1935 Diag(MD->getLocation(), diag::err_function_marked_override_not_overriding)
1936 << MD->getDeclName();
1942 CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D);
1943 if (!MD || MD->isImplicit() || MD->hasAttr<FinalAttr>() ||
1944 isa<CXXDestructorDecl>(MD))
1947 SourceLocation Loc = MD->getLocation();
1955 if (MD->size_overridden_methods() > 0) {
1956 Diag(MD->getLocation(), diag::warn_function_marked_not_override_overriding)
1957 << MD->getDeclName();
1958 const CXXMethodDecl *OMD = *MD->begin_overridden_methods();
2242 if (CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(Member))
2243 MD->setRangeEnd(VS.getLastLocation());
4625 CXXMethodDecl *MD) {
4628 if (MD->doesThisDeclarationHaveABody())
4634 if (TypeSourceInfo *TSI = MD->getTypeSourceInfo())
4635 Info.CheckType(MD, TSI->getTypeLoc(), Sema::AbstractNone);
4686 auto *MD = dyn_cast<CXXMethodDecl>(Member);
4687 if (!MD)
4691 if (MD->isUserProvided()) {
4698 S.MarkFunctionReferenced(Class->getLocation(), MD);
4702 } else if (!MD->isTrivial() || MD->isExplicitlyDefaulted() ||
4703 MD->isCopyAssignmentOperator() ||
4704 MD->isMoveAssignmentOperator()) {
4710 S.MarkFunctionReferenced(Class->getLocation(), MD);
4719 S.Consumer.HandleTopLevelDecl(DeclGroupRef(MD));
4793 CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(Member);
4796 if (!VD && !MD)
4799 if (MD) {
4801 if (MD->isDeleted())
4804 if (MD->isInlined()) {
4811 if (ClassImported && MD->isMoveAssignmentOperator() &&
5168 computeImplicitExceptionSpec(Sema &S, SourceLocation Loc, CXXMethodDecl *MD) {
5169 switch (S.getSpecialMember(MD)) {
5171 MD);
5173 return S.ComputeDefaultedCopyCtorExceptionSpec(MD);
5175 return S.ComputeDefaultedCopyAssignmentExceptionSpec(MD);
5177 return S.ComputeDefaultedMoveCtorExceptionSpec(MD);
5179 return S.ComputeDefaultedMoveAssignmentExceptionSpec(MD);
5181 return S.ComputeDefaultedDtorExceptionSpec(MD);
5185 assert(cast<CXXConstructorDecl>(MD)->getInheritedConstructor() &&
5187 return S.ComputeInheritingCtorExceptionSpec(cast<CXXConstructorDecl>(MD));
5191 CXXMethodDecl *MD) {
5196 EPI.ExceptionSpec.SourceDecl = MD;
5205 void Sema::EvaluateImplicitExceptionSpec(SourceLocation Loc, CXXMethodDecl *MD) {
5206 const FunctionProtoType *FPT = MD->getType()->castAs<FunctionProtoType>();
5211 auto ESI = computeImplicitExceptionSpec(*this, Loc, MD).getExceptionSpec();
5214 UpdateExceptionSpec(MD, ESI);
5220 MD->getCanonicalDecl()->getType()->castAs<FunctionProtoType>();
5222 UpdateExceptionSpec(MD->getCanonicalDecl(), ESI);
5225 void Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD) {
5226 CXXRecordDecl *RD = MD->getParent();
5227 CXXSpecialMember CSM = getSpecialMember(MD);
5229 assert(MD->isExplicitlyDefaulted() && CSM != CXXInvalid &&
5234 bool First = MD == MD->getCanonicalDecl();
5248 if (MD->getNumParams() != ExpectedParams) {
5252 Diag(MD->getLocation(), diag::err_defaulted_special_member_params)
5253 << CSM << MD->getSourceRange();
5255 } else if (MD->isVariadic()) {
5256 Diag(MD->getLocation(), diag::err_defaulted_special_member_variadic)
5257 << CSM << MD->getSourceRange();
5261 const FunctionProtoType *Type = MD->getType()->getAs<FunctionProtoType>();
5276 Diag(MD->getLocation(), diag::err_defaulted_special_member_return_type)
5283 Diag(MD->getLocation(), diag::err_defaulted_special_member_quals)
5298 Diag(MD->getLocation(),
5305 Diag(MD->getLocation(),
5310 Diag(MD->getLocation(),
5320 Diag(MD->getLocation(), diag::err_defaulted_copy_assign_not_ref);
5333 if ((getLangOpts().CPlusPlus14 ? !isa<CXXDestructorDecl>(MD)
5334 : isa<CXXConstructorDecl>(MD)) &&
5335 MD->isConstexpr() && !Constexpr &&
5336 MD->getTemplatedKind() == FunctionDecl::TK_NonTemplate) {
5337 Diag(MD->getLocStart(), diag::err_incorrect_defaulted_constexpr) << CSM;
5351 InstantiateExceptionSpec(MD->getLocStart(), MD);
5352 Type = MD->getType()->getAs<FunctionProtoType>();
5354 DelayedDefaultedMemberExceptionSpecs.push_back(std::make_pair(MD, Type));
5356 CheckExplicitlyDefaultedMemberExceptionSpec(MD, Type);
5363 MD->setConstexpr(Constexpr);
5369 EPI.ExceptionSpec.SourceDecl = MD;
5370 MD->setType(Context.getFunctionType(ReturnType,
5376 if (ShouldDeleteSpecialMember(MD, CSM)) {
5378 SetDeclDeleted(MD, MD->getLocation());
5383 Diag(MD->getLocation(), diag::err_out_of_line_default_deletes) << CSM;
5384 ShouldDeleteSpecialMember(MD, CSM, /*Diagnose*/true);
5390 MD->setInvalidDecl();
5398 CXXMethodDecl *MD, const FunctionProtoType *SpecifiedType) {
5403 MD->getTypeSourceInfo()->getType()->castAs<FunctionProtoType>();
5409 EPI.ExceptionSpec = computeImplicitExceptionSpec(*this, MD->getLocation(), MD)
5417 << getSpecialMember(MD), PDiag(),
5419 SpecifiedType, MD->getLocation());
5443 CXXMethodDecl *MD;
5453 SpecialMemberDeletionInfo(Sema &S, CXXMethodDecl *MD,
5455 : S(S), MD(MD), CSM(CSM), Diagnose(Diagnose),
5457 ConstArg(false), Loc(MD->getLocation()),
5481 if (MD->getNumParams()) {
5483 MD->getParamDecl(0)->getType()->getAs<ReferenceType>())
5488 bool inUnion() const { return MD->getParent()->isUnion(); }
5522 objectTy = S.Context.getTypeDeclType(MD->getParent());
5566 << CSM << MD->getParent() << /*IsField*/true
5572 << CSM << MD->getParent() << /*IsField*/false
5644 << MD->getParent() << FD << FieldType << /*Reference*/0;
5656 << MD->getParent() << FD << FD->getType() << /*Const*/1;
5668 << MD->getParent() << FD << FieldType;
5676 << IsMove << MD->getParent() << FD << FieldType << /*Reference*/0;
5684 << IsMove << MD->getParent() << FD << FD->getType() << /*Const*/1;
5715 << MD->getParent() << /*anonymous union*/1;
5739 !MD->getParent()->field_empty()) {
5741 S.Diag(MD->getParent()->getLocation(),
5743 << MD->getParent() << /*not anonymous union*/0;
5752 bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM,
5754 if (MD->isInvalidDecl())
5756 CXXRecordDecl *RD = MD->getParent();
5783 if (MD->isImplicit() &&
5825 ContextRAII MethodContext(*this, MD);
5830 if (CSM == CXXDestructor && MD->isVirtual()) {
5834 if (FindDeallocationFunction(MD->getLocation(), MD->getParent(), Name,
5842 SpecialMemberDeletionInfo SMI(*this, MD, CSM, Diagnose);
5868 return inferCUDATargetForImplicitSpecialMember(RD, CSM, MD, SMI.ConstArg,
6139 bool Sema::SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM,
6141 assert(!MD->isUserProvided() && CSM != CXXInvalid && "not special enough");
6143 CXXRecordDecl *RD = MD->getParent();
6160 const ParmVarDecl *Param0 = MD->getParamDecl(0);
6176 const ParmVarDecl *Param0 = MD->getParamDecl(0);
6193 if (MD->getMinRequiredArguments() < MD->getNumParams()) {
6195 Diag(MD->getParamDecl(MD->getMinRequiredArguments())->getLocation(),
6197 << MD->getParamDecl(MD->getMinRequiredArguments())->getSourceRange();
6200 if (MD->isVariadic()) {
6202 Diag(MD->getLocation(), diag::note_nontrivial_variadic);
6238 if (CSM == CXXDestructor && MD->isVirtual()) {
6240 Diag(MD->getLocation(), diag::note_nontrivial_virtual_dtor) << RD;
6247 if (CSM != CXXDestructor && MD->getParent()->isDynamicClass()) {
6284 /// Check whether any most overriden method from MD in Methods
6286 const CXXMethodDecl *MD,
6288 if (MD->size_overridden_methods() == 0)
6289 return Methods.count(MD->getCanonicalDecl());
6290 for (CXXMethodDecl::method_iterator I = MD->begin_overridden_methods(),
6291 E = MD->end_overridden_methods();
6314 if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) {
6315 MD = MD->getCanonicalDecl();
6318 if (!MD->isVirtual())
6330 if (!S->IsOverload(Method, MD, false))
6333 if (!CheckMostOverridenMethods(MD, OverridenAndUsingBaseMethods))
6334 overloadedMethods.push_back(MD);
6346 /// \brief Add the most overriden methods from MD to Methods
6347 static void AddMostOverridenMethods(const CXXMethodDecl *MD,
6349 if (MD->size_overridden_methods() == 0)
6350 Methods.insert(MD->getCanonicalDecl());
6351 for (CXXMethodDecl::method_iterator I = MD->begin_overridden_methods(),
6352 E = MD->end_overridden_methods();
6359 void Sema::FindHiddenVirtualMethods(CXXMethodDecl *MD,
6361 if (!MD->getDeclName().isIdentifier())
6368 FHVM.Method = MD;
6373 CXXRecordDecl *DC = MD->getParent();
6374 DeclContext::lookup_result R = DC->lookup(MD->getDeclName());
6379 if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(ND))
6380 AddMostOverridenMethods(MD, FHVM.OverridenAndUsingBaseMethods);
6387 void Sema::NoteHiddenVirtualMethods(CXXMethodDecl *MD,
6393 HandleFunctionTypeMismatch(PD, MD->getType(), overloadedMD->getType());
6400 void Sema::DiagnoseHiddenVirtualMethods(CXXMethodDecl *MD) {
6401 if (MD->isInvalidDecl())
6404 if (Diags.isIgnored(diag::warn_overloaded_virtual, MD->getLocation()))
6408 FindHiddenVirtualMethods(MD, OverloadedMethods);
6410 Diag(MD->getLocation(), diag::warn_overloaded_virtual)
6411 << MD << (OverloadedMethods.size() > 1);
6413 NoteHiddenVirtualMethods(MD, OverloadedMethods);
8728 CXXMethodDecl *MD) {
8729 CXXRecordDecl *ClassDecl = MD->getParent();
9315 Sema::ComputeDefaultedDtorExceptionSpec(CXXMethodDecl *MD) {
9316 CXXRecordDecl *ClassDecl = MD->getParent();
9967 Sema::ComputeDefaultedCopyAssignmentExceptionSpec(CXXMethodDecl *MD) {
9968 CXXRecordDecl *ClassDecl = MD->getParent();
9974 const FunctionProtoType *T = MD->getType()->castAs<FunctionProtoType>();
10365 Sema::ComputeDefaultedMoveAssignmentExceptionSpec(CXXMethodDecl *MD) {
10366 CXXRecordDecl *ClassDecl = MD->getParent();
10801 Sema::ComputeDefaultedCopyCtorExceptionSpec(CXXMethodDecl *MD) {
10802 CXXRecordDecl *ClassDecl = MD->getParent();
10808 const FunctionProtoType *T = MD->getType()->castAs<FunctionProtoType>();
10971 Sema::ComputeDefaultedMoveCtorExceptionSpec(CXXMethodDecl *MD) {
10972 CXXRecordDecl *ClassDecl = MD->getParent();
12817 if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(Fn)) {
12819 for (CXXMethodDecl::method_iterator I = MD->begin_overridden_methods(),
12820 E = MD->end_overridden_methods();
12822 if (!(*MD->begin_overridden_methods())->isDeleted()) {
12824 Diag(DelLoc, diag::err_deleted_override) << MD->getDeclName();
12841 CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(Dcl);
12843 if (MD) {
12844 if (MD->getParent()->isDependentType()) {
12845 MD->setDefaulted();
12846 MD->setExplicitlyDefaulted();
12850 CXXSpecialMember Member = getSpecialMember(MD);
12852 if (!MD->isInvalidDecl())
12857 MD->setDefaulted();
12858 MD->setExplicitlyDefaulted();
12862 const FunctionDecl *Primary = MD;
12863 if (const FunctionDecl *Pattern = MD->getTemplateInstantiationPattern())
12874 CheckExplicitlyDefaultedSpecialMember(MD);
12876 if (MD->isInvalidDecl())
12882 cast<CXXConstructorDecl>(MD));
12885 DefineImplicitCopyConstructor(DefaultLoc, cast<CXXConstructorDecl>(MD));
12888 DefineImplicitCopyAssignment(DefaultLoc, MD);
12891 DefineImplicitDestructor(DefaultLoc, cast<CXXDestructorDecl>(MD));
12894 DefineImplicitMoveConstructor(DefaultLoc, cast<CXXConstructorDecl>(MD));
12897 DefineImplicitMoveAssignment(DefaultLoc, MD);