aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Parse/Parser.h15
-rw-r--r--lib/Parse/ParseDecl.cpp18
-rw-r--r--lib/Parse/ParseDeclCXX.cpp6
-rw-r--r--lib/Parse/ParseExprCXX.cpp17
-rw-r--r--lib/Parse/Parser.cpp4
5 files changed, 31 insertions, 29 deletions
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index 389d2b390b..191613bbcb 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -608,11 +608,12 @@ private:
// C++ Expressions
OwningExprResult ParseCXXIdExpression();
- /// MaybeParseCXXScopeSpecifier - Parse global scope or nested-name-specifier.
- /// Returns true if a nested-name-specifier was parsed from the token stream.
- /// Note that this routine will not parse ::new or ::delete.
+ /// ParseOptionalCXXScopeSpecifier - Parse global scope or
+ /// nested-name-specifier if present. Returns true if a nested-name-specifier
+ /// was parsed from the token stream. Note that this routine will not parse
+ /// ::new or ::delete, it will just leave them in the token stream.
///
- bool MaybeParseCXXScopeSpecifier(CXXScopeSpec &SS);
+ bool ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS);
//===--------------------------------------------------------------------===//
// C++ 5.2p1: C++ Casts
@@ -763,9 +764,9 @@ private:
SourceLocation L, SourceLocation R);
void ParseDeclarationSpecifiers(DeclSpec &DS,
TemplateParameterLists *TemplateParams = 0);
- bool MaybeParseTypeSpecifier(DeclSpec &DS, int &isInvalid,
- const char *&PrevSpec,
- TemplateParameterLists *TemplateParams = 0);
+ bool ParseOptionalTypeSpecifier(DeclSpec &DS, int &isInvalid,
+ const char *&PrevSpec,
+ TemplateParameterLists *TemplateParams = 0);
void ParseSpecifierQualifierList(DeclSpec &DS);
void ParseObjCTypeQualifierList(ObjCDeclSpec &DS);
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 5e753a2c9e..3b65ee0ba7 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -449,7 +449,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
default:
// Try to parse a type-specifier; if we found one, continue. If it's not
// a type, this falls through.
- if (MaybeParseTypeSpecifier(DS, isInvalid, PrevSpec, TemplateParams))
+ if (ParseOptionalTypeSpecifier(DS, isInvalid, PrevSpec, TemplateParams))
continue;
DoneWithDeclSpec:
@@ -660,7 +660,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
}
}
-/// MaybeParseTypeSpecifier - Try to parse a single type-specifier. We
+/// ParseOptionalTypeSpecifier - Try to parse a single type-specifier. We
/// primarily follow the C++ grammar with additions for C99 and GNU,
/// which together subsume the C grammar. Note that the C++
/// type-specifier also includes the C type-qualifier (for const,
@@ -702,9 +702,9 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
/// [GNU] typeof-specifier
/// [OBJC] class-name objc-protocol-refs[opt] [TODO]
/// [OBJC] typedef-name objc-protocol-refs[opt] [TODO]
-bool Parser::MaybeParseTypeSpecifier(DeclSpec &DS, int& isInvalid,
- const char *&PrevSpec,
- TemplateParameterLists *TemplateParams) {
+bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, int& isInvalid,
+ const char *&PrevSpec,
+ TemplateParameterLists *TemplateParams){
SourceLocation Loc = Tok.getLocation();
switch (Tok.getKind()) {
@@ -712,7 +712,7 @@ bool Parser::MaybeParseTypeSpecifier(DeclSpec &DS, int& isInvalid,
// Annotate typenames and C++ scope specifiers. If we get one, just
// recurse to handle whatever we get.
if (TryAnnotateTypeOrScopeToken())
- return MaybeParseTypeSpecifier(DS, isInvalid, PrevSpec, TemplateParams);
+ return ParseOptionalTypeSpecifier(DS, isInvalid, PrevSpec,TemplateParams);
// Otherwise, not a type specifier.
return false;
case tok::coloncolon: // ::foo::bar
@@ -723,7 +723,7 @@ bool Parser::MaybeParseTypeSpecifier(DeclSpec &DS, int& isInvalid,
// Annotate typenames and C++ scope specifiers. If we get one, just
// recurse to handle whatever we get.
if (TryAnnotateTypeOrScopeToken())
- return MaybeParseTypeSpecifier(DS, isInvalid, PrevSpec, TemplateParams);
+ return ParseOptionalTypeSpecifier(DS, isInvalid, PrevSpec,TemplateParams);
// Otherwise, not a type specifier.
return false;
@@ -1055,7 +1055,7 @@ void Parser::ParseEnumSpecifier(DeclSpec &DS) {
Attr = ParseAttributes();
CXXScopeSpec SS;
- if (getLang().CPlusPlus && MaybeParseCXXScopeSpecifier(SS)) {
+ if (getLang().CPlusPlus && ParseOptionalCXXScopeSpecifier(SS)) {
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_ident);
if (Tok.isNot(tok::l_brace)) {
@@ -1565,7 +1565,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
if (getLang().CPlusPlus) {
if (D.mayHaveIdentifier()) {
- bool afterCXXScope = MaybeParseCXXScopeSpecifier(D.getCXXScopeSpec());
+ bool afterCXXScope = ParseOptionalCXXScopeSpecifier(D.getCXXScopeSpec());
if (afterCXXScope) {
// Change the declaration context for name lookup, until this function
// is exited (and the declarator has been parsed).
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 3dabf2e40e..09c5d52c34 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -167,7 +167,7 @@ Parser::DeclTy *Parser::ParseUsingDirective(unsigned Context,
CXXScopeSpec SS;
// Parse (optional) nested-name-specifier.
- MaybeParseCXXScopeSpecifier(SS);
+ ParseOptionalCXXScopeSpecifier(SS);
AttributeList *AttrList = 0;
IdentifierInfo *NamespcName = 0;
@@ -310,7 +310,7 @@ void Parser::ParseClassSpecifier(DeclSpec &DS,
// Parse the (optional) nested-name-specifier.
CXXScopeSpec SS;
- if (getLang().CPlusPlus && MaybeParseCXXScopeSpecifier(SS)) {
+ if (getLang().CPlusPlus && ParseOptionalCXXScopeSpecifier(SS)) {
if (Tok.isNot(tok::identifier))
Diag(Tok, diag::err_expected_ident);
}
@@ -458,7 +458,7 @@ Parser::BaseResult Parser::ParseBaseSpecifier(DeclTy *ClassDecl)
// Parse optional '::' and optional nested-name-specifier.
CXXScopeSpec SS;
- MaybeParseCXXScopeSpecifier(SS);
+ ParseOptionalCXXScopeSpecifier(SS);
// The location of the base class itself.
SourceLocation BaseLoc = Tok.getLocation();
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index f73bbca47c..88ca915714 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -17,10 +17,10 @@
#include "AstGuard.h"
using namespace clang;
-/// MaybeParseCXXScopeSpecifier - Parse global scope or nested-name-specifier.
-/// Returns true if a nested-name-specifier was parsed from the token stream.
-///
-/// Note that this routine will not parse ::new or ::delete.
+/// ParseOptionalCXXScopeSpecifier - Parse global scope or
+/// nested-name-specifier if present. Returns true if a nested-name-specifier
+/// was parsed from the token stream. Note that this routine will not parse
+/// ::new or ::delete, it will just leave them in the token stream.
///
/// '::'[opt] nested-name-specifier
/// '::'
@@ -31,7 +31,7 @@ using namespace clang;
/// nested-name-specifier identifier '::'
/// nested-name-specifier 'template'[opt] simple-template-id '::' [TODO]
///
-bool Parser::MaybeParseCXXScopeSpecifier(CXXScopeSpec &SS) {
+bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS) {
assert(getLang().CPlusPlus &&
"Call sites of this function should be guarded by checking for C++");
@@ -137,7 +137,7 @@ Parser::OwningExprResult Parser::ParseCXXIdExpression() {
// '::' unqualified-id
//
CXXScopeSpec SS;
- MaybeParseCXXScopeSpecifier(SS);
+ ParseOptionalCXXScopeSpecifier(SS);
// unqualified-id:
// identifier
@@ -521,11 +521,12 @@ bool Parser::ParseCXXTypeSpecifierSeq(DeclSpec &DS) {
int isInvalid = 0;
// Parse one or more of the type specifiers.
- if (!MaybeParseTypeSpecifier(DS, isInvalid, PrevSpec)) {
+ if (!ParseOptionalTypeSpecifier(DS, isInvalid, PrevSpec)) {
Diag(Tok, diag::err_operator_missing_type_specifier);
return true;
}
- while (MaybeParseTypeSpecifier(DS, isInvalid, PrevSpec)) ;
+
+ while (ParseOptionalTypeSpecifier(DS, isInvalid, PrevSpec));
return false;
}
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index e06d80e06d..d9b39099e0 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -753,7 +753,7 @@ bool Parser::TryAnnotateTypeOrScopeToken() {
// FIXME: Implement template-ids
CXXScopeSpec SS;
if (getLang().CPlusPlus)
- MaybeParseCXXScopeSpecifier(SS);
+ ParseOptionalCXXScopeSpecifier(SS);
if (Tok.is(tok::identifier)) {
// Determine whether the identifier is a type name.
@@ -825,7 +825,7 @@ bool Parser::TryAnnotateCXXScopeToken() {
"Cannot be a type or scope token!");
CXXScopeSpec SS;
- if (!MaybeParseCXXScopeSpecifier(SS))
+ if (!ParseOptionalCXXScopeSpecifier(SS))
return false;
// Push the current token back into the token stream (or revert it if it is