This is an archive of the discontinued LLVM Phabricator instance.

[libTooling] Introduce the MatchConsumer abstraction
ClosedPublic

Authored by ymandel on Sep 24 2019, 6:25 AM.

Details

Summary

This revision introduces a separate (small) library for the MatchConsumer
abstraction: computations over AST match results. This abstraction is central
to the Transformer framework, and there deserves being defined explicitly.

Diff Detail

Repository
rL LLVM

Event Timeline

ymandel created this revision.Sep 24 2019, 6:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 24 2019, 6:25 AM
ymandel updated this revision to Diff 221531.Sep 24 2019, 6:26 AM

clang-format

gribozavr accepted this revision.Sep 25 2019, 5:11 AM
gribozavr added inline comments.
clang/include/clang/Tooling/Refactoring/MatchConsumer.h
9 ↗(On Diff #221531)

\file

27 ↗(On Diff #221531)

The comment seems to be a mix of documentation and design justification. How about this?

A failable computation over nodes bound by AST matchers.

It is a central abstraction of the Transformer framework.

The computation should report any errors though its return value (rather than terminating the program) to enable usage in interactive scenarios like clang-query.
39 ↗(On Diff #221531)

"Creates an error that signals that a MatchConsumer expected a certain node to be bound by AST matchers, but is was not actually bound."

This revision is now accepted and ready to land.Sep 25 2019, 5:11 AM
ymandel updated this revision to Diff 221733.Sep 25 2019, 5:59 AM
ymandel marked 3 inline comments as done.

addressed comments.

ymandel marked an inline comment as done.Sep 25 2019, 6:01 AM
ymandel added inline comments.
clang/include/clang/Tooling/Refactoring/MatchConsumer.h
27 ↗(On Diff #221531)

Much better, thanks!

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 25 2019, 6:35 AM