forked from OSchip/llvm-project
Accept the C++0x override control keywords as an extension in C++98. This is OK since the new syntax is unambiguous and can't be confused with C++98 syntax. If anyone disagrees, please shout!
llvm-svn: 124048
This commit is contained in:
parent
7d59a68330
commit
5a72fdb05b
|
@ -390,6 +390,9 @@ def warn_deleted_function_accepted_as_extension: ExtWarn<
|
|||
"deleted function definition accepted as a C++0x extension">, InGroup<CXX0x>;
|
||||
|
||||
// C++0x override control
|
||||
def ext_override_control_keyword : Extension<
|
||||
"'%0' keyword accepted as a C++0x extension">, InGroup<CXX0x>;
|
||||
|
||||
def err_duplicate_virt_specifier : Error<
|
||||
"class member already marked '%0'">;
|
||||
def err_duplicate_class_virt_specifier : Error<
|
||||
|
|
|
@ -1492,13 +1492,12 @@ public:
|
|||
bool isNewSpecified() const { return Specifiers & VS_New; }
|
||||
SourceLocation getNewLoc() const { return VS_newLoc; }
|
||||
|
||||
static const char *getSpecifierName(Specifier VS);
|
||||
|
||||
private:
|
||||
unsigned Specifiers;
|
||||
|
||||
SourceLocation VS_overrideLoc, VS_finalLoc, VS_newLoc;
|
||||
|
||||
static const char *getSpecifierName(Specifier VS);
|
||||
|
||||
};
|
||||
|
||||
/// ClassVirtSpecifiers - Represents a C++0x class-virt-specifier-seq.
|
||||
|
@ -1521,12 +1520,12 @@ public:
|
|||
bool isExplicitSpecified() const { return Specifiers & CVS_Explicit; }
|
||||
SourceLocation getExplicitLoc() const { return CVS_explicitLoc; }
|
||||
|
||||
static const char *getSpecifierName(Specifier CVS);
|
||||
|
||||
private:
|
||||
unsigned Specifiers;
|
||||
|
||||
SourceLocation CVS_finalLoc, CVS_explicitLoc;
|
||||
|
||||
static const char *getSpecifierName(Specifier CVS);
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
|
|
@ -1272,7 +1272,7 @@ void Parser::HandleMemberFunctionDefaultArgs(Declarator& DeclaratorInfo,
|
|||
/// final
|
||||
/// new
|
||||
VirtSpecifiers::Specifier Parser::isCXX0XVirtSpecifier() const {
|
||||
if (!getLang().CPlusPlus0x)
|
||||
if (!getLang().CPlusPlus)
|
||||
return VirtSpecifiers::VS_None;
|
||||
|
||||
if (Tok.is(tok::kw_new))
|
||||
|
@ -1316,6 +1316,9 @@ void Parser::ParseOptionalCXX0XVirtSpecifierSeq(VirtSpecifiers &VS) {
|
|||
<< PrevSpec
|
||||
<< FixItHint::CreateRemoval(Tok.getLocation());
|
||||
|
||||
if (!getLang().CPlusPlus0x)
|
||||
Diag(Tok.getLocation(), diag::ext_override_control_keyword)
|
||||
<< VirtSpecifiers::getSpecifierName(Specifier);
|
||||
ConsumeToken();
|
||||
}
|
||||
}
|
||||
|
@ -1327,7 +1330,7 @@ void Parser::ParseOptionalCXX0XVirtSpecifierSeq(VirtSpecifiers &VS) {
|
|||
/// final
|
||||
/// explicit
|
||||
ClassVirtSpecifiers::Specifier Parser::isCXX0XClassVirtSpecifier() const {
|
||||
if (!getLang().CPlusPlus0x)
|
||||
if (!getLang().CPlusPlus)
|
||||
return ClassVirtSpecifiers::CVS_None;
|
||||
|
||||
if (Tok.is(tok::kw_explicit))
|
||||
|
@ -1368,6 +1371,11 @@ void Parser::ParseOptionalCXX0XClassVirtSpecifierSeq(ClassVirtSpecifiers &CVS) {
|
|||
Diag(Tok.getLocation(), diag::err_duplicate_class_virt_specifier)
|
||||
<< PrevSpec
|
||||
<< FixItHint::CreateRemoval(Tok.getLocation());
|
||||
|
||||
if (!getLang().CPlusPlus0x)
|
||||
Diag(Tok.getLocation(), diag::ext_override_control_keyword)
|
||||
<< ClassVirtSpecifiers::getSpecifierName(Specifier);
|
||||
|
||||
ConsumeToken();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue