Open aferr opened 2 years ago
I don't have the complete context of the new code. However, holding on to absl::string_view
has lifetime implications.
In case it is helpful, the rest of the context is this thread
ARGH, that link is useless, and there doesn't appear to be a way to get a useful one :( :)
Just to address the confusion here: when I was suggesting absl::string_view
, I was mostly suggesting it for the parameters that lead up to the creating of Predicate
s (or soon-to-be PredicateModifier
s) so you didn't have to wrap string literals in std::string
constructor calls. Once you get to actually creating a long-lived object that refers to a string, I think it is appropriate to make PredicateModifier
hold onto its own std::string
to eliminate lifetime concerns, as @bgogul suggests.
cc: @markww
Improve performance by eliminating extra copies of predicates when translating from authorization logic to Datalog. This can be done by extending the
dlir.h
with a predicate modifier class like:and by replacing occurances of
Predicate
in thedlir.h
tree with another new class with a private member of typestd::variant<Predicate, PredicateModifier
.The implementation of
PushOntoPred
ofdlir.h
would then need to be updated to to produce PredicateModifiers instead of just predicates.