Go to the documentation of this file.
18 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INCLUDECLEANER_H
19 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INCLUDECLEANER_H
24 #include "clang/Basic/SourceLocation.h"
25 #include "clang/Tooling/Inclusions/StandardLibrary.h"
26 #include "llvm/ADT/DenseSet.h"
27 #include "llvm/ADT/STLFunctionalExtras.h"
28 #include "llvm/ADT/StringSet.h"
35 llvm::DenseSet<SourceLocation>
User;
36 llvm::DenseSet<tooling::stdlib::Symbol>
Stdlib;
54 const syntax::TokenBuffer *Tokens);
58 llvm::DenseSet<FileID>
User;
59 llvm::DenseSet<tooling::stdlib::Header>
Stdlib;
78 llvm::function_ref<FileID(FileID)> HeaderResponsible,
79 llvm::function_ref<Optional<StringRef>(FileID)> UmbrellaHeader);
83 const SourceManager &SM);
87 llvm::DenseSet<IncludeStructure::HeaderID>
93 std::vector<const Inclusion *>
96 const llvm::StringSet<> &ReferencedPublicHeaders);
101 llvm::StringRef
Code);
115 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INCLUDECLEANER_H
std::vector< const Inclusion * > getUnused(ParsedAST &AST, const llvm::DenseSet< IncludeStructure::HeaderID > &ReferencedFiles, const llvm::StringSet<> &ReferencedPublicHeaders)
Retrieves headers that are referenced from the main file but not used.
std::vector< Diag > issueUnusedIncludesDiagnostics(ParsedAST &AST, llvm::StringRef Code)
llvm::DenseSet< FileID > User
llvm::DenseSet< tooling::stdlib::Header > Stdlib
ReferencedLocations findReferencedLocations(ASTContext &Ctx, Preprocessor &PP, const syntax::TokenBuffer *Tokens)
Finds locations of all symbols used in the main file.
llvm::DenseSet< tooling::stdlib::Symbol > Stdlib
Maps a definition location onto an #include file, based on a set of filename rules.
void setIncludeCleanerAnalyzesStdlib(bool B)
Affects whether standard library includes should be considered for removal.
llvm::DenseSet< IncludeStructure::HeaderID > translateToHeaderIDs(const ReferencedFiles &Files, const IncludeStructure &Includes, const SourceManager &SM)
Maps FileIDs to the internal IncludeStructure representation (HeaderIDs).
llvm::DenseSet< FileID > Files
ReferencedFiles findReferencedFiles(const ReferencedLocations &Locs, const SourceManager &SM, llvm::function_ref< FileID(FileID)> HeaderResponsible, llvm::function_ref< Optional< StringRef >(FileID)> UmbrellaHeader)
Retrieves IDs of all files containing SourceLocations from Locs.
std::vector< const Inclusion * > computeUnusedIncludes(ParsedAST &AST)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Stores and provides access to parsed AST.
llvm::DenseSet< SourceLocation > User
llvm::StringSet SpelledUmbrellas
Files responsible for the symbols referenced in the main file and defined in private headers (private...