aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunctionSplitter.cpp
diff options
context:
space:
mode:
authorYounan Zhang <zyn7109@gmail.com>2024-04-23 20:34:22 +0800
committerGitHub <noreply@github.com>2024-04-23 20:34:22 +0800
commit8ab3caf4d3acef29f373e09bc6a0ac459918930e (patch)
tree675b55213367fe5200efd4877c0d40cab99cfcdc /llvm/lib/CodeGen/MachineFunctionSplitter.cpp
parent304dfe10bd96ef8badd53d4796bba070cc8d30dc (diff)
downloadllvm-8ab3caf4d3acef29f373e09bc6a0ac459918930e.zip
llvm-8ab3caf4d3acef29f373e09bc6a0ac459918930e.tar.gz
llvm-8ab3caf4d3acef29f373e09bc6a0ac459918930e.tar.bz2
[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
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunctionSplitter.cpp')
0 files changed, 0 insertions, 0 deletions