Lines Matching full:statement
1 //===--- ParseStmt.cpp - Statement and Block Parser -----------------------===//
10 // This file implements the Statement and Block portions of the Parser
33 /// \brief Parse a standalone statement (for instance, as the body of an 'if',
39 // We may get back a null statement if we found a #pragma. Keep going until in ParseStatement()
40 // we get an actual statement. in ParseStatement()
52 /// ParseStatementOrDeclaration - Read 'statement' or 'declaration'.
54 /// statement
57 /// statement:
58 /// labeled-statement
59 /// compound-statement
60 /// expression-statement
61 /// selection-statement
62 /// iteration-statement
63 /// jump-statement
64 /// [C++] declaration-statement
67 /// [OBC] objc-throw-statement
68 /// [OBC] objc-try-catch-statement
69 /// [OBC] objc-synchronized-statement
70 /// [GNU] asm-statement
73 /// labeled-statement:
74 /// identifier ':' statement
75 /// 'case' constant-expression ':' statement
76 /// 'default' ':' statement
78 /// selection-statement:
79 /// if-statement
80 /// switch-statement
82 /// iteration-statement:
83 /// while-statement
84 /// do-statement
85 /// for-statement
87 /// expression-statement:
90 /// jump-statement:
97 /// [OBC] objc-throw-statement:
117 "attributes on empty statement"); in ParseStatementOrDeclaration()
161 // Cases in this switch statement should fall through if the parser expects in ParseStatementOrDeclarationAfterAttributes()
168 case tok::at: // May be a @try or @throw statement in ParseStatementOrDeclarationAfterAttributes()
182 if (Next.is(tok::colon)) { // C99 6.8.1: labeled-statement in ParseStatementOrDeclarationAfterAttributes()
183 // identifier ':' statement in ParseStatementOrDeclarationAfterAttributes()
228 case tok::kw_case: // C99 6.8.1: labeled-statement in ParseStatementOrDeclarationAfterAttributes()
230 case tok::kw_default: // C99 6.8.1: labeled-statement in ParseStatementOrDeclarationAfterAttributes()
233 case tok::l_brace: // C99 6.8.2: compound-statement in ParseStatementOrDeclarationAfterAttributes()
240 case tok::kw_if: // C99 6.8.4.1: if-statement in ParseStatementOrDeclarationAfterAttributes()
242 case tok::kw_switch: // C99 6.8.4.2: switch-statement in ParseStatementOrDeclarationAfterAttributes()
245 case tok::kw_while: // C99 6.8.5.1: while-statement in ParseStatementOrDeclarationAfterAttributes()
247 case tok::kw_do: // C99 6.8.5.2: do-statement in ParseStatementOrDeclarationAfterAttributes()
251 case tok::kw_for: // C99 6.8.5.3: for-statement in ParseStatementOrDeclarationAfterAttributes()
254 case tok::kw_goto: // C99 6.8.6.1: goto-statement in ParseStatementOrDeclarationAfterAttributes()
258 case tok::kw_continue: // C99 6.8.6.2: continue-statement in ParseStatementOrDeclarationAfterAttributes()
262 case tok::kw_break: // C99 6.8.6.3: break-statement in ParseStatementOrDeclarationAfterAttributes()
266 case tok::kw_return: // C99 6.8.6.4: return-statement in ParseStatementOrDeclarationAfterAttributes()
270 case tok::kw_co_return: // C++ Coroutines: co_return statement in ParseStatementOrDeclarationAfterAttributes()
289 // An __if_exists block is like a compound statement, but it doesn't create in ParseStatementOrDeclarationAfterAttributes()
383 // If we reached this code, the statement must end in a semicolon. in ParseStatementOrDeclarationAfterAttributes()
396 /// \brief Parse an expression statement.
420 // Recover parsing as a case statement. in ParseExprStatement()
432 /// '__try' compound-statement seh-handler
474 /// '__except' '(' seh-filter-expression ')' compound-statement
526 /// '__finally' compound-statement
550 /// seh-leave-statement:
560 /// labeled-statement:
561 /// identifier ':' statement
562 /// [GNU] identifier ':' attributes[opt] statement
573 // identifier ':' statement in ParseLabeledStatement()
588 // attributes as part of a statement in that case). That looks like a bug. in ParseLabeledStatement()
594 // statement, but that doesn't work correctly (because ProhibitAttributes in ParseLabeledStatement()
608 // If we've not parsed a statement yet, parse one now. in ParseLabeledStatement()
628 /// labeled-statement:
629 /// 'case' constant-expression ':' statement
630 /// [GNU] 'case' constant-expression '...' constant-expression ':' statement
653 // DeepestParsedCaseStmt - This is the deepest statement we have parsed, which in ParseCaseStatement()
686 // current case statement (moving to the colon that ends it). in ParseCaseStatement()
742 // If this is the first case statement we parsed, it becomes TopLevelCase. in ParseCaseStatement()
755 // If we found a non-case statement, start by parsing it. in ParseCaseStatement()
775 // Broken sub-stmt shouldn't prevent forming the case statement properly. in ParseCaseStatement()
781 // Return the top level parsed statement tree. in ParseCaseStatement()
786 /// labeled-statement:
787 /// 'default' ':' statement
788 /// Note that this does not parse the 'statement' at the end.
823 // Broken sub-stmt shouldn't prevent forming the case statement properly. in ParseDefaultStatement()
837 /// compound-statement: [C99 6.8.2]
848 /// statement
871 /// statement in the compound, but may be intermingled with other pragmas.
930 "in compound statement ('{}')"); in ParseCompoundStatementBody()
933 // compound statement. in ParseCompoundStatementBody()
943 // Parse any pragmas at the beginning of the compound statement. in ParseCompoundStatementBody()
1022 // statement. in ParseCompoundStatementBody()
1036 // Recover by creating a compound statement with what we parsed so far, in ParseCompoundStatementBody()
1047 /// [C++1z] '(' init-statement[opt] condition ')'
1081 // continue parsing the if statement. in ParseParenExprOrCondition()
1090 // that all callers are looking for a statement after the condition, so ")" in ParseParenExprOrCondition()
1103 /// if-statement: [C99 6.8.4.1]
1104 /// 'if' '(' expression ')' statement
1105 /// 'if' '(' expression ')' statement 'else' statement
1106 /// [C++] 'if' '(' condition ')' statement
1107 /// [C++] 'if' '(' condition ')' statement 'else' statement
1129 // C99 6.8.4p3 - In C99, the if statement is a block. This is not in ParseIfStatement()
1137 // Names declared in the for-init-statement, and in the condition of if, in ParseIfStatement()
1139 // switch statement (including the controlled statement). in ParseIfStatement()
1155 // C99 6.8.4p3 - In C99, the body of the if statement is a scope, even if in ParseIfStatement()
1157 // if the body isn't a compound statement to avoid push/pop in common cases. in ParseIfStatement()
1160 // The substatement in a selection-statement (each substatement, in the else in ParseIfStatement()
1161 // form of the if statement) implicitly defines a local scope. in ParseIfStatement()
1202 // C99 6.8.4p3 - In C99, the body of the if statement is a scope, even if in ParseIfStatement()
1204 // this if the body isn't a compound statement to avoid push/pop in common in ParseIfStatement()
1208 // The substatement in a selection-statement (each substatement, in the else in ParseIfStatement()
1209 // form of the if statement) implicitly defines a local scope. in ParseIfStatement()
1252 /// switch-statement:
1253 /// 'switch' '(' expression ')' statement
1254 /// [C++] 'switch' '(' condition ')' statement
1267 // C99 6.8.4p3 - In C99, the switch statement is a block. This is in ParseSwitchStatement()
1275 // Names declared in the for-init-statement, and in the condition of if, in ParseSwitchStatement()
1277 // switch statement (including the controlled statement). in ParseSwitchStatement()
1307 // C99 6.8.4p3 - In C99, the body of the switch statement is a scope, even if in ParseSwitchStatement()
1309 // if the body isn't a compound statement to avoid push/pop in common cases. in ParseSwitchStatement()
1312 // The substatement in a selection-statement (each substatement, in the else in ParseSwitchStatement()
1313 // form of the if statement) implicitly defines a local scope. in ParseSwitchStatement()
1326 // Read the body statement. in ParseSwitchStatement()
1337 /// while-statement: [C99 6.8.5.1]
1338 /// 'while' '(' expression ')' statement
1339 /// [C++] 'while' '(' condition ')' statement
1353 // C99 6.8.5p5 - In C99, the while statement is a block. This is not in ParseWhileStatement()
1361 // Names declared in the for-init-statement, and in the condition of if, in ParseWhileStatement()
1363 // switch statement (including the controlled statement). in ParseWhileStatement()
1379 // C99 6.8.5p5 - In C99, the body of the while statement is a scope, even if in ParseWhileStatement()
1381 // if the body isn't a compound statement to avoid push/pop in common cases. in ParseWhileStatement()
1384 // The substatement in an iteration-statement implicitly defines a local scope in ParseWhileStatement()
1392 // Read the body statement. in ParseWhileStatement()
1406 /// do-statement: [C99 6.8.5.2]
1407 /// 'do' statement 'while' '(' expression ')' ';'
1413 // C99 6.8.5p5 - In C99, the do statement is a block. This is not in ParseDoStatement()
1423 // C99 6.8.5p5 - In C99, the body of the do statement is a scope, even if in ParseDoStatement()
1425 // if the body isn't a compound statement to avoid push/pop in common cases. in ParseDoStatement()
1428 // The substatement in an iteration-statement implicitly defines a local scope in ParseDoStatement()
1434 // Read the body statement. in ParseDoStatement()
1494 /// for-statement: [C99 6.8.5.3]
1495 /// 'for' '(' expr[opt] ';' expr[opt] ';' expr[opt] ')' statement
1496 /// 'for' '(' declaration expr[opt] ';' expr[opt] ')' statement
1497 /// [C++] 'for' '(' for-init-statement condition[opt] ';' expression[opt] ')'
1498 /// [C++] statement
1502 /// statement
1503 /// [OBJC2] 'for' '(' declaration 'in' expr ')' statement
1504 /// [OBJC2] 'for' '(' expr 'in' expr ')' statement
1506 /// [C++] for-init-statement:
1507 /// [C++] expression-statement
1532 // C99 6.8.5p5 - In C99, the for statement is a block. This is not in ParseForStatement()
1540 // Names declared in the for-init-statement, and in the condition of if, in ParseForStatement()
1542 // switch statement (including the controlled statement). in ParseForStatement()
1544 // Names declared in the for-init-statement are in the same declarative-region in ParseForStatement()
1663 // User tried to write the reasonable, but ill-formed, for-range-statement in ParseForStatement()
1728 // 'co_await' can only be used for a range-based for statement. in ParseForStatement()
1749 // statement immediately in order to close over temporaries correctly. in ParseForStatement()
1763 // C99 6.8.5p5 - In C99, the body of the for statement is a scope, even if in ParseForStatement()
1765 // if the body isn't a compound statement to avoid push/pop in common cases. in ParseForStatement()
1768 // The substatement in an iteration-statement implicitly defines a local scope in ParseForStatement()
1772 // for-init-statement/condition and a new scope for substatement in C++. in ParseForStatement()
1778 // for-init-statement. in ParseForStatement()
1780 // normally increment the mangling number (like a compound statement). in ParseForStatement()
1784 // Read the body statement. in ParseForStatement()
1809 /// jump-statement:
1844 /// jump-statement:
1855 /// jump-statement:
1866 /// jump-statement:
1925 // Get the next statement. in ParsePragmaLoopHint()
1949 // (the function body) as the body itself. Instead, just read the statement in ParseFunctionStatementBody()
1966 /// 'try' ctor-initializer[opt] compound-statement handler-seq
1990 // compound statement as the body. in ParseFunctionTryBlock()
2043 /// 'try' compound-statement handler-seq
2056 /// 'try' compound-statement handler-seq
2059 /// 'try' ctor-initializer[opt] compound-statement handler-seq
2065 /// 'try' compound-statement seh-except-block
2066 /// 'try' compound-statement seh-finally-block
2105 // statement-like. in ParseCXXTryBlockCommon()
2115 // Don't bother creating the full statement if we don't have any usable in ParseCXXTryBlockCommon()
2127 /// 'catch' '(' exception-declaration ')' compound-statement
2188 // Handle dependent statements by parsing the braces as a compound statement. in ParseMicrosoftIfExistsStatement()
2190 // compound statement, but for Clang's type checking we can't have anything in ParseMicrosoftIfExistsStatement()