[cfe-commits] r39247 - in /cfe/cfe/trunk: AST/Sema.h AST/SemaExprCXX.cpp AST/Stmt.cpp AST/StmtPrinter.cpp AST/StmtVisitor.cpp Parse/ParseExpr.cpp Parse/ParseExprCXX.cpp Parse/Parser.cpp Sema/Sema.h Sema/SemaExprCXX.cpp include/clang/AST/ExprCXX.h include/clang/AST/StmtNodes.def include/clang/Basic/DiagnosticKinds.def include/clang/Parse/Action.h include/clang/Parse/Parser.h

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:41:52 PDT 2007


Author: sabre
Date: Wed Jul 11 11:41:51 2007
New Revision: 39247

URL: http://llvm.org/viewvc/llvm-project?rev=39247&view=rev
Log:
Add support for parsing and pretty printing const_cast, dynamic_cast,
reinterpret_cast, and static_cast.  Patch by Bill!

Added:
    cfe/cfe/trunk/AST/SemaExprCXX.cpp   (with props)
    cfe/cfe/trunk/Parse/ParseExprCXX.cpp   (with props)
    cfe/cfe/trunk/Sema/SemaExprCXX.cpp   (with props)
    cfe/cfe/trunk/include/clang/AST/ExprCXX.h   (with props)
Modified:
    cfe/cfe/trunk/AST/Sema.h
    cfe/cfe/trunk/AST/Stmt.cpp
    cfe/cfe/trunk/AST/StmtPrinter.cpp
    cfe/cfe/trunk/AST/StmtVisitor.cpp
    cfe/cfe/trunk/Parse/ParseExpr.cpp
    cfe/cfe/trunk/Parse/Parser.cpp
    cfe/cfe/trunk/Sema/Sema.h
    cfe/cfe/trunk/include/clang/AST/StmtNodes.def
    cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
    cfe/cfe/trunk/include/clang/Parse/Action.h
    cfe/cfe/trunk/include/clang/Parse/Parser.h

Modified: cfe/cfe/trunk/AST/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Sema.h?rev=39247&r1=39246&r2=39247&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Sema.h (original)
+++ cfe/cfe/trunk/AST/Sema.h Wed Jul 11 11:41:51 2007
@@ -177,6 +177,13 @@
   virtual ExprResult ParseConditionalOp(SourceLocation QuestionLoc, 
                                         SourceLocation ColonLoc,
                                         ExprTy *Cond, ExprTy *LHS, ExprTy *RHS);
+
+  /// ParseCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's.
+  virtual ExprResult ParseCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind,
+                                   SourceLocation LAngleBracketLoc, TypeTy *Ty,
+                                   SourceLocation RAngleBracketLoc,
+                                   SourceLocation LParenLoc, ExprTy *E,
+                                   SourceLocation RParenLoc);
 };
 
 

Added: cfe/cfe/trunk/AST/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaExprCXX.cpp?rev=39247&view=auto

==============================================================================
--- cfe/cfe/trunk/AST/SemaExprCXX.cpp (added)
+++ cfe/cfe/trunk/AST/SemaExprCXX.cpp Wed Jul 11 11:41:51 2007
@@ -0,0 +1,37 @@
+//===--- SemaExprCXX.cpp - Semantic Analysis for Expressions --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Bill Wendling and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file implements semantic analysis for C++ expressions.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Sema.h"
+#include "clang/AST/ExprCXX.h"
+using namespace llvm;
+using namespace clang;
+
+/// ParseCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's.
+Action::ExprResult
+Sema::ParseCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind,
+                    SourceLocation LAngleBracketLoc, TypeTy *Ty,
+                    SourceLocation RAngleBracketLoc,
+                    SourceLocation LParenLoc, ExprTy *E,
+                    SourceLocation RParenLoc) {
+  CXXCastExpr::Opcode Op;
+
+  switch (Kind) {
+  default: assert(0 && "Unknown C++ cast!"); abort();
+  case tok::kw_const_cast:       Op = CXXCastExpr::ConstCast;       break;
+  case tok::kw_dynamic_cast:     Op = CXXCastExpr::DynamicCast;     break;
+  case tok::kw_reinterpret_cast: Op = CXXCastExpr::ReinterpretCast; break;
+  case tok::kw_static_cast:      Op = CXXCastExpr::StaticCast;      break;
+  }
+  
+  return new CXXCastExpr(Op, TypeRef::getFromOpaquePtr(Ty), (Expr*)E);
+}

