clang-tools 20.0.0git
|
Module map checker class. More...
#include <CoverageChecker.h>
Public Member Functions | |
CoverageChecker (llvm::StringRef ModuleMapPath, std::vector< std::string > &IncludePaths, llvm::ArrayRef< std::string > CommandLine, clang::ModuleMap *ModuleMap) | |
Constructor. | |
std::error_code | doChecks () |
Do checks. | |
void | collectModuleHeaders () |
Collect module headers. | |
bool | collectModuleHeaders (const clang::Module &Mod) |
Collect referenced headers from one module. | |
bool | collectUmbrellaHeaders (llvm::StringRef UmbrellaDirName) |
Collect headers from an umbrella directory. | |
bool | collectUmbrellaHeaderHeaders (llvm::StringRef UmbrellaHeaderName) |
Collect headers referenced from an umbrella file. | |
void | collectUmbrellaHeaderHeader (llvm::StringRef HeaderName) |
Called from CoverageCheckerCallbacks to track a header included from an umbrella header. | |
bool | collectFileSystemHeaders () |
Collect file system header files. | |
bool | collectFileSystemHeaders (llvm::StringRef IncludePath) |
Collect file system header files from the given path. | |
void | findUnaccountedForHeaders () |
Find headers unaccounted-for in module map. | |
Static Public Member Functions | |
static std::unique_ptr< CoverageChecker > | createCoverageChecker (llvm::StringRef ModuleMapPath, std::vector< std::string > &IncludePaths, llvm::ArrayRef< std::string > CommandLine, clang::ModuleMap *ModuleMap) |
Create instance of CoverageChecker. | |
Module map checker class.
This is the heart of the checker. The doChecks function does the main work. The data members store the options and internally collected data.
Definition at line 38 of file CoverageChecker.h.
CoverageChecker::CoverageChecker | ( | llvm::StringRef | ModuleMapPath, |
std::vector< std::string > & | IncludePaths, | ||
llvm::ArrayRef< std::string > | CommandLine, | ||
clang::ModuleMap * | ModuleMap | ||
) |
Constructor.
You can use the static createCoverageChecker to create an instance of this object.
ModuleMapPath | The module.modulemap file path. Can be relative or absolute. |
IncludePaths | The include paths to check for files. (Note that other directories above these paths are ignored. To expect all files to be accounted for from the module.modulemap file directory on down, leave this empty.) |
CommandLine | Compile command line arguments. |
ModuleMap | The module map to check. |
Definition at line 145 of file CoverageChecker.cpp.
bool CoverageChecker::collectFileSystemHeaders | ( | ) |
Collect file system header files.
This function scans the file system for header files, starting at the directory of the module.modulemap file, optionally filtering out all but the files covered by the include path options.
Definition at line 318 of file CoverageChecker.cpp.
References collectFileSystemHeaders(), E, and Modularize::ModularizeUtilities::getDirectoryFromPath().
Referenced by collectFileSystemHeaders(), and doChecks().
bool Modularize::CoverageChecker::collectFileSystemHeaders | ( | llvm::StringRef | IncludePath | ) |
Collect file system header files from the given path.
This function scans the file system for header files, starting at the given directory, which is assumed to be relative to the directory of the module.modulemap file.
void CoverageChecker::collectModuleHeaders | ( | ) |
Collect module headers.
Walks the modules and collects referenced headers into ModuleMapHeadersSet.
Definition at line 197 of file CoverageChecker.cpp.
References collectModuleHeaders(), and E.
Referenced by collectModuleHeaders(), and doChecks().
bool Modularize::CoverageChecker::collectModuleHeaders | ( | const clang::Module & | Mod | ) |
Collect referenced headers from one module.
Collects the headers referenced in the given module into ModuleMapHeadersSet.
Mod | The module reference. |
void CoverageChecker::collectUmbrellaHeaderHeader | ( | llvm::StringRef | HeaderName | ) |
Called from CoverageCheckerCallbacks to track a header included from an umbrella header.
HeaderName | The header file path. |
Definition at line 298 of file CoverageChecker.cpp.
References Modularize::ModularizeUtilities::getCanonicalPath().
Referenced by CoverageCheckerCallbacks::InclusionDirective().
bool CoverageChecker::collectUmbrellaHeaderHeaders | ( | llvm::StringRef | UmbrellaHeaderName | ) |
Collect headers referenced from an umbrella file.
UmbrellaHeaderName | The umbrella file path. |
Definition at line 273 of file CoverageChecker.cpp.
bool CoverageChecker::collectUmbrellaHeaders | ( | llvm::StringRef | UmbrellaDirName | ) |
Collect headers from an umbrella directory.
UmbrellaDirName | The umbrella directory name. |
Definition at line 238 of file CoverageChecker.cpp.
References collectUmbrellaHeaders(), Directory, E, Modularize::ModularizeUtilities::getCanonicalPath(), Modularize::ModularizeUtilities::isHeader(), and Type.
Referenced by collectUmbrellaHeaders().
|
static |
Create instance of CoverageChecker.
ModuleMapPath | The module.modulemap file path. Can be relative or absolute. |
IncludePaths | The include paths to check for files. (Note that other directories above these paths are ignored. To expect all files to be accounted for from the module.modulemap file directory on down, leave this empty.) |
CommandLine | Compile command line arguments. |
ModuleMap | The module map to check. |
Definition at line 155 of file CoverageChecker.cpp.
References CommandLine.
Referenced by Modularize::ModularizeUtilities::doCoverageCheck().
std::error_code CoverageChecker::doChecks | ( | ) |
Do checks.
Starting from the directory of the module.modulemap file, Find all header files, optionally looking only at files covered by the include path options, and compare against the headers referenced by the module.modulemap file. Display warnings for unaccounted-for header files.
Definition at line 172 of file CoverageChecker.cpp.
References collectFileSystemHeaders(), collectModuleHeaders(), and findUnaccountedForHeaders().
void CoverageChecker::findUnaccountedForHeaders | ( | ) |
Find headers unaccounted-for in module map.
This function compares the list of collected header files against those referenced in the module map. Display warnings for unaccounted-for header files. Save unaccounted-for file list for possible. fixing action.
Definition at line 411 of file CoverageChecker.cpp.
References E.
Referenced by doChecks().