[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-14 Thread Timm Bäder via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. tbaeder marked an inline comment as done. Closed by commit rG5a859432f317: [clang][Interp] Implement while and do-while loops (authored by tbaeder). Changed prior to commit: https://reviews.llvm.org/D135433?vs=466259&id=4

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM! Comment at: clang/lib/AST/Interp/ByteCodeStmtGen.cpp:293 + LabelTy CondLabel = this->getLabel(); // Label before the condition. + LabelTy EndLabel = thi

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-10 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added inline comments. Comment at: clang/test/AST/Interp/loops.cpp:9 + +namespace WhileLoop { + constexpr int f() { tbaeder wrote: > shafik wrote: > > infinite loop w/o a side effect are undefined behavior and so should be > > ill-formed and generate a d

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-10 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/test/AST/Interp/loops.cpp:9 + +namespace WhileLoop { + constexpr int f() { shafik wrote: > infinite loop w/o a side effect are undefined behavior and so should be > ill-formed and generate a diagnostic e.g. `whil

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-09 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added inline comments. Comment at: clang/test/AST/Interp/loops.cpp:9 + +namespace WhileLoop { + constexpr int f() { infinite loop w/o a side effect are undefined behavior and so should be ill-formed and generate a diagnostic e.g. `while(1);`, so we shoul

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-07 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 466259. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135433/new/ https://reviews.llvm.org/D135433 Files: clang/lib/AST/Interp/ByteCodeStmtGen.cpp clang/lib/AST/Interp/ByteCodeStmtGen.h clang/test/AST/Interp/loops.cpp Index: clang/test/AST/Int

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-07 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/test/AST/Interp/loops.cpp:93 + } + static_assert(f4() == 5, ""); +}; aaron.ballman wrote: > Can you also add some tests that use nested loops with multiple levels of > `break` and `continue` use? > > Also, I th

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-07 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/test/AST/Interp/loops.cpp:93 + } + static_assert(f4() == 5, ""); +}; Can you also add some tests that use nested loops with multiple levels of `break` and `continue` use? Also, I think it might be useful

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-07 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 466022. tbaeder added a comment. Add `break` and `continue` support as well. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135433/new/ https://reviews.llvm.org/D135433 Files: clang/lib/AST/Interp/ByteCodeStmtGen.cpp clang/lib/AST/Interp/ByteCod

[PATCH] D135433: [clang][Interp] Implement while and do-while loops

2022-10-07 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, shafik, tahonermann. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. I was wondering whether it is somehow possible to g