summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExpr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-04-06 05:26:30 +0000
committerChris Lattner <sabre@nondot.org>2008-04-06 05:26:30 +0000
commit521ff2b430c9f97314c6f286235358aa52b30043 (patch)
tree74ab1fb4529957563fc5801ea82f1253cd83a036 /clang/lib/Parse/ParseExpr.cpp
parent713e6592be2b4a2e60f6b50ecbf209d90c0eb546 (diff)
downloadbcm5719-llvm-521ff2b430c9f97314c6f286235358aa52b30043.tar.gz
bcm5719-llvm-521ff2b430c9f97314c6f286235358aa52b30043.zip
Use token lookahead to simplify some code that is rarely executed.
Since it is rare, the cost is not significant and we enjoy the simplification. llvm-svn: 49263
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
-rw-r--r--clang/lib/Parse/ParseExpr.cpp36
1 files changed, 0 insertions, 36 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 46714b73ea7..dff7c14524a 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -270,42 +270,6 @@ ParseAssignmentExprWithLeadingIdentifier(const Token &IdTok) {
}
-/// ParseAssignmentExpressionWithLeadingStar - This special purpose method is
-/// used in contexts where we have already consumed a '*' (which we saved in
-/// 'StarTok'), then discovered that the '*' was really the leading token of an
-/// expression. For example, in "*(int*)P+B", we consumed "*" (which is
-/// now in 'StarTok') and the current token is "(".
-Parser::ExprResult Parser::
-ParseAssignmentExpressionWithLeadingStar(const Token &StarTok) {
- // We know that 'StarTok' must correspond to this production:
- // unary-expression: unary-operator cast-expression
- // where 'unary-operator' is '*'.
-
- // Parse the cast-expression that follows the '*'. This will parse the
- // "*(int*)P" part of "*(int*)P+B".
- ExprResult Res = ParseCastExpression(false);
- if (Res.isInvalid) return Res;
-
- // Combine StarTok + Res to get the new AST for the combined expression..
- Res = Actions.ActOnUnaryOp(StarTok.getLocation(), tok::star, Res.Val);
- if (Res.isInvalid) return Res;
-
-
- // We have to parse an entire cast-expression before starting the
- // ParseRHSOfBinaryExpression method (which parses any trailing binops). Since
- // we know that the only production above us is the cast-expression
- // production, and because the only alternative productions start with a '('
- // token (we know we had a '*'), there is no work to do to get a whole
- // cast-expression.
-
- // At this point, the "*(int*)P" part of "*(int*)P+B" has been consumed. Once
- // this is done, we can invoke ParseRHSOfBinaryExpression to consume any
- // trailing operators (e.g. "+" in this example) and connected chunks of the
- // assignment-expression.
- return ParseRHSOfBinaryExpression(Res, prec::Assignment);
-}
-
-
/// ParseRHSOfBinaryExpression - Parse a binary expression that starts with
/// LHS and has a precedence of at least MinPrec.
Parser::ExprResult
OpenPOWER on IntegriCloud