Skip to content

Commit

Permalink
[include-cleaner] NFC, use const HeaderSearch when possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
hokein committed Jun 1, 2023
1 parent e506bfa commit 7de5412
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ 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.
/// The FormatStyle must be C++ or ObjC (to support include ordering).
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.
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/include-cleaner/lib/Analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/include-cleaner/lib/AnalysisInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/include-cleaner/lib/Record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7de5412

Please sign in to comment.