[PATCH] D136782: [include-cleaner] Move the writeHTMLReport to the public header, NFC.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 26 12:44:28 PDT 2022


hokein created this revision.
hokein added a reviewer: sammccall.
Herald added a project: All.
hokein requested review of this revision.
Herald added a project: clang-tools-extra.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136782

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
  clang-tools-extra/include-cleaner/lib/AnalysisInternal.h
  clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
  clang-tools-extra/include-cleaner/tool/CMakeLists.txt
  clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp


Index: clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
===================================================================
--- clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
+++ clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "AnalysisInternal.h"
+#include "clang-include-cleaner/Analysis.h"
 #include "clang-include-cleaner/Record.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendAction.h"
Index: clang-tools-extra/include-cleaner/tool/CMakeLists.txt
===================================================================
--- clang-tools-extra/include-cleaner/tool/CMakeLists.txt
+++ clang-tools-extra/include-cleaner/tool/CMakeLists.txt
@@ -1,6 +1,5 @@
 set(LLVM_LINK_COMPONENTS Support)
 
-include_directories("../lib") # FIXME: use public APIs instead.
 add_clang_tool(clang-include-cleaner IncludeCleaner.cpp)
 clang_target_link_libraries(clang-include-cleaner PRIVATE
   clangBasic
Index: clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
===================================================================
--- clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
+++ clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
@@ -14,6 +14,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "AnalysisInternal.h"
+#include "clang-include-cleaner/Analysis.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/PrettyPrinter.h"
Index: clang-tools-extra/include-cleaner/lib/AnalysisInternal.h
===================================================================
--- clang-tools-extra/include-cleaner/lib/AnalysisInternal.h
+++ clang-tools-extra/include-cleaner/lib/AnalysisInternal.h
@@ -25,7 +25,6 @@
 #include "llvm/ADT/STLFunctionalExtras.h"
 
 namespace clang {
-class ASTContext;
 class Decl;
 class NamedDecl;
 namespace include_cleaner {
@@ -42,11 +41,6 @@
 /// being analyzed, in order to find all references within it.
 void walkAST(Decl &Root, llvm::function_ref<void(SourceLocation, NamedDecl &)>);
 
-/// Write an HTML summary of the analysis to the given stream.
-/// FIXME: Once analysis has a public API, this should be public too.
-void writeHTMLReport(FileID File, llvm::ArrayRef<Decl *> Roots, ASTContext &Ctx,
-                     llvm::raw_ostream &OS);
-
 } // namespace include_cleaner
 } // namespace clang
 
Index: clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
===================================================================
--- clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
+++ clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
@@ -12,12 +12,13 @@
 #define CLANG_INCLUDE_CLEANER_ANALYSIS_H
 
 #include "clang-include-cleaner/Types.h"
+#include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include <variant>
 
 namespace clang {
-class SourceLocation;
+class ASTContext;
 class Decl;
 class FileEntry;
 namespace include_cleaner {
@@ -46,6 +47,10 @@
 /// (e.g. IWYU pragmas).
 void walkUsed(llvm::ArrayRef<Decl *> ASTRoots, UsedSymbolCB CB);
 
+// Write an HTML summary of the analysis to the given stream.
+void writeHTMLReport(FileID File, llvm::ArrayRef<Decl *> Roots, ASTContext &Ctx,
+                     llvm::raw_ostream &OS);
+
 } // namespace include_cleaner
 } // namespace clang
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136782.470905.patch
Type: text/x-patch
Size: 3524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221026/0e522f05/attachment.bin>


More information about the cfe-commits mailing list