[all-commits] [llvm/llvm-project] 1a8dd7: [include-cleaner] clang-include-cleaner can print/...

Sam McCall via All-commits all-commits at lists.llvm.org
Fri Dec 2 04:17:13 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1a8dd7425873fae55a38cbdb41cccb1f17c82e8c
      https://github.com/llvm/llvm-project/commit/1a8dd7425873fae55a38cbdb41cccb1f17c82e8c
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2022-12-02 (Fri, 02 Dec 2022)

  Changed paths:
    M clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
    M clang-tools-extra/include-cleaner/lib/Analysis.cpp
    M clang-tools-extra/include-cleaner/lib/CMakeLists.txt
    A clang-tools-extra/include-cleaner/test/Inputs/foobar.h
    A clang-tools-extra/include-cleaner/test/tool.cpp
    M clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
    M clang-tools-extra/include-cleaner/unittests/AnalysisTest.cpp
    M clang/lib/Format/Format.cpp

  Log Message:
  -----------
  [include-cleaner] clang-include-cleaner can print/apply edits

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.

Differential Revision: https://reviews.llvm.org/D139013




More information about the All-commits mailing list