Implement some suggestions by Daniel:
-Change Parser::ParseCXXScopeSpecifier to MaybeParseCXXScopeSpecifier
-Remove Parser::isTokenCXXScopeSpecifier and fold it into MaybeParseCXXScopeSpecifier
-Rename Parser::TryAnnotateScopeToken to TryAnnotateCXXScopeToken and only allow it to be called when in C++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60117 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 278c80f..71353d2 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -427,7 +427,7 @@
// Only annotate C++ scope. Allow class-name as an identifier in case
// it's a constructor.
if (getLang().CPlusPlus)
- TryAnnotateScopeToken();
+ TryAnnotateCXXScopeToken();
switch (Tok.getKind()) {
default:
@@ -985,8 +985,7 @@
Attr = ParseAttributes();
CXXScopeSpec SS;
- if (isTokenCXXScopeSpecifier()) {
- ParseCXXScopeSpecifier(SS);
+ if (getLang().CPlusPlus && MaybeParseCXXScopeSpecifier(SS)) {
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_ident);
if (Tok.isNot(tok::l_brace)) {
@@ -1435,8 +1434,8 @@
CXXScopeSpec &SS = D.getCXXScopeSpec();
DeclaratorScopeObj DeclScopeObj(*this, SS);
- if (D.mayHaveIdentifier() && isTokenCXXScopeSpecifier()) {
- ParseCXXScopeSpecifier(SS);
+ if (D.mayHaveIdentifier() &&
+ getLang().CPlusPlus && MaybeParseCXXScopeSpecifier(SS)) {
// Change the declaration context for name lookup, until this function is
// exited (and the declarator has been parsed).
DeclScopeObj.EnterDeclaratorScope();