clang-tools  14.0.0git
Namespaces | Typedefs | Functions
IncludeCleaner.h File Reference
#include "Headers.h"
#include "ParsedAST.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/DenseSet.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.


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


using clang::clangd::ReferencedLocations = llvm::DenseSet< SourceLocation >


ReferencedLocations clang::clangd::findReferencedLocations (ParsedAST &AST)
 Finds locations of all symbols used in the main file. More...
llvm::DenseSet< FileID > clang::clangd::findReferencedFiles (const ReferencedLocations &Locs, const IncludeStructure &Includes, const SourceManager &SM)
 Retrieves IDs of all files containing SourceLocations from Locs. More...
llvm::DenseSet< IncludeStructure::HeaderID > clang::clangd::translateToHeaderIDs (const llvm::DenseSet< FileID > &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)
 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)

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.

FIXME(kirillbobyrev): Add support for IWYU pragmas. FIXME(kirillbobyrev): Add support for standard library headers.

Definition in file IncludeCleaner.h.