clang-tools  15.0.0git
Classes | Namespaces | Functions
IncludeCleaner.h File Reference
#include "Headers.h"
#include "ParsedAST.h"
#include "index/CanonicalIncludes.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Tooling/Inclusions/StandardLibrary.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/ADT/StringSet.h"
#include <vector>
Include dependency graph for IncludeCleaner.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  clang::clangd::ReferencedLocations
struct  clang::clangd::ReferencedFiles


 ===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//


ReferencedLocations clang::clangd::findReferencedLocations (ASTContext &Ctx, Preprocessor &PP, const syntax::TokenBuffer *Tokens)
 Finds locations of all symbols used in the main file. More...
ReferencedLocations clang::clangd::findReferencedLocations (ParsedAST &AST)
ReferencedFiles clang::clangd::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. More...
ReferencedFiles clang::clangd::findReferencedFiles (const ReferencedLocations &Locs, const IncludeStructure &Includes, const CanonicalIncludes &CanonIncludes, const SourceManager &SM)
llvm::DenseSet< IncludeStructure::HeaderID > clang::clangd::translateToHeaderIDs (const ReferencedFiles &Files, const IncludeStructure &Includes, const SourceManager &SM)
 Maps FileIDs to the internal IncludeStructure representation (HeaderIDs). More...
std::vector< const Inclusion * > clang::clangd::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. More...
std::vector< const Inclusion * > clang::clangd::computeUnusedIncludes (ParsedAST &AST)
std::vector< Diag > clang::clangd::issueUnusedIncludesDiagnostics (ParsedAST &AST, llvm::StringRef Code)
void clang::clangd::setIncludeCleanerAnalyzesStdlib (bool B)
 Affects whether standard library includes should be considered for removal. More...

Detailed Description

Include Cleaner is clangd functionality for providing diagnostics for misuse of transitive headers and unused includes. It is inspired by Include-What-You-Use tool ( Our goal is to provide useful warnings in most popular scenarios but not 1:1 exact feature compatibility.

Definition in file IncludeCleaner.h.