[all-commits] [llvm/llvm-project] 8ab3ca: [Clang][Parser] Don't always destroy template anno...
Younan Zhang via All-commits
all-commits at lists.llvm.org
Tue Apr 23 05:34:44 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8ab3caf4d3acef29f373e09bc6a0ac459918930e
https://github.com/llvm/llvm-project/commit/8ab3caf4d3acef29f373e09bc6a0ac459918930e
Author: Younan Zhang <zyn7109 at gmail.com>
Date: 2024-04-23 (Tue, 23 Apr 2024)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Parse/Parser.h
M clang/lib/Parse/ParseTemplate.cpp
M clang/test/Parser/cxx2a-constrained-template-param.cpp
Log Message:
-----------
[Clang][Parser] Don't always destroy template annotations at the end of a declaration (#89494)
Since
[6163aa9](https://github.com/llvm/llvm-project/commit/6163aa96799cbad7f2f58e02c5bebee9647056a5#diff-3a7ef0bff7d2b73b4100de636f09ea68b72eda191b39c8091a6a1765d917c1a2),
we have introduced an optimization that almost always destroys
TemplateIdAnnotations at the end of a function declaration. This doesn't
always work properly: a lambda within a default template argument could
also result in such deallocation and hence a use-after-free bug while
building a type constraint on the template parameter.
This patch adds another flag to the parser to tell apart cases when we
shouldn't do such cleanups eagerly. A bit complicated as it is, this retains
the optimization on a highly templated function with lots of generic lambdas.
Note the test doesn't always trigger a conspicuous bug/crash even with a
debug build. But a sanitizer build can detect them, I believe.
Fixes https://github.com/llvm/llvm-project/issues/67235
Fixes https://github.com/llvm/llvm-project/issues/89127
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list