aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2011-03-25 14:31:08 +0000
committerAnders Carlsson <andersca@mac.com>2011-03-25 14:31:08 +0000
commit2c3ee54e51d835a35bbf781c69e17f39e2ba0480 (patch)
tree9c85db7b678ad52eb7d33a0897771213135f9937 /lib
parent16625e188771891e09b4b906918e27a824f3f6a6 (diff)
Get rid of handling of the 'explicit' keyword from class-head. We still parse it though, although that will change shortly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128277 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Parse/ParseDeclCXX.cpp5
-rw-r--r--lib/Sema/SemaDecl.cpp8
-rw-r--r--lib/Sema/SemaDeclCXX.cpp20
3 files changed, 7 insertions, 26 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index c50ff4c9db..988ac84223 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -1777,8 +1777,11 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
SourceLocation LBraceLoc = ConsumeBrace();
+ SourceLocation FinalLoc =
+ CVS.isFinalSpecified() ? CVS.getFinalLoc() : SourceLocation();
+
if (TagDecl)
- Actions.ActOnStartCXXMemberDeclarations(getCurScope(), TagDecl, CVS,
+ Actions.ActOnStartCXXMemberDeclarations(getCurScope(), TagDecl, FinalLoc,
LBraceLoc);
// C++ 11p3: Members of a class defined with the keyword class are private
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 6f98461f44..5a4df400f3 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -6714,7 +6714,7 @@ void Sema::ActOnTagStartDefinition(Scope *S, Decl *TagD) {
}
void Sema::ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagD,
- ClassVirtSpecifiers &CVS,
+ SourceLocation FinalLoc,
SourceLocation LBraceLoc) {
AdjustDeclIfTemplate(TagD);
CXXRecordDecl *Record = cast<CXXRecordDecl>(TagD);
@@ -6724,10 +6724,8 @@ void Sema::ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagD,
if (!Record->getIdentifier())
return;
- if (CVS.isFinalSpecified())
- Record->addAttr(new (Context) FinalAttr(CVS.getFinalLoc(), Context));
- if (CVS.isExplicitSpecified())
- Record->addAttr(new (Context) ExplicitAttr(CVS.getExplicitLoc(), Context));
+ if (FinalLoc.isValid())
+ Record->addAttr(new (Context) FinalAttr(FinalLoc, Context));
// C++ [class]p2:
// [...] The class-name is also inserted into the scope of the
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index db77d10421..3515ad4ed3 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -919,26 +919,6 @@ void Sema::CheckOverrideControl(const Decl *D) {
<< MD->getDeclName();
return;
}
-
- // C++0x [class.derived]p8:
- // In a class definition marked with the class-virt-specifier explicit,
- // if a virtual member function that is neither implicitly-declared nor a
- // destructor overrides a member function of a base class and it is not
- // marked with the virt-specifier override, the program is ill-formed.
- if (MD->getParent()->hasAttr<ExplicitAttr>() && !isa<CXXDestructorDecl>(MD) &&
- HasOverriddenMethods && !MD->hasAttr<OverrideAttr>()) {
- llvm::SmallVector<const CXXMethodDecl*, 4>
- OverriddenMethods(MD->begin_overridden_methods(),
- MD->end_overridden_methods());
-
- Diag(MD->getLocation(), diag::err_function_overriding_without_override)
- << MD->getDeclName()
- << (unsigned)OverriddenMethods.size();
-
- for (unsigned I = 0; I != OverriddenMethods.size(); ++I)
- Diag(OverriddenMethods[I]->getLocation(),
- diag::note_overridden_virtual_function);
- }
}
/// CheckIfOverriddenFunctionIsMarkedFinal - Checks whether a virtual member