Page MenuHomePhabricator

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

Authored by mgehre on Aug 19 2019, 2:36 PM.

Event Timeline

mgehre created this revision.Aug 19 2019, 2:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 19 2019, 2:36 PM
mgehre edited the summary of this revision. (Show Details)Aug 19 2019, 2:38 PM

I do not know if there are some build bots with -Werror that would warn for unknown attributes. In case it fails the build bots we could extend the include/llvm/Support/Compiler.h header with a macro.

gribozavr accepted this revision.Aug 20 2019, 1:16 AM
This revision is now accepted and ready to land.Aug 20 2019, 1:16 AM

Seems like an attribute that could go on ArrayRef as well?

Generally, ArrayRef is also a candidate. But there we have the complication that OwningArrayRef indirectly inherits from ArrayRef. One is a gsl::Owner, the other a gsl::Pointer, and we
need to make sure that we handle it correctly when OwningArrayRef is accessed through its base class which is then seen as a Pointer.
I would thus defer this part to a later PR.

Generally, ArrayRef is also a candidate. But there we have the complication that OwningArrayRef indirectly inherits from ArrayRef. One is a gsl::Owner, the other a gsl::Pointer, and we
need to make sure that we handle it correctly when OwningArrayRef is accessed through its base class which is then seen as a Pointer.
I would thus defer this part to a later PR.

Can OwningArrayRef be changed not to inherit from ArrayRef?