[cfe-commits] r86028 - in /cfe/trunk: include/clang/Parse/Parser.h lib/Parse/ParseExprCXX.cpp

Douglas Gregor dgregor at apple.com
Wed Nov 4 08:32:12 PST 2009


Author: dgregor
Date: Wed Nov  4 10:32:12 2009
New Revision: 86028

URL: http://llvm.org/viewvc/llvm-project?rev=86028&view=rev
Log:
Eliminate the "old" ways of parsing operator-function-ids and
conversion-function-ids; all clients have moved on to
ParseUnqualifiedId.

Modified:
    cfe/trunk/include/clang/Parse/Parser.h
    cfe/trunk/lib/Parse/ParseExprCXX.cpp

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=86028&r1=86027&r2=86028&view=diff

==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Wed Nov  4 10:32:12 2009
@@ -1321,13 +1321,6 @@
                           UnqualifiedId &Result);
     
   //===--------------------------------------------------------------------===//
-  // C++ 13.5: Overloaded operators [over.oper]
-  // EndLoc, if non-NULL, is filled with the location of the last token of
-  // the ID.
-  OverloadedOperatorKind TryParseOperatorFunctionId(SourceLocation *EndLoc = 0);
-  TypeTy *ParseConversionFunctionId(SourceLocation *EndLoc = 0);
-
-  //===--------------------------------------------------------------------===//
   // C++ 14: Templates [temp]
   typedef llvm::SmallVector<DeclPtrTy, 4> TemplateParameterList;
 

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=86028&r1=86027&r2=86028&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Wed Nov  4 10:32:12 2009
@@ -1196,141 +1196,6 @@
   return true;
 }
 
-/// TryParseOperatorFunctionId - Attempts to parse a C++ overloaded
-/// operator name (C++ [over.oper]). If successful, returns the
-/// predefined identifier that corresponds to that overloaded
-/// operator. Otherwise, returns NULL and does not consume any tokens.
-///
-///       operator-function-id: [C++ 13.5]
-///         'operator' operator
-///
-/// operator: one of
-///            new   delete  new[]   delete[]
-///            +     -    *  /    %  ^    &   |   ~
-///            !     =    <  >    += -=   *=  /=  %=
-///            ^=    &=   |= <<   >> >>= <<=  ==  !=
-///            <=    >=   && ||   ++ --   ,   ->* ->
-///            ()    []
-OverloadedOperatorKind
-Parser::TryParseOperatorFunctionId(SourceLocation *EndLoc) {
-  assert(Tok.is(tok::kw_operator) && "Expected 'operator' keyword");
-  SourceLocation Loc;
-
-  OverloadedOperatorKind Op = OO_None;
-  switch (NextToken().getKind()) {
-  case tok::kw_new:
-    ConsumeToken(); // 'operator'
-    Loc = ConsumeToken(); // 'new'
-    if (Tok.is(tok::l_square)) {
-      ConsumeBracket(); // '['
-      Loc = Tok.getLocation();
-      ExpectAndConsume(tok::r_square, diag::err_expected_rsquare); // ']'
-      Op = OO_Array_New;
-    } else {
-      Op = OO_New;
-    }
-    if (EndLoc)
-      *EndLoc = Loc;
-    return Op;
-
-  case tok::kw_delete:
-    ConsumeToken(); // 'operator'
-    Loc = ConsumeToken(); // 'delete'
-    if (Tok.is(tok::l_square)) {
-      ConsumeBracket(); // '['
-      Loc = Tok.getLocation();
-      ExpectAndConsume(tok::r_square, diag::err_expected_rsquare); // ']'
-      Op = OO_Array_Delete;
-    } else {
-      Op = OO_Delete;
-    }
-    if (EndLoc)
-      *EndLoc = Loc;
-    return Op;
-
-#define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly)  \
-    case tok::Token:  Op = OO_##Name; break;
-#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
-#include "clang/Basic/OperatorKinds.def"
-
-  case tok::l_paren:
-    ConsumeToken(); // 'operator'
-    ConsumeParen(); // '('
-    Loc = Tok.getLocation();
-    ExpectAndConsume(tok::r_paren, diag::err_expected_rparen); // ')'
-    if (EndLoc)
-      *EndLoc = Loc;
-    return OO_Call;
-
-  case tok::l_square:
-    ConsumeToken(); // 'operator'
-    ConsumeBracket(); // '['
-    Loc = Tok.getLocation();
-    ExpectAndConsume(tok::r_square, diag::err_expected_rsquare); // ']'
-    if (EndLoc)
-      *EndLoc = Loc;
-    return OO_Subscript;
-
-  case tok::code_completion: {
-    // Code completion for the operator name.
-    Actions.CodeCompleteOperatorName(CurScope);
-    
-    // Consume the 'operator' token, then replace the code-completion token
-    // with an 'operator' token and try again.
-    SourceLocation OperatorLoc = ConsumeToken();
-    Tok.setLocation(OperatorLoc);
-    Tok.setKind(tok::kw_operator);
-    return TryParseOperatorFunctionId(EndLoc);
-  }
-      
-  default:
-    return OO_None;
-  }
-
-  ConsumeToken(); // 'operator'
-  Loc = ConsumeAnyToken(); // the operator itself
-  if (EndLoc)
-    *EndLoc = Loc;
-  return Op;
-}
-
-/// ParseConversionFunctionId - Parse a C++ conversion-function-id,
-/// which expresses the name of a user-defined conversion operator
-/// (C++ [class.conv.fct]p1). Returns the type that this operator is
-/// specifying a conversion for, or NULL if there was an error.
-///
-///        conversion-function-id: [C++ 12.3.2]
-///                   operator conversion-type-id
-///
-///        conversion-type-id:
-///                   type-specifier-seq conversion-declarator[opt]
-///
-///        conversion-declarator:
-///                   ptr-operator conversion-declarator[opt]
-Parser::TypeTy *Parser::ParseConversionFunctionId(SourceLocation *EndLoc) {
-  assert(Tok.is(tok::kw_operator) && "Expected 'operator' keyword");
-  ConsumeToken(); // 'operator'
-
-  // Parse the type-specifier-seq.
-  DeclSpec DS;
-  if (ParseCXXTypeSpecifierSeq(DS))
-    return 0;
-
-  // Parse the conversion-declarator, which is merely a sequence of
-  // ptr-operators.
-  Declarator D(DS, Declarator::TypeNameContext);
-  ParseDeclaratorInternal(D, /*DirectDeclParser=*/0);
-  if (EndLoc)
-    *EndLoc = D.getSourceRange().getEnd();
-
-  // Finish up the type.
-  Action::TypeResult Result = Actions.ActOnTypeName(CurScope, D);
-  if (Result.isInvalid())
-    return 0;
-  else
-    return Result.get();
-}
-
 /// ParseCXXNewExpression - Parse a C++ new-expression. New is used to allocate
 /// memory in a typesafe manner and call constructors.
 ///





More information about the cfe-commits mailing list