[clang-tools-extra] 4702d8d - [include-cleaner] Print the line number of removal #includes.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 14 01:52:27 PST 2022


Author: Haojian Wu
Date: 2022-12-14T10:52:13+01:00
New Revision: 4702d8d9cf80d6f80e68d20b3ff5c0bf8a43e000

URL: https://github.com/llvm/llvm-project/commit/4702d8d9cf80d6f80e68d20b3ff5c0bf8a43e000
DIFF: https://github.com/llvm/llvm-project/commit/4702d8d9cf80d6f80e68d20b3ff5c0bf8a43e000.diff

LOG: [include-cleaner] Print the line number of removal #includes.

I found that this information is helpful when using this tool.

Reviewed By: kadircet

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

Added: 
    

Modified: 
    clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
index cdd0ea722f7c5..f45a54b5ee9a3 100644
--- a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
+++ b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
@@ -130,7 +130,7 @@ class Action : public clang::ASTFrontendAction {
       switch (Print) {
       case PrintStyle::Changes:
         for (const Include *I : Results.Unused)
-          llvm::outs() << "- " << I->quote() << "\n";
+          llvm::outs() << "- " << I->quote() << " @Line:" << I->Line << "\n";
         for (const auto &I : Results.Missing)
           llvm::outs() << "+ " << I << "\n";
         break;


        


More information about the cfe-commits mailing list