1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

Revert "Revert "[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef""

This reverts commit bac85ab3b55d02f0a1e824712f185af42cd1ea04.
This commit is contained in:
Matthias Gehre 2020-04-16 14:10:06 +02:00
parent 03145eabea
commit 97482cc282
2 changed files with 9 additions and 1 deletions

View File

@ -54,7 +54,7 @@ namespace llvm {
/// situations where the character data resides in some other buffer, whose /// 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 /// lifetime extends past that of the StringRef. For this reason, it is not in
/// general safe to store a StringRef. /// general safe to store a StringRef.
class StringRef { class LLVM_GSL_POINTER StringRef {
public: public:
static const size_t npos = ~size_t(0); static const size_t npos = ~size_t(0);

View File

@ -289,6 +289,14 @@
#define LLVM_REQUIRE_CONSTANT_INITIALIZATION #define LLVM_REQUIRE_CONSTANT_INITIALIZATION
#endif #endif
/// LLVM_GSL_POINTER - Apply this to non-owning classes like
/// StringRef to enable lifetime warnings.
#if LLVM_HAS_CPP_ATTRIBUTE(gsl::Pointer)
#define LLVM_GSL_POINTER [[gsl::Pointer]]
#else
#define LLVM_GSL_POINTER
#endif
/// LLVM_EXTENSION - Support compilers where we have a keyword to suppress /// LLVM_EXTENSION - Support compilers where we have a keyword to suppress
/// pedantic diagnostics. /// pedantic diagnostics.
#ifdef __GNUC__ #ifdef __GNUC__