[cfe-commits] r124048 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td include/clang/Sema/DeclSpec.h lib/Parse/ParseDeclCXX.cpp
Anders Carlsson
andersca at mac.com
Sat Jan 22 15:01:49 PST 2011
Author: andersca
Date: Sat Jan 22 17:01:49 2011
New Revision: 124048
URL: http://llvm.org/viewvc/llvm-project?rev=124048&view=rev
Log:
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!
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=124048&r1=124047&r2=124048&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Sat Jan 22 17:01:49 2011
@@ -390,6 +390,9 @@
"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<
Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=124048&r1=124047&r2=124048&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Sat Jan 22 17:01:49 2011
@@ -1492,13 +1492,12 @@
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 @@
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
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=124048&r1=124047&r2=124048&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sat Jan 22 17:01:49 2011
@@ -1272,7 +1272,7 @@
/// 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 @@
<< PrevSpec
<< FixItHint::CreateRemoval(Tok.getLocation());
+ if (!getLang().CPlusPlus0x)
+ Diag(Tok.getLocation(), diag::ext_override_control_keyword)
+ << VirtSpecifiers::getSpecifierName(Specifier);
ConsumeToken();
}
}
@@ -1327,7 +1330,7 @@
/// 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 @@
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();
}
}
More information about the cfe-commits
mailing list