[PATCH] D139013: [include-cleaner] clang-include-cleaner can print/apply edits

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 30 07:10:07 PST 2022


sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added a subscriber: mgrang.
Herald added a project: All.
sammccall requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

This adds command-line flags to the tool:
+ -print: prints changed source code
+ -print=changes: prints headers added/removed
+ -edit: rewrites code in place
+ -insert=0/-remove=0: disables additions/deletions for the above

These are supported by a couple of new functions dumped into Analysis:
analyze() sits on top of walkUsed and makes used/unused decisions for
Includes. fixIncludes() applies those results to source code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139013

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
  clang-tools-extra/include-cleaner/lib/Analysis.cpp
  clang-tools-extra/include-cleaner/test/Inputs/foobar.h
  clang-tools-extra/include-cleaner/test/tool.cpp
  clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
  clang-tools-extra/include-cleaner/unittests/AnalysisTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139013.478941.patch
Type: text/x-patch
Size: 16295 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221130/a9e7aedb/attachment-0001.bin>


More information about the cfe-commits mailing list