Propchange: cfe/cfe/trunk/AST/SemaExprCXX.cpp

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/AST/SemaExprCXX.cpp

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: cfe/cfe/trunk/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Stmt.cpp?rev=39247&r1=39246&r2=39247&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Stmt.cpp (original)
+++ cfe/cfe/trunk/AST/Stmt.cpp Wed Jul 11 11:41:51 2007
@@ -12,7 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/AST/Stmt.h"
-#include "clang/AST/Expr.h"
+#include "clang/AST/ExprCXX.h"
 #include "clang/AST/StmtVisitor.h"
 using namespace llvm;
 using namespace clang;
@@ -23,4 +23,3 @@
 
 STMT(Stmt, )
 #include "clang/AST/StmtNodes.def"
-

Modified: cfe/cfe/trunk/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/StmtPrinter.cpp?rev=39247&r1=39246&r2=39247&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/StmtPrinter.cpp (original)
+++ cfe/cfe/trunk/AST/StmtPrinter.cpp Wed Jul 11 11:41:51 2007
@@ -13,7 +13,7 @@
 
 #include "clang/AST/StmtVisitor.h"
 #include "clang/AST/Decl.h"
-#include "clang/AST/Expr.h"
+#include "clang/AST/ExprCXX.h"
 #include "clang/Lex/IdentifierTable.h"
 #include "llvm/Support/Compiler.h"
 #include <iostream>
@@ -294,6 +294,23 @@
   OS << TypeStr << ")";
   PrintExpr(Node->getSubExpr());
 }
+void StmtPrinter::VisitCXXCastExpr(CXXCastExpr *Node) {
+  switch (Node->getOpcode()) {
+  default:
+    assert(0 && "Not a C++ cast expression");
+    abort();
+  case CXXCastExpr::ConstCast:       OS << "const_cast<";       break;
+  case CXXCastExpr::DynamicCast:     OS << "dynamic_cast<";     break;
+  case CXXCastExpr::ReinterpretCast: OS << "reinterpret_cast<"; break;
+  case CXXCastExpr::StaticCast:      OS << "static_cast<";      break;
+  }
+
+  std::string TypeStr;
+  Node->getDestType().getAsString(TypeStr);
+  OS << TypeStr << ">(";
+  PrintExpr(Node->getSubExpr());
+  OS << ")";
+}
 void StmtPrinter::VisitBinaryOperator(BinaryOperator *Node) {
   PrintExpr(Node->getLHS());
   OS << " " << BinaryOperator::getOpcodeStr(Node->getOpcode()) << " ";

Modified: cfe/cfe/trunk/AST/StmtVisitor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/StmtVisitor.cpp?rev=39247&r1=39246&r2=39247&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/StmtVisitor.cpp (original)
+++ cfe/cfe/trunk/AST/StmtVisitor.cpp Wed Jul 11 11:41:51 2007
@@ -12,7 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/AST/StmtVisitor.h"
-#include "clang/AST/Expr.h"
+#include "clang/AST/ExprCXX.h"
 using namespace llvm;
 using namespace clang;
 

Modified: cfe/cfe/trunk/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseExpr.cpp?rev=39247&r1=39246&r2=39247&view=diff

==============================================================================
--- cfe/cfe/trunk/Parse/ParseExpr.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseExpr.cpp Wed Jul 11 11:41:51 2007
@@ -559,6 +559,12 @@
       
     return Res;
   }
+  case tok::kw_const_cast:
+  case tok::kw_dynamic_cast:
+  case tok::kw_reinterpret_cast:
+  case tok::kw_static_cast:
+    Res = ParseCXXCasts();
+    return Res;
   default:
     Diag(Tok, diag::err_expected_expression);
     return ExprResult(true);
