[clang-tools-extra] 7de5412 - [include-cleaner] NFC, use const HeaderSearch when possible.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 1 06:26:28 PDT 2023
Author: Haojian Wu
Date: 2023-06-01T15:26:19+02:00
New Revision: 7de541235f24e53af95d481df2bf8b15f6656ad3
URL: https://github.com/llvm/llvm-project/commit/7de541235f24e53af95d481df2bf8b15f6656ad3
DIFF: https://github.com/llvm/llvm-project/commit/7de541235f24e53af95d481df2bf8b15f6656ad3.diff
LOG: [include-cleaner] NFC, use const HeaderSearch when possible.
Added:
Modified:
clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
clang-tools-extra/include-cleaner/lib/Analysis.cpp
clang-tools-extra/include-cleaner/lib/AnalysisInternal.h
clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
clang-tools-extra/include-cleaner/lib/Record.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h b/clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
index 66916a52046cb..6d764c65a11b2 100644
--- a/clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
+++ b/clang-tools-extra/include-cleaner/include/clang-include-cleaner/Analysis.h
@@ -67,7 +67,7 @@ struct AnalysisResults {
AnalysisResults analyze(llvm::ArrayRef<Decl *> ASTRoots,
llvm::ArrayRef<SymbolReference> MacroRefs,
const Includes &I, const PragmaIncludes *PI,
- const SourceManager &SM, HeaderSearch &HS);
+ const SourceManager &SM, const HeaderSearch &HS);
/// Removes unused includes and inserts missing ones in the main file.
/// Returns the modified main-file code.
@@ -75,7 +75,7 @@ AnalysisResults analyze(llvm::ArrayRef<Decl *> ASTRoots,
std::string fixIncludes(const AnalysisResults &Results, llvm::StringRef Code,
const format::FormatStyle &IncludeStyle);
-std::string spellHeader(const Header &H, HeaderSearch &HS,
+std::string spellHeader(const Header &H, const HeaderSearch &HS,
const FileEntry *Main);
/// Gets all the providers for a symbol by traversing each location.
diff --git a/clang-tools-extra/include-cleaner/lib/Analysis.cpp b/clang-tools-extra/include-cleaner/lib/Analysis.cpp
index 84f1f4cc2cf54..bf50e064e9811 100644
--- a/clang-tools-extra/include-cleaner/lib/Analysis.cpp
+++ b/clang-tools-extra/include-cleaner/lib/Analysis.cpp
@@ -53,7 +53,7 @@ void walkUsed(llvm::ArrayRef<Decl *> ASTRoots,
}
}
-std::string spellHeader(const Header &H, HeaderSearch &HS,
+std::string spellHeader(const Header &H, const HeaderSearch &HS,
const FileEntry *Main) {
switch (H.kind()) {
case Header::Physical: {
@@ -73,7 +73,7 @@ std::string spellHeader(const Header &H, HeaderSearch &HS,
AnalysisResults analyze(llvm::ArrayRef<Decl *> ASTRoots,
llvm::ArrayRef<SymbolReference> MacroRefs,
const Includes &Inc, const PragmaIncludes *PI,
- const SourceManager &SM, HeaderSearch &HS) {
+ const SourceManager &SM, const HeaderSearch &HS) {
const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID());
llvm::DenseSet<const Include *> Used;
llvm::StringSet<> Missing;
diff --git a/clang-tools-extra/include-cleaner/lib/AnalysisInternal.h b/clang-tools-extra/include-cleaner/lib/AnalysisInternal.h
index 6bfed91b584b3..cd796c2da7b80 100644
--- a/clang-tools-extra/include-cleaner/lib/AnalysisInternal.h
+++ b/clang-tools-extra/include-cleaner/lib/AnalysisInternal.h
@@ -63,7 +63,7 @@ std::vector<Hinted<SymbolLocation>> locateSymbol(const Symbol &S);
void writeHTMLReport(FileID File, const Includes &,
llvm::ArrayRef<Decl *> Roots,
llvm::ArrayRef<SymbolReference> MacroRefs, ASTContext &Ctx,
- HeaderSearch &HS, PragmaIncludes *PI,
+ const HeaderSearch &HS, PragmaIncludes *PI,
llvm::raw_ostream &OS);
} // namespace include_cleaner
diff --git a/clang-tools-extra/include-cleaner/lib/HTMLReport.cpp b/clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
index c1d1982d4f487..65b82973c4290 100644
--- a/clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
+++ b/clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
@@ -134,7 +134,7 @@ class Reporter {
llvm::raw_ostream &OS;
const ASTContext &Ctx;
const SourceManager &SM;
- HeaderSearch &HS;
+ const HeaderSearch &HS;
const include_cleaner::Includes &Includes;
const PragmaIncludes *PI;
FileID MainFile;
@@ -208,7 +208,7 @@ class Reporter {
}
public:
- Reporter(llvm::raw_ostream &OS, ASTContext &Ctx, HeaderSearch &HS,
+ Reporter(llvm::raw_ostream &OS, ASTContext &Ctx, const HeaderSearch &HS,
const include_cleaner::Includes &Includes, const PragmaIncludes *PI,
FileID MainFile)
: OS(OS), Ctx(Ctx), SM(Ctx.getSourceManager()), HS(HS),
@@ -513,7 +513,7 @@ class Reporter {
void writeHTMLReport(FileID File, const include_cleaner::Includes &Includes,
llvm::ArrayRef<Decl *> Roots,
llvm::ArrayRef<SymbolReference> MacroRefs, ASTContext &Ctx,
- HeaderSearch &HS, PragmaIncludes *PI,
+ const HeaderSearch &HS, PragmaIncludes *PI,
llvm::raw_ostream &OS) {
Reporter R(OS, Ctx, HS, Includes, PI, File);
const auto& SM = Ctx.getSourceManager();
diff --git a/clang-tools-extra/include-cleaner/lib/Record.cpp b/clang-tools-extra/include-cleaner/lib/Record.cpp
index ff29fda8663b9..113a69c7fbee7 100644
--- a/clang-tools-extra/include-cleaner/lib/Record.cpp
+++ b/clang-tools-extra/include-cleaner/lib/Record.cpp
@@ -305,7 +305,7 @@ class PragmaIncludes::RecordPragma : public PPCallbacks, public CommentHandler {
bool InMainFile = false;
const SourceManager &SM;
- HeaderSearch &HeaderInfo;
+ const HeaderSearch &HeaderInfo;
PragmaIncludes *Out;
llvm::BumpPtrAllocator Arena;
/// Intern table for strings. Contents are on the arena.
More information about the cfe-commits
mailing list