[llvm-branch-commits] [llvm] 79060d2 - [LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef

Matthias Gehre via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Apr 15 15:08:55 PDT 2020


Author: Matthias Gehre
Date: 2020-04-16T00:08:41+02:00
New Revision: 79060d2ea122a28f595e719432fbafa18f3b9eb9

URL: https://github.com/llvm/llvm-project/commit/79060d2ea122a28f595e719432fbafa18f3b9eb9
DIFF: https://github.com/llvm/llvm-project/commit/79060d2ea122a28f595e719432fbafa18f3b9eb9.diff

LOG: [LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef

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

Added: 
    

Modified: 
    llvm/include/llvm/ADT/StringRef.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h
index ad31517a1ea7..337efd641135 100644
--- a/llvm/include/llvm/ADT/StringRef.h
+++ b/llvm/include/llvm/ADT/StringRef.h
@@ -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);
 


        


More information about the llvm-branch-commits mailing list