@@ -825,7 +831,6 @@
   return ParsePostfixExpressionSuffix(Res);
 }
 
-
 /// ParseParenExpression - This parses the unit that starts with a '(' token,
 /// based on what is allowed by ExprType.  The actual thing parsed is returned
 /// in ExprType.
@@ -921,4 +926,3 @@
   // Pass the set of string tokens, ready for concatenation, to the actions.
   return Actions.ParseStringExpr(&StringToks[0], StringToks.size());
 }
-

Added: cfe/cfe/trunk/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseExprCXX.cpp?rev=39247&view=auto

==============================================================================
--- cfe/cfe/trunk/Parse/ParseExprCXX.cpp (added)
+++ cfe/cfe/trunk/Parse/ParseExprCXX.cpp Wed Jul 11 11:41:51 2007
@@ -0,0 +1,70 @@
+//===--- ParseExprCXX.cpp - C++ Expression Parsing ------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Bill Wendling and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the Expression parsing implementation for C++.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/AST/ExprCXX.h"
+#include "clang/Basic/Diagnostic.h"
+#include "clang/Parse/Parser.h"
+using namespace llvm;
+using namespace clang;
+
+/// ParseCXXCasts - This handles the various ways to cast expressions to another
+/// type.
+///
+///       postfix-expression: [C++ 5.2p1]
+///         'dynamic_cast' '<' type-name '>' '(' expression ')'
+///         'static_cast' '<' type-name '>' '(' expression ')'
+///         'reinterpret_cast' '<' type-name '>' '(' expression ')'
+///         'const_cast' '<' type-name '>' '(' expression ')'
+///
+Parser::ExprResult Parser::ParseCXXCasts() {
+  tok::TokenKind Kind = Tok.getKind();
+  const char *CastName = 0;     // For error messages
+
+  switch (Kind) {
+  default: assert(0 && "Unknown C++ cast!"); abort();
+  case tok::kw_const_cast:       CastName = "const_cast";       break;
+  case tok::kw_dynamic_cast:     CastName = "dynamic_cast";     break;
+  case tok::kw_reinterpret_cast: CastName = "reinterpret_cast"; break;
+  case tok::kw_static_cast:      CastName = "static_cast";      break;
+  }
+
+  SourceLocation OpLoc = ConsumeToken();
+  SourceLocation LAngleBracketLoc = Tok.getLocation();
+
+  if (ExpectAndConsume(tok::less, diag::err_expected_less_after, CastName))
+    return ExprResult(true);
+
+  TypeTy *CastTy = ParseTypeName();
+  SourceLocation RAngleBracketLoc = Tok.getLocation();
+
+  if (ExpectAndConsume(tok::greater, diag::err_expected_greater)) {
+    Diag(LAngleBracketLoc, diag::err_matching, "<");
+    return ExprResult(true);
+  }
+
+  SourceLocation LParenLoc = Tok.getLocation(), RParenLoc;
+
+  if (Tok.getKind() != tok::l_paren) {
+    Diag(Tok, diag::err_expected_lparen_after, CastName);
+    return ExprResult(true);
+  }
+
+  ExprResult Result = ParseSimpleParenExpression(RParenLoc);
+
+  if (!Result.isInvalid)
+    Result = Actions.ParseCXXCasts(OpLoc, Kind,
+                                   LAngleBracketLoc, CastTy, RAngleBracketLoc,
+                                   LParenLoc, Result.Val, RParenLoc);
+
+  return Result;
+}

Propchange: cfe/cfe/trunk/Parse/ParseExprCXX.cpp

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/Parse/ParseExprCXX.cpp

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: cfe/cfe/trunk/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/Parser.cpp?rev=39247&r1=39246&r2=39247&view=diff

==============================================================================
--- cfe/cfe/trunk/Parse/Parser.cpp (original)
+++ cfe/cfe/trunk/Parse/Parser.cpp Wed Jul 11 11:41:51 2007
@@ -53,6 +53,7 @@
   case tok::r_paren : LHSName = "("; DID = diag::err_expected_rparen; break;
   case tok::r_brace : LHSName = "{"; DID = diag::err_expected_rbrace; break;
   case tok::r_square: LHSName = "["; DID = diag::err_expected_rsquare; break;
