[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-10-05 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision. aaron.ballman added a comment. I've commit on your behalf in 424733c12aacc227a28114deba72061153f8dff2 , thank you for the new functionality! Repository: rG LLVM Github Monorepo CHANGES S

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-10-04 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 376967. cor3ntin added a comment. Fix compilation Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/new/ https://reviews.llvm.org/D110482 Files: clang/include/clang/AST/Stmt.h clang/include/clang/Basic

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-10-04 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 376961. cor3ntin added a comment. Address nits Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/new/ https://reviews.llvm.org/D110482 Files: clang/include/clang/AST/Stmt.h clang/include/clang/Basic/Di

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-10-04 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a reviewer: rsmith. aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. Aside from a nit, I think this is ready to go. Adding Richard in case he has the chance to give this a once-over before it lands. ==

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-30 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 376245. cor3ntin added a comment. Add support for attributes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/new/ https://reviews.llvm.org/D110482 Files: clang/include/clang/AST/Stmt.h clang/include/

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Parse/ParseStmt.cpp:1520-1525 + if (IsConsteval) { +if (!isa_and_nonnull(ThenStmt.get())) { + Diag(ConstevalLoc, diag::err_expected_after) << "consteval" + << "{

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-29 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added inline comments. Comment at: clang/lib/Parse/ParseStmt.cpp:1520-1525 + if (IsConsteval) { +if (!isa_and_nonnull(ThenStmt.get())) { + Diag(ConstevalLoc, diag::err_expected_after) << "consteval" + << "{"; +

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-29 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Parse/ParseStmt.cpp:1520-1525 + if (IsConsteval) { +if (!isa_and_nonnull(ThenStmt.get())) { + Diag(ConstevalLoc, diag::err_expected_after) << "consteval" + << "{

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-29 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 376004. cor3ntin marked 3 inline comments as done. cor3ntin added a comment. Adress Aaron's comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/new/ https://reviews.llvm.org/D110482 Files: clang/i

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-29 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 375974. cor3ntin marked 15 inline comments as done. cor3ntin added a comment. Fix comment Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/new/ https://reviews.llvm.org/D110482 Files: clang/include/clan

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-29 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/AST/Stmt.h:164 -/// True if this if statement is a constexpr if. -unsigned IsConstexpr : 1; +/// Whether this is an if constexpr if or a consteval if or neither. +IfStatementKind Kind : 3;

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-29 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 375970. cor3ntin added a comment. use llvm::reverse Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/new/ https://reviews.llvm.org/D110482 Files: clang/include/clang/AST/Stmt.h clang/include/clang/Bas

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-29 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added inline comments. Comment at: clang/lib/AST/Interp/ByteCodeStmtGen.cpp:195 + if (IS->isNegatedConsteval()) +return IS->getElse(); + aaron.ballman wrote: > This probably signals that we're missing some test coverage, but this is the > first I'v

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-29 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 375927. cor3ntin marked 20 inline comments as done. cor3ntin added a comment. - Add Bytecode gen tests - use consteval if consistently - use isConsteval/isNegatedConsteval/istNonNegatedConsteval - Address other comments Repository: rG LLVM Github Monorepo

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-29 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/include/clang/AST/Stmt.h:166 +/// True if this if statement is a if consteval statement. +unsigned IsConsteval : 1; aaron.ballman wrote: > erichkeane wrote: > > cor3ntin wrote: > > > erichkeane wrote:

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-29 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/AST/Stmt.h:164 -/// True if this if statement is a constexpr if. -unsigned IsConstexpr : 1; +/// Whether this is an if constexpr if or a consteval if or neither. +IfStatementKind Kind : 3;

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-28 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. A handful of 'nits' (at best), and a wish for the `if consteval` vs `consteval if` to be consistent, but otherwise LGTM. Hopefully @aaron.ballman can come and do a final pass. Comment at: clang/include/clang/AST/Stmt.h:164 -/// True if this

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-28 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 375615. cor3ntin added a comment. - Use a dedicated enums - Add more tests - Improve CodeGen tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/new/ https://reviews.llvm.org/D110482 Files: clang/inc

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-28 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added inline comments. Comment at: clang/lib/Parse/ParseStmt.cpp:1541 + if (IsConsteval && NotLocation.isValid()) { +if (ElseStmt.isUnset()) + ElseStmt = Actions.ActOnNullStmt(ThenStmtLoc); aaron.ballman wrote: > cor3ntin wrote: > > aaron.ballm

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-28 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. So I have some heartburn about `IsNegatedConsteval`. A part of me wants to suggest ditching the `ConstexprKind` and creating a new scoped-enum `IfStmtKind` (perhaps in the same file) that has just `None,Constexpr,Consteval,NotConsteval`. Its already a bit hinky tha

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-28 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 375487. cor3ntin added a comment. - Add IfStmt::isNegatedConsteval to track whether the if consteval statement was negated - Add json/text AST dumps tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 375374. cor3ntin marked 3 inline comments as done. cor3ntin added a comment. Add parens in CFG.cpp Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/new/ https://reviews.llvm.org/D110482 Files: clang/inc

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/lib/Parse/ParseStmt.cpp:1541 + if (IsConsteval && NotLocation.isValid()) { +if (ElseStmt.isUnset()) + ElseStmt = Actions.ActOnNullStmt(ThenStmtLoc); aaron.ballman wrote: > cor3ntin wrote: > > aaron.bal

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 375370. cor3ntin added a comment. Formatting Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/new/ https://reviews.llvm.org/D110482 Files: clang/include/clang/AST/Stmt.h clang/include/clang/Basic/Diag

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Parse/ParseStmt.cpp:1541 + if (IsConsteval && NotLocation.isValid()) { +if (ElseStmt.isUnset()) + ElseStmt = Actions.ActOnNullStmt(ThenStmtLoc); cor3ntin wrote: > aaron.ballman wrote: > > erichk

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added inline comments. Comment at: clang/lib/Parse/ParseStmt.cpp:1541 + if (IsConsteval && NotLocation.isValid()) { +if (ElseStmt.isUnset()) + ElseStmt = Actions.ActOnNullStmt(ThenStmtLoc); aaron.ballman wrote: > erichkeane wrote: > > So this i

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:5942 "jump bypasses initialization of VLA type alias">; def note_protected_by_constexpr_if : Note< "jump enters controlled statement of constexpr if">; cor3ntin

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added inline comments. Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:5942 "jump bypasses initialization of VLA type alias">; def note_protected_by_constexpr_if : Note< "jump enters controlled statement of constexpr if">; erichkeane

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Parse/ParseStmt.cpp:1541 + if (IsConsteval && NotLocation.isValid()) { +if (ElseStmt.isUnset()) + ElseStmt = Actions.ActOnNullStmt(ThenStmtLoc); erichkeane wrote: > So this is interesting. I'm

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/lib/AST/Stmt.cpp:915 -IfStmt::IfStmt(const ASTContext &Ctx, SourceLocation IL, bool IsConstexpr, - Stmt *Init, VarDecl *Var, Expr *Cond, SourceLocation LPL, - SourceLocation RPL, Stmt *Then, SourceL

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 375352. cor3ntin added a comment. Herald added a subscriber: dexonsmith. use ConstexprSpecKind to describe whether the IfStmt is constexpr or consteval. Other minor fixes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llv

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. Note I didn't have a good chance to re-review this, but wanted to give my feedback to the comments right away. Comment at: clang/include/clang/AST/Stmt.h:166 +/// True if this if statement is a if consteval statement. +unsigned IsConsteval

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added inline comments. Comment at: clang/include/clang/AST/Stmt.h:166 +/// True if this if statement is a if consteval statement. +unsigned IsConsteval : 1; erichkeane wrote: > Not sure how others feel here, but for me, I kinda hate that we're

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 375306. cor3ntin marked 3 inline comments as done. cor3ntin added a comment. - Rename isImmediate to isImmediateFunctionContext - Fix And cleanup Diagnostics in ParseStmt.cpp - Add assert in SemaStmt.cpp - Fix StmtPrinter.cpp Repository: rG LLVM Github

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-27 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/include/clang/AST/Stmt.h:166 +/// True if this if statement is a if consteval statement. +unsigned IsConsteval : 1; Not sure how others feel here, but for me, I kinda hate that we're using 'unsigned'

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-25 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 375065. cor3ntin added a comment. Update cxx_status.html Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/new/ https://reviews.llvm.org/D110482 Files: clang/include/clang/AST/Stmt.h clang/include/clan

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-25 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 375064. cor3ntin added a comment. Rebase Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/new/ https://reviews.llvm.org/D110482 Files: clang/include/clang/AST/Stmt.h clang/include/clang/Basic/Diagnost

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-25 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 375046. cor3ntin added a comment. Fix tests formatting Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/new/ https://reviews.llvm.org/D110482 Files: clang/include/clang/AST/Stmt.h clang/include/clang/

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-25 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 375045. cor3ntin added a comment. Remove untested clang-format changes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110482/new/ https://reviews.llvm.org/D110482 Files: clang/include/clang/AST/Stmt.h clan

[PATCH] D110482: [clang] Implement if consteval (P1938)

2021-09-25 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin created this revision. Herald added subscribers: wenlei, martong. Herald added a reviewer: shafik. cor3ntin requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Modify the IfStmt node to tuppoort constant evaluated expressions. Add a n