[PATCH] D89765: [LibTooling][Clang-cast] A Clang LibTool to convert C-style casts to C++ style casts and more.

Ray Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 20 13:53:33 PDT 2020


oneraynyday added a comment.

In D89765#2342624 <https://reviews.llvm.org/D89765#2342624>, @awarzynski wrote:

> 



> - Have you considered sending an RFC to cfe-dev regarding this tool?  I think that it would be a great way of attracting peoples attention. More importantly, should we add another tool to clang-tools-extra?

Hi @awarzynski, thank you so much for taking a look! I was considering sending an RFC but haven't gotten around to it yet. Funny enough, how I started the development on this tool was because of this page: https://clang.llvm.org/docs/ClangTools.html which encourages newcomers to clang to create new tools. Specifically this line:

> C++ cast conversion tool. Will convert C-style casts ((type) value) to appropriate C++ cast (static_cast, const_cast or reinterpret_cast).

I did exactly this project(was much bigger of an undertaking than I had first imagined) and was hoping to contribute back, assuming that everyone would be fairly receptive to having an extra tool that helps the community :) In retrospect, I do realize that this could be a feature in clang-tidy and I noted in the `NOTES` section that I can contribute a subset of the functionalities into clang-tidy as well.

> - [This] is a rather large patch - could you split it into separate chunks? Otherwise it's quite tricky to review.

Of course, I'd be glad to make the review experience better for you. How do you want me to split it into chunks? I had the following in mind:

- First patch: `CStyleCastOperator` class in Cast.h (with all the unit tests)
- Second patch: Creating the minimal matcher, consumer, action and necessary CLI options
- Third patch: Adding in the matcher implementation which emits diagnostics.

Let me know what you think.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89765/new/

https://reviews.llvm.org/D89765



More information about the cfe-commits mailing list