@@ -2748,8 +2748,7 @@ void Sema::CheckOverrideControl(NamedDecl *D) {
2748
2748
// If a function is marked with the virt-specifier override and
2749
2749
// does not override a member function of a base class, the program is
2750
2750
// ill-formed.
2751
- bool HasOverriddenMethods =
2752
- MD->begin_overridden_methods() != MD->end_overridden_methods();
2751
+ bool HasOverriddenMethods = MD->size_overridden_methods() != 0;
2753
2752
if (MD->hasAttr<OverrideAttr>() && !HasOverriddenMethods)
2754
2753
Diag(MD->getLocation(), diag::err_function_marked_override_not_overriding)
2755
2754
<< MD->getDeclName();
@@ -7424,10 +7423,8 @@ struct FindHiddenVirtualMethod {
7424
7423
const llvm::SmallPtrSetImpl<const CXXMethodDecl *> &Methods) {
7425
7424
if (MD->size_overridden_methods() == 0)
7426
7425
return Methods.count(MD->getCanonicalDecl());
7427
- for (CXXMethodDecl::method_iterator I = MD->begin_overridden_methods(),
7428
- E = MD->end_overridden_methods();
7429
- I != E; ++I)
7430
- if (CheckMostOverridenMethods(*I, Methods))
7426
+ for (const CXXMethodDecl *O : MD->overridden_methods())
7427
+ if (CheckMostOverridenMethods(O, Methods))
7431
7428
return true;
7432
7429
return false;
7433
7430
}
@@ -7485,10 +7482,9 @@ static void AddMostOverridenMethods(const CXXMethodDecl *MD,
7485
7482
llvm::SmallPtrSetImpl<const CXXMethodDecl *>& Methods) {
7486
7483
if (MD->size_overridden_methods() == 0)
7487
7484
Methods.insert(MD->getCanonicalDecl());
7488
- for (CXXMethodDecl::method_iterator I = MD->begin_overridden_methods(),
7489
- E = MD->end_overridden_methods();
7490
- I != E; ++I)
7491
- AddMostOverridenMethods(*I, Methods);
7485
+ else
7486
+ for (const CXXMethodDecl *O : MD->overridden_methods())
7487
+ AddMostOverridenMethods(O, Methods);
7492
7488
}
7493
7489
7494
7490
/// \brief Check if a method overloads virtual methods in a base class without
@@ -14062,15 +14058,13 @@ void Sema::SetDeclDeleted(Decl *Dcl, SourceLocation DelLoc) {
14062
14058
// non-deleted virtual function.
14063
14059
if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(Fn)) {
14064
14060
bool IssuedDiagnostic = false;
14065
- for (CXXMethodDecl::method_iterator I = MD->begin_overridden_methods(),
14066
- E = MD->end_overridden_methods();
14067
- I != E; ++I) {
14061
+ for (const CXXMethodDecl *O : MD->overridden_methods()) {
14068
14062
if (!(*MD->begin_overridden_methods())->isDeleted()) {
14069
14063
if (!IssuedDiagnostic) {
14070
14064
Diag(DelLoc, diag::err_deleted_override) << MD->getDeclName();
14071
14065
IssuedDiagnostic = true;
14072
14066
}
14073
- Diag((*I) ->getLocation(), diag::note_overridden_virtual_function);
14067
+ Diag(O ->getLocation(), diag::note_overridden_virtual_function);
14074
14068
}
14075
14069
}
14076
14070
// If this function was implicitly deleted because it was defaulted,
@@ -14981,10 +14975,8 @@ void Sema::actOnDelayedExceptionSpecification(Decl *MethodD,
14981
14975
14982
14976
if (Method->isVirtual()) {
14983
14977
// Check overrides, which we previously had to delay.
14984
- for (CXXMethodDecl::method_iterator O = Method->begin_overridden_methods(),
14985
- OEnd = Method->end_overridden_methods();
14986
- O != OEnd; ++O)
14987
- CheckOverridingFunctionExceptionSpec(Method, *O);
14978
+ for (const CXXMethodDecl *O : Method->overridden_methods())
14979
+ CheckOverridingFunctionExceptionSpec(Method, O);
14988
14980
}
14989
14981
}
14990
14982
0 commit comments