[PATCH] D135433: [clang][Interp] Implement while and do-while loops
Shafik Yaghmour via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 10 09:49:38 PDT 2022
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 diagnostic e.g. `while(1);`, so we should check these cases.
> I think that's better done with a more general approach that limits the iteration count for all loops like the current interpreter does. But that would probably blow up this patch too much.
>
> Unfortunately I can't add test case for the case you describe because the clang process with the new interpreter would never terminate :) Can add a commented-out version though.
I think that is fine approach for now.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135433/new/
https://reviews.llvm.org/D135433
More information about the cfe-commits
mailing list