diff options
author | Matthias Gehre <M.Gehre@gmx.de> | 2019-08-19 21:59:44 +0000 |
---|---|---|
committer | Matthias Gehre <M.Gehre@gmx.de> | 2019-08-19 21:59:44 +0000 |
commit | 5b3275e56f3c8e1b3cbc15f3866d903b9275c132 (patch) | |
tree | f1926504a23f7c1af3c6456e4f25f07b109b58e5 /lldb/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py | |
parent | 8b962f2814999e1cf48e964096fb9b657ba5b6eb (diff) | |
download | bcm5719-llvm-5b3275e56f3c8e1b3cbc15f3866d903b9275c132.tar.gz bcm5719-llvm-5b3275e56f3c8e1b3cbc15f3866d903b9275c132.zip |
[ORC] fix use-after-free detected by -Wreturn-stack-address
Summary:
llvm/lib/ExecutionEngine/Orc/Layer.cpp:53:12: warning: returning address of local temporary object [-Wreturn-stack-address]
In
```
StringRef IRMaterializationUnit::getName() const {
[...]
return TSM.withModuleDo(
[](const Module &M) { return M.getModuleIdentifier(); });
```
`getModuleIdentifier()` returns a `const std::string &`, but the implicit return type
of the lambda is `std::string` by value, and thus the returned `StringRef` refers
to a temporary `std::string`.
Detect by annotating `llvm::StringRef` with `[[gsl::Pointer]]`.
Reviewers: lhames, sgraenitz
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66440
llvm-svn: 369306
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py')
0 files changed, 0 insertions, 0 deletions