[PATCH] D125311: [pseudo] Share the underly payload when stripping comments for a token stream
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 18 23:41:52 PDT 2022
sammccall added a comment.
In D125311#3523388 <https://reviews.llvm.org/D125311#3523388>, @hokein wrote:
> In D125311#3503452 <https://reviews.llvm.org/D125311#3503452>, @sammccall wrote:
>
>> This looks good, but if that's the idiom we should add it to cook() also.
>
> cook is more tricky, it takes a TokenStream, and returns a new one with an allocator payload:
>
> - the input TokenStream doesn't have a payload, this is OK
> - the input TokenStream has a payload, but what if the type of payload is not an allocator?
Payload is opaque, it can be a pair of {new payload, inner payload}. e.g.
void TokenStream::addPayload(shared_ptr<void> P) {
Payload = make_shared<pair<shared_ptr<void>, shared_ptr<void>>>(std::move(P), std::move(Payload));
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125311/new/
https://reviews.llvm.org/D125311
More information about the cfe-commits
mailing list