+  case tok::greater:  LHSName = "<"; DID = diag::err_expected_greater; break;
   }
   Diag(Tok, DID);
   Diag(LHSLoc, diag::err_matching, LHSName);

Modified: cfe/cfe/trunk/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/Sema.h?rev=39247&r1=39246&r2=39247&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/Sema.h (original)
+++ cfe/cfe/trunk/Sema/Sema.h Wed Jul 11 11:41:51 2007
@@ -177,6 +177,13 @@
   virtual ExprResult ParseConditionalOp(SourceLocation QuestionLoc, 
                                         SourceLocation ColonLoc,
                                         ExprTy *Cond, ExprTy *LHS, ExprTy *RHS);
+
+  /// ParseCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's.
+  virtual ExprResult ParseCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind,
+                                   SourceLocation LAngleBracketLoc, TypeTy *Ty,
+                                   SourceLocation RAngleBracketLoc,
+                                   SourceLocation LParenLoc, ExprTy *E,
+                                   SourceLocation RParenLoc);
 };
 
 

Added: cfe/cfe/trunk/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaExprCXX.cpp?rev=39247&view=auto

==============================================================================
--- cfe/cfe/trunk/Sema/SemaExprCXX.cpp (added)
+++ cfe/cfe/trunk/Sema/SemaExprCXX.cpp Wed Jul 11 11:41:51 2007
@@ -0,0 +1,37 @@
+//===--- SemaExprCXX.cpp - Semantic Analysis for Expressions --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Bill Wendling and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file implements semantic analysis for C++ expressions.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Sema.h"
+#include "clang/AST/ExprCXX.h"
+using namespace llvm;
+using namespace clang;
+
+/// ParseCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's.
+Action::ExprResult
+Sema::ParseCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind,
+                    SourceLocation LAngleBracketLoc, TypeTy *Ty,
+                    SourceLocation RAngleBracketLoc,
+                    SourceLocation LParenLoc, ExprTy *E,
+                    SourceLocation RParenLoc) {
+  CXXCastExpr::Opcode Op;
+
+  switch (Kind) {
+  default: assert(0 && "Unknown C++ cast!"); abort();
+  case tok::kw_const_cast:       Op = CXXCastExpr::ConstCast;       break;
+  case tok::kw_dynamic_cast:     Op = CXXCastExpr::DynamicCast;     break;
+  case tok::kw_reinterpret_cast: Op = CXXCastExpr::ReinterpretCast; break;
+  case tok::kw_static_cast:      Op = CXXCastExpr::StaticCast;      break;
+  }
+  
+  return new CXXCastExpr(Op, TypeRef::getFromOpaquePtr(Ty), (Expr*)E);
+}

Propchange: cfe/cfe/trunk/Sema/SemaExprCXX.cpp

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/Sema/SemaExprCXX.cpp

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: cfe/cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/ExprCXX.h?rev=39247&view=auto

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/ExprCXX.h (added)
+++ cfe/cfe/trunk/include/clang/AST/ExprCXX.h Wed Jul 11 11:41:51 2007
@@ -0,0 +1,49 @@
+//===--- ExprCXX.h - Classes for representing expressions -------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Bill Wendling and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file defines the Expr interface and subclasses for C++ expressions.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_AST_EXPRCXX_H
+#define LLVM_CLANG_AST_EXPRCXX_H
+
+#include "clang/AST/Expr.h"
+
+namespace llvm {
+namespace clang {
+
+//===----------------------------------------------------------------------===//
+// C++ Expressions.
+//===----------------------------------------------------------------------===//
+
+/// CXXCastExpr - [C++ 5.2.7, 5.2.9, 5.2.10, 5.2.11] C++ Cast Operators.
+/// 
+class CXXCastExpr : public CastExpr {
+public:
+  enum Opcode {
+    DynamicCast,
+    StaticCast,
+    ReinterpretCast,
+    ConstCast
+  };
+
+  CXXCastExpr(Opcode op, TypeRef ty, Expr *expr)
+    : CastExpr(ty, expr), Op(op) {}
+
+  Opcode getOpcode() const { return Op; }
+  virtual void visit(StmtVisitor &Visitor);
+private:
+  Opcode Op;
+};
+  
+}  // end namespace clang
+}  // end namespace llvm
+
+#endif

