Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Hi,
We've observed that this patch introduces infinite loops in some cases. Here's a reduced test case:
export class Foo extends Bar { get case(): Case { return ( (this.Bar$has('case')) ? (this.Bar$get('case')) : (this.case = new Case())); } }
Saving this as /tmp/test.ts and running clang-format /tmp/test.ts loops indefinitely with this patch (I stopped it after 1m27s) and finishes instantly (0.12s) after reverting the patch locally. I'm going to go ahead and push a revert. Please let me know if you need help reproducing the problem.
clang/lib/Format/UnwrappedLineParser.cpp | ||
---|---|---|
1827 | Here's the loop. In the switch before that worked, since it was not in a loop. Here we need to do something. (nextToken()?) |
Thanks for the reproducer.
clang/lib/Format/UnwrappedLineParser.cpp | ||
---|---|---|
1827 | Yes, it seems so. I'll add a test case and fix it. |
Relanded in https://github.com/llvm/llvm-project/commit/4e88cb6825eefca3c0eb66b5ae40ab123fcc7073 with a fix and a regression test.
Can we move them 1 line up so that the order of the declarations here will be the same as that of the definitions in the .cpp file?