From 4ebf1605166e0b6cc967a51429949a0722f79665 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 20 Jan 2011 06:29:02 +0000 Subject: [PATCH] Make CheckOverrideControl a member of Sema. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123893 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Sema/Sema.h | 3 +++ lib/Sema/SemaDeclCXX.cpp | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index a7fe528f06..0db20c97d8 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -2724,6 +2724,9 @@ public: bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange); + /// CheckOverrideControl - Check C++0x override control semantics. + void CheckOverrideControl(const Decl *D); + //===--------------------------------------------------------------------===// // C++ Access Control // diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 8fe4852890..9981b1f6c8 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -853,8 +853,7 @@ Decl *Sema::ActOnAccessSpecifier(AccessSpecifier Access, } /// CheckOverrideControl - Check C++0x override control semantics. -static void -CheckOverrideControl(Sema& SemaRef, const Decl *D) { +void Sema::CheckOverrideControl(const Decl *D) { const CXXMethodDecl *MD = llvm::dyn_cast(D); if (!MD || !MD->isVirtual()) return; @@ -866,7 +865,7 @@ CheckOverrideControl(Sema& SemaRef, const Decl *D) { bool HasOverriddenMethods = MD->begin_overridden_methods() != MD->end_overridden_methods(); if (MD->isMarkedOverride() && !HasOverriddenMethods) { - SemaRef.Diag(MD->getLocation(), + Diag(MD->getLocation(), diag::err_function_marked_override_not_overriding) << MD->getDeclName(); return; @@ -1029,7 +1028,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, MD->setIsMarkedFinal(true); } - CheckOverrideControl(*this, Member); + CheckOverrideControl(Member); assert((Name || isInstField) && "No identifier for non-field ?"); -- 2.40.0