Propchange: cfe/cfe/trunk/include/clang/AST/ExprCXX.h

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/include/clang/AST/ExprCXX.h

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: cfe/cfe/trunk/include/clang/AST/StmtNodes.def
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/StmtNodes.def?rev=39247&r1=39246&r2=39247&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/StmtNodes.def (original)
+++ cfe/cfe/trunk/include/clang/AST/StmtNodes.def Wed Jul 11 11:41:51 2007
@@ -43,4 +43,7 @@
 STMT(BinaryOperator       , Expr)
 STMT(ConditionalOperator  , Expr)
 
-#undef STMT
\ No newline at end of file
+// C++ Expressions.
+STMT(CXXCastExpr          , CastExpr)
+
+#undef STMT

Modified: cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=39247&r1=39246&r2=39247&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def Wed Jul 11 11:41:51 2007
@@ -313,6 +313,8 @@
      "expected ']'")
 DIAG(err_expected_rbrace, ERROR,
      "expected '}'")
+DIAG(err_expected_greater, ERROR,
+     "expected '>'")
 DIAG(err_expected_semi_decl_list, ERROR,
      "expected ';' at end of declaration list")
 DIAG(err_expected_fn_body, ERROR,
@@ -323,6 +325,8 @@
      "expected statement")
 DIAG(err_expected_lparen_after, ERROR,
      "expected '(' after '%s'")
+DIAG(err_expected_less_after, ERROR,
+     "expected '<' after '%s'")
 DIAG(err_expected_comma, ERROR,
      "expected ','")
 DIAG(err_expected_lbrace_in_compound_literal, ERROR,

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

==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/Action.h Wed Jul 11 11:41:51 2007
@@ -305,6 +305,15 @@
                                         ExprTy *Cond, ExprTy *LHS, ExprTy *RHS){
     return 0;
   }
+  
+  /// ParseCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's.
+  virtual ExprResult ParseCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind,
+                                   SourceLocation LAngleBracketLoc, TypeTy *Ty,
+                                   SourceLocation RAngleBracketLoc,
+                                   SourceLocation LParenLoc, ExprTy *Op,
+                                   SourceLocation RParenLoc) {
+    return 0;
+  }
 };
 
 /// MinimalAction - Minimal actions are used by light-weight clients of the

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

==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/Parser.h Wed Jul 11 11:41:51 2007
@@ -169,7 +169,6 @@
     return L;
   }
   
-  
   /// ConsumeStringToken - Consume the current 'peek token', lexing a new one
   /// and returning the token kind.  This method is specific to strings, as it
   /// handles string literal concatenation, as per C99 5.1.1.2, translation
@@ -283,14 +282,21 @@
                                   SourceLocation &RParenLoc);
   
   ExprResult ParseSimpleParenExpression() {  // Parse SimpleExpr only.
+    SourceLocation RParenLoc;
+    return ParseSimpleParenExpression(RParenLoc);
+  }
+  ExprResult ParseSimpleParenExpression(SourceLocation &RParenLoc) {
     ParenParseOption Op = SimpleExpr;
     TypeTy *CastTy;
-    SourceLocation RParenLoc;
     return ParseParenExpression(Op, CastTy, RParenLoc);
   }
   ExprResult ParseStringLiteralExpression();
   
   //===--------------------------------------------------------------------===//
+  // C++ 5.2p1: C++ Casts
+  ExprResult ParseCXXCasts();
+
+  //===--------------------------------------------------------------------===//
   // C99 6.7.8: Initialization.
   ExprResult ParseInitializer();
   ExprResult ParseInitializerWithPotentialDesignator();





More information about the cfe-commits mailing list