[clang] [Clang][Parser] Don't always destroy template annotations at the end of a declaration (PR #89494)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 22 07:46:29 PDT 2024
zyn0217 wrote:
> If we remove MaybeDestroyTemplateIds(); in ParseStatementOrDeclaration, does it fix the bug, and does it actually impact performance?
It fixes the bug; however, I'm afraid we would also lose the chance to optimize the following:
```cpp
void foo() {
auto generic = []<class T>() {}; // 1'
auto generic_2 = []<class U, class V>() {}; // 2'
// ... and many more ...
} // We'd remove `T`, `U` and `V` here rather than at 1' and 2'.
```
https://github.com/llvm/llvm-project/pull/89494
More information about the cfe-commits
mailing list