Commit a7d70c87 by Abseil Team Committed by Copybara-Service

Add ABSL_INTERNAL_ATTRIBUTE_VIEW and ABSL_INTERNAL_ATTRIBUTE_OWNER attributes to Abseil.

This will enable diagnoses similar to those enabled by ABSL_ATTRIBUTE_LIFETIME_BOUND.

See the following links for details:
https://reviews.llvm.org/D64448
https://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html

PiperOrigin-RevId: 636650605
Change-Id: Iab3a768d57775863addcf0a7c773551ee8f424c6
parent 9e095d74
...@@ -821,6 +821,32 @@ ...@@ -821,6 +821,32 @@
#define ABSL_ATTRIBUTE_LIFETIME_BOUND #define ABSL_ATTRIBUTE_LIFETIME_BOUND
#endif #endif
// ABSL_INTERNAL_ATTRIBUTE_VIEW indicates that a type acts like a view i.e. a
// raw (non-owning) pointer. This enables diagnoses similar to those enabled by
// ABSL_ATTRIBUTE_LIFETIME_BOUND.
//
// See the following links for details:
// https://reviews.llvm.org/D64448
// https://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html
#if ABSL_HAVE_CPP_ATTRIBUTE(gsl::Pointer)
#define ABSL_INTERNAL_ATTRIBUTE_VIEW [[gsl::Pointer]]
#else
#define ABSL_INTERNAL_ATTRIBUTE_VIEW
#endif
// ABSL_INTERNAL_ATTRIBUTE_OWNER indicates that a type acts like a smart
// (owning) pointer. This enables diagnoses similar to those enabled by
// ABSL_ATTRIBUTE_LIFETIME_BOUND.
//
// See the following links for details:
// https://reviews.llvm.org/D64448
// https://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html
#if ABSL_HAVE_CPP_ATTRIBUTE(gsl::Owner)
#define ABSL_INTERNAL_ATTRIBUTE_OWNER [[gsl::Owner]]
#else
#define ABSL_INTERNAL_ATTRIBUTE_OWNER
#endif
// ABSL_ATTRIBUTE_TRIVIAL_ABI // ABSL_ATTRIBUTE_TRIVIAL_ABI
// Indicates that a type is "trivially relocatable" -- meaning it can be // Indicates that a type is "trivially relocatable" -- meaning it can be
// relocated without invoking the constructor/destructor, using a form of move // relocated without invoking the constructor/destructor, using a form of move
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment