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>;
|
"deleted function definition accepted as a C++0x extension">, InGroup<CXX0x>;
|
||||||
|
|
||||||
// C++0x override control
|
// 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<
|
def err_duplicate_virt_specifier : Error<
|
||||||
"class member already marked '%0'">;
|
"class member already marked '%0'">;
|
||||||
def err_duplicate_class_virt_specifier : Error<
|
def err_duplicate_class_virt_specifier : Error<
|
||||||
|
|
|
@ -1492,13 +1492,12 @@ public:
|
||||||
bool isNewSpecified() const { return Specifiers & VS_New; }
|
bool isNewSpecified() const { return Specifiers & VS_New; }
|
||||||
SourceLocation getNewLoc() const { return VS_newLoc; }
|
SourceLocation getNewLoc() const { return VS_newLoc; }
|
||||||
|
|
||||||
|
static const char *getSpecifierName(Specifier VS);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned Specifiers;
|
unsigned Specifiers;
|
||||||
|
|
||||||
SourceLocation VS_overrideLoc, VS_finalLoc, VS_newLoc;
|
SourceLocation VS_overrideLoc, VS_finalLoc, VS_newLoc;
|
||||||
|
|
||||||
static const char *getSpecifierName(Specifier VS);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// ClassVirtSpecifiers - Represents a C++0x class-virt-specifier-seq.
|
/// ClassVirtSpecifiers - Represents a C++0x class-virt-specifier-seq.
|
||||||
|
@ -1521,12 +1520,12 @@ public:
|
||||||
bool isExplicitSpecified() const { return Specifiers & CVS_Explicit; }
|
bool isExplicitSpecified() const { return Specifiers & CVS_Explicit; }
|
||||||
SourceLocation getExplicitLoc() const { return CVS_explicitLoc; }
|
SourceLocation getExplicitLoc() const { return CVS_explicitLoc; }
|
||||||
|
|
||||||
|
static const char *getSpecifierName(Specifier CVS);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned Specifiers;
|
unsigned Specifiers;
|
||||||
|
|
||||||
SourceLocation CVS_finalLoc, CVS_explicitLoc;
|
SourceLocation CVS_finalLoc, CVS_explicitLoc;
|
||||||
|
|
||||||
static const char *getSpecifierName(Specifier CVS);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace clang
|
} // end namespace clang
|
||||||
|
|
|
@ -1272,7 +1272,7 @@ void Parser::HandleMemberFunctionDefaultArgs(Declarator& DeclaratorInfo,
|
||||||
/// final
|
/// final
|
||||||
/// new
|
/// new
|
||||||
VirtSpecifiers::Specifier Parser::isCXX0XVirtSpecifier() const {
|
VirtSpecifiers::Specifier Parser::isCXX0XVirtSpecifier() const {
|
||||||
if (!getLang().CPlusPlus0x)
|
if (!getLang().CPlusPlus)
|
||||||
return VirtSpecifiers::VS_None;
|
return VirtSpecifiers::VS_None;
|
||||||
|
|
||||||
if (Tok.is(tok::kw_new))
|
if (Tok.is(tok::kw_new))
|
||||||
|
@ -1316,6 +1316,9 @@ void Parser::ParseOptionalCXX0XVirtSpecifierSeq(VirtSpecifiers &VS) {
|
||||||
<< PrevSpec
|
<< PrevSpec
|
||||||
<< FixItHint::CreateRemoval(Tok.getLocation());
|
<< FixItHint::CreateRemoval(Tok.getLocation());
|
||||||
|
|
||||||
|
if (!getLang().CPlusPlus0x)
|
||||||
|
Diag(Tok.getLocation(), diag::ext_override_control_keyword)
|
||||||
|
<< VirtSpecifiers::getSpecifierName(Specifier);
|
||||||
ConsumeToken();
|
ConsumeToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1327,7 +1330,7 @@ void Parser::ParseOptionalCXX0XVirtSpecifierSeq(VirtSpecifiers &VS) {
|
||||||
/// final
|
/// final
|
||||||
/// explicit
|
/// explicit
|
||||||
ClassVirtSpecifiers::Specifier Parser::isCXX0XClassVirtSpecifier() const {
|
ClassVirtSpecifiers::Specifier Parser::isCXX0XClassVirtSpecifier() const {
|
||||||
if (!getLang().CPlusPlus0x)
|
if (!getLang().CPlusPlus)
|
||||||
return ClassVirtSpecifiers::CVS_None;
|
return ClassVirtSpecifiers::CVS_None;
|
||||||
|
|
||||||
if (Tok.is(tok::kw_explicit))
|
if (Tok.is(tok::kw_explicit))
|
||||||
|
@ -1368,6 +1371,11 @@ void Parser::ParseOptionalCXX0XClassVirtSpecifierSeq(ClassVirtSpecifiers &CVS) {
|
||||||
Diag(Tok.getLocation(), diag::err_duplicate_class_virt_specifier)
|
Diag(Tok.getLocation(), diag::err_duplicate_class_virt_specifier)
|
||||||
<< PrevSpec
|
<< PrevSpec
|
||||||
<< FixItHint::CreateRemoval(Tok.getLocation());
|
<< FixItHint::CreateRemoval(Tok.getLocation());
|
||||||
|
|
||||||
|
if (!getLang().CPlusPlus0x)
|
||||||
|
Diag(Tok.getLocation(), diag::ext_override_control_keyword)
|
||||||
|
<< ClassVirtSpecifiers::getSpecifierName(Specifier);
|
||||||
|
|
||||||
ConsumeToken();
|
ConsumeToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue