diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-03-08 01:00:17 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-03-08 01:00:17 +0000 |
commit | 0cf55e99c6810cb624486f2a6ff51886f6e23d2e (patch) | |
tree | 7bcab528d0789cb03a87054f7a2df2c835007878 /clang/lib/Parse/ParseExpr.cpp | |
parent | 80f8b4e7cb2004c0f2b8fde0bce3f244862fb74d (diff) | |
download | bcm5719-llvm-0cf55e99c6810cb624486f2a6ff51886f6e23d2e.tar.gz bcm5719-llvm-0cf55e99c6810cb624486f2a6ff51886f6e23d2e.zip |
Streamline BalancedDelimiterTracker, by eliminating the duplicate
paren/brace/bracket tracking (the Consume* functions already did it),
removing the use of ConsumeAnyToken(), and moving the hot paths inline
with the error paths out-of-line.
llvm-svn: 152274
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
-rw-r--r-- | clang/lib/Parse/ParseExpr.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index a1c3b050301..669b5b8ba44 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -1318,22 +1318,27 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { Expr *ExecConfig = 0; - BalancedDelimiterTracker LLLT(*this, tok::lesslessless); BalancedDelimiterTracker PT(*this, tok::l_paren); if (OpKind == tok::lesslessless) { ExprVector ExecConfigExprs(Actions); CommaLocsTy ExecConfigCommaLocs; - LLLT.consumeOpen(); + SourceLocation OpenLoc = ConsumeToken(); if (ParseExpressionList(ExecConfigExprs, ExecConfigCommaLocs)) { LHS = ExprError(); } - if (LHS.isInvalid()) { + SourceLocation CloseLoc = Tok.getLocation(); + if (Tok.is(tok::greatergreatergreater)) { + ConsumeToken(); + } else if (LHS.isInvalid()) { SkipUntil(tok::greatergreatergreater); - } else if (LLLT.consumeClose()) { + } else { // There was an error closing the brackets + Diag(Tok, diag::err_expected_ggg); + Diag(OpenLoc, diag::note_matching) << "<<<"; + SkipUntil(tok::greatergreatergreater); LHS = ExprError(); } @@ -1346,9 +1351,9 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { if (!LHS.isInvalid()) { ExprResult ECResult = Actions.ActOnCUDAExecConfigExpr(getCurScope(), - LLLT.getOpenLocation(), + OpenLoc, move_arg(ExecConfigExprs), - LLLT.getCloseLocation()); + CloseLoc); if (ECResult.isInvalid()) LHS = ExprError(); else |