This is an archive of the discontinued LLVM Phabricator instance.

[libTooling] Support TransformerResult<void> in consumer callbacks
ClosedPublic

Authored by li.zhe.hua on Mar 25 2022, 12:20 PM.

Details

Summary

Support TransformerResult<void> in the consumer callback, which
allows generic code to more naturally use the Transformer interface
(instead of needing to specialize on void).

This also delete the specialization that existed within Transformer
itself, instead replacing it with an std::function adapter.

Diff Detail

Event Timeline

li.zhe.hua created this revision.Mar 25 2022, 12:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2022, 12:20 PM
li.zhe.hua requested review of this revision.Mar 25 2022, 12:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2022, 12:20 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Fix comment.

ymandel accepted this revision.Mar 25 2022, 12:47 PM
ymandel added inline comments.
clang/include/clang/Tooling/Transformer/Transformer.h
126–128

Why won't a simple specialization work?

189–191

simplify to else if ?

This revision is now accepted and ready to land.Mar 25 2022, 12:47 PM

Fix for comments.

li.zhe.hua marked 2 inline comments as done.Mar 25 2022, 1:37 PM
li.zhe.hua added inline comments.
clang/include/clang/Tooling/Transformer/Transformer.h
126–128

Yup, totally. Done.

I guess I see SFINAE so much more often these days I just reach for it first.

li.zhe.hua marked an inline comment as done.Mar 25 2022, 1:38 PM
ymandel accepted this revision.Mar 25 2022, 1:44 PM
This revision was landed with ongoing or failed builds.Mar 28 2022, 8:41 AM
This revision was automatically updated to reflect the committed changes.