mgehre created this revision.
mgehre added reviewers: jingham, JDevlieghere.
Herald added a project: LLDB.

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`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66442

Files:
  lldb/source/Core/FormatEntity.cpp


Index: lldb/source/Core/FormatEntity.cpp
===================================================================
--- lldb/source/Core/FormatEntity.cpp
+++ lldb/source/Core/FormatEntity.cpp
@@ -2347,7 +2347,7 @@
 }
 
 size_t FormatEntity::AutoComplete(CompletionRequest &request) {
-  llvm::StringRef str = request.GetCursorArgumentPrefix().str();
+  llvm::StringRef str = request.GetCursorArgumentPrefix();
 
   request.SetWordComplete(false);
 


Index: lldb/source/Core/FormatEntity.cpp
===================================================================
--- lldb/source/Core/FormatEntity.cpp
+++ lldb/source/Core/FormatEntity.cpp
@@ -2347,7 +2347,7 @@
 }
 
 size_t FormatEntity::AutoComplete(CompletionRequest &request) {
-  llvm::StringRef str = request.GetCursorArgumentPrefix().str();
+  llvm::StringRef str = request.GetCursorArgumentPrefix();
 
   request.SetWordComplete(false);
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] D66... Matthias Gehre via Phabricator via lldb-commits

Reply via email to