diff options
| author | Doug Wyatt <doug@sonosphere.com> | 2025-11-03 13:39:56 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-03 13:39:56 -0800 |
| commit | bc0d0cf3ac9b5f1c2ec33d22aba8e7ece7d08ed2 (patch) | |
| tree | 690c9e980ce59117f0fa24894db807f1a90bf25e /clang/lib/Frontend/CompilerInvocation.cpp | |
| parent | 5e8a0d64952f374ea0194d3d2876d1deeb8c5320 (diff) | |
| download | llvm-bc0d0cf3ac9b5f1c2ec33d22aba8e7ece7d08ed2.zip llvm-bc0d0cf3ac9b5f1c2ec33d22aba8e7ece7d08ed2.tar.gz llvm-bc0d0cf3ac9b5f1c2ec33d22aba8e7ece7d08ed2.tar.bz2 | |
[Clang] FunctionEffect analysis was missing a CXXBindTemporaryExpr's implicit call to a destructor. (#166110)
This example is reduced from a discovery: resetting a shared pointer
from a nonblocking function is not diagnosed.
```
void nb23()
{
struct X {
int *ptr = nullptr;
X() {}
~X() { delete ptr; }
};
auto inner = []() [[clang::nonblocking]] {
X();
};
}
```
`shared_ptr<T>::reset()` creates a temporary `shared_ptr` and swaps it
with its current state. The temporary `shared_ptr` constructor is
nonblocking but its destructor potentially deallocates memory and is
unsafe.
Analysis was ignoring the implicit call in the AST to destroy the
temporary.
---------
Co-authored-by: Doug Wyatt <dwyatt@apple.com>
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions
