[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef
authorMatthias Gehre <gehre.matthias@gmail.com>
Mon, 19 Aug 2019 21:28:04 +0000 (23:28 +0200)
committerMatthias Gehre <gehre.matthias@gmail.com>
Thu, 16 Apr 2020 06:23:30 +0000 (08:23 +0200)
Summary:
This detected the bugs fixed in
  https://reviews.llvm.org/D66442
and
  https://reviews.llvm.org/D66440

The warning itself was implemented in
  https://reviews.llvm.org/D63954
  https://reviews.llvm.org/D64256
  https://reviews.llvm.org/D65120
  https://reviews.llvm.org/D65127
  https://reviews.llvm.org/D66152

Reviewers: zturner, mehdi_amini, gribozavr

Subscribers: dexonsmith, Szelethus, xazax.hun, llvm-commits

Tags: #llvm

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

llvm/include/llvm/ADT/StringRef.h

index ad31517..337efd6 100644 (file)
@@ -54,7 +54,7 @@ namespace llvm {
   /// situations where the character data resides in some other buffer, whose
   /// lifetime extends past that of the StringRef. For this reason, it is not in
   /// general safe to store a StringRef.
-  class StringRef {
+  class [[gsl::Pointer]] StringRef {
   public:
     static const size_t npos = ~size_t(0);