[PATCH] D57984: PR40642: Fix determination of whether the final statement of a statementexpression is a discarded-value expression.
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 13 07:35:12 PST 2019
aaron.ballman added inline comments.
================
Comment at: include/clang/Parse/Parser.h:374
+ /// This context is at the top level of a GNU statement expression.
+ InStmtExpr = 0x4,
+
----------------
It's a bit strange that the previous two enumerators are "Allow" and this is "In". Maybe it will be less of a concern when I see the uses though...
================
Comment at: include/clang/Parse/Parser.h:398
+
+
+ /// Act on an expression statement that might be the last statement in a
----------------
Spurious newline.
================
Comment at: lib/Parse/ParseStmt.cpp:1037
+ ParsedStmtContext SubStmtCtx = ParsedStmtContext::Compound;
+ if (isStmtExpr)
----------------
```
ParsedStmtContext SubStmtCtx =
ParsedStmtContext::Compound |
(isStmtExpr ? ParsedStmtContext::InStmtExpr : 0);
```
?
================
Comment at: lib/Parse/ParseStmt.cpp:1053
if (Tok.isNot(tok::kw___extension__)) {
- R = ParseStatementOrDeclaration(Stmts, ACK_Any);
+ R = ParseStatementOrDeclaration(Stmts, SubStmtCtx, nullptr);
} else {
----------------
You can drop the `nullptr` here.
================
Comment at: lib/Parse/ParseStmt.cpp:1090-1091
+ R = handleExprStmt(Res, SubStmtCtx);
+ if (R.isUsable())
+ R = Actions.ProcessStmtAttributes(R.get(), attrs, attrs.Range);
}
----------------
Should this be done as part of `handleExprStmt()`?
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57984/new/
https://reviews.llvm.org/D57984
More information about the cfe-commits
mailing list