HomePhabricator

Fix use-after-free

Authored by mgehre on Aug 19 2019, 2:39 PM.

Description

Fix use-after-free

Summary:
The warning

lldb/source/Core/FormatEntity.cpp:2350:25: warning: object backing the pointer will be destroyed at the end of the full-expression [-Wdangling]

is emitted after annotating llvm::StringRef with [[gsl::Pointer]].

The reason is that in

size_t FormatEntity::AutoComplete(CompletionRequest &request) {
 llvm::StringRef str = request.GetCursorArgumentPrefix().str();

the function GetCursorArgumentPrefix() returns a StringRef, and StringRef::str() returns
a temporary std::string.

Reviewers: jingham, JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D66442

llvm-svn: 369304

Details

Committed
mgehreAug 19 2019, 2:39 PM
Differential Revision
D66442: Fix use-after-free
Parents
rGde7674ce76e0: Recommit "[Attributor] Fix: Do not partially resolve returned calls."
Branches
Unknown
Tags
Unknown