clang-tools 3.8.0

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | List of all members
Modularize::CoverageChecker Class Reference

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. More...
std::error_code | doChecks ()
| Do checks. More...
void | collectModuleHeaders ()
| Collect module headers. More...
bool | collectModuleHeaders (const clang::Module &Mod)
| Collect referenced headers from one module. More...
bool | collectUmbrellaHeaders (llvm::StringRef UmbrellaDirName)
| Collect headers from an umbrella directory. More...
bool | collectUmbrellaHeaderHeaders (llvm::StringRef UmbrellaHeaderName)
| Collect headers rferenced from an umbrella file. More...
void | collectUmbrellaHeaderHeader (llvm::StringRef HeaderName)
| Called from CoverageCheckerCallbacks to track a header included from an umbrella header. More...
bool | collectFileSystemHeaders ()
| Collect file system header files. More...
bool | collectFileSystemHeaders (llvm::StringRef IncludePath)
| Collect file system header files from the given path. More...
void | findUnaccountedForHeaders ()
| Find headers unaccounted-for in module map. More...

## Static Public Member Functions
static CoverageChecker * | createCoverageChecker (llvm::StringRef ModuleMapPath, std::vector< std::string > &IncludePaths, llvm::ArrayRef< std::string > CommandLine, clang::ModuleMap *ModuleMap)
| Create instance of CoverageChecker. More...

## Detailed Description

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 39 of file CoverageChecker.h.

## Constructor & Destructor Documentation

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.

Parameters

  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 143 of file CoverageChecker.cpp.

Referenced by createCoverageChecker().

## Member Function Documentation

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.

Returns
  True if no errors.

Definition at line 316 of file CoverageChecker.cpp.

References Modularize::ModularizeUtilities::getDirectoryFromPath().

Referenced by 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.

Returns
  True if no errors.

void CoverageChecker::collectModuleHeaders | ( |  | ) |

Collect module headers.

Walks the modules and collects referenced headers into ModuleMapHeadersSet.

Definition at line 195 of file CoverageChecker.cpp.

Referenced by 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.

Parameters

  Mod | The module reference.

Returns
  True if no errors.

void CoverageChecker::collectUmbrellaHeaderHeader | ( | llvm::StringRef | HeaderName | ) |

Called from CoverageCheckerCallbacks to track a header included from an umbrella header.

Parameters

  HeaderName | The header file path.

Definition at line 296 of file CoverageChecker.cpp.

References Modularize::ModularizeUtilities::getCanonicalPath().

bool CoverageChecker::collectUmbrellaHeaderHeaders | ( | llvm::StringRef | UmbrellaHeaderName | ) |

Collect headers rferenced from an umbrella file.

Parameters

  UmbrellaHeaderName | The umbrella file path.

Returns
  True if no errors.

Definition at line 271 of file CoverageChecker.cpp.

bool CoverageChecker::collectUmbrellaHeaders | ( | llvm::StringRef | UmbrellaDirName | ) |

Collect headers from an umbrella directory.

Parameters

  UmbrellaDirName | The umbrella directory name.

Returns
  True if no errors.

Definition at line 237 of file CoverageChecker.cpp.

References Directory(), File, Modularize::ModularizeUtilities::getCanonicalPath(), and Modularize::ModularizeUtilities::isHeader().

CoverageChecker * CoverageChecker::createCoverageChecker | ( | llvm::StringRef | ModuleMapPath,
|  | std::vector< std::string > & | IncludePaths,
|  | llvm::ArrayRef< std::string > | CommandLine,
|  | clang::ModuleMap * | ModuleMap
| ) |  |
| static

Create instance of CoverageChecker.

Parameters

  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.

Returns
  Initialized CoverageChecker object.

Definition at line 153 of file CoverageChecker.cpp.

References CoverageChecker().

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.

Returns
  0 if there were no errors or warnings, 1 if there were warnings, 2 if any other problem, such as a bad module map path argument was specified.

Definition at line 170 of file CoverageChecker.cpp.

References collectFileSystemHeaders(), collectModuleHeaders(), and findUnaccountedForHeaders().

Referenced by Modularize::ModularizeUtilities::doCoverageCheck().

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 409 of file CoverageChecker.cpp.

Referenced by doChecks().

The documentation for this class was generated from the following files:

- CoverageChecker.h
- CoverageChecker.cpp