File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ namespace llvm {
54
54
// / situations where the character data resides in some other buffer, whose
55
55
// / lifetime extends past that of the StringRef. For this reason, it is not in
56
56
// / general safe to store a StringRef.
57
- class StringRef {
57
+ class LLVM_GSL_POINTER StringRef {
58
58
public:
59
59
static const size_t npos = ~size_t (0 );
60
60
Original file line number Diff line number Diff line change 289
289
#define LLVM_REQUIRE_CONSTANT_INITIALIZATION
290
290
#endif
291
291
292
+ // / LLVM_GSL_POINTER - Apply this to non-owning classes like
293
+ // / StringRef to enable lifetime warnings.
294
+ #if LLVM_HAS_CPP_ATTRIBUTE(gsl::Pointer)
295
+ #define LLVM_GSL_POINTER [[gsl::Pointer]]
296
+ #else
297
+ #define LLVM_GSL_POINTER
298
+ #endif
299
+
292
300
// / LLVM_EXTENSION - Support compilers where we have a keyword to suppress
293
301
// / pedantic diagnostics.
294
302
#ifdef __GNUC__
You can’t perform that action at this time.
0 commit comments