14#ifndef MODULARIZEUTILITIES_H
15#define MODULARIZEUTILITIES_H
18#include "clang/Basic/Diagnostic.h"
19#include "clang/Basic/FileManager.h"
20#include "clang/Basic/LangOptions.h"
21#include "clang/Basic/TargetInfo.h"
22#include "clang/Basic/TargetOptions.h"
23#include "clang/Frontend/TextDiagnosticPrinter.h"
24#include "clang/Lex/HeaderSearch.h"
25#include "clang/Lex/HeaderSearchOptions.h"
26#include "clang/Lex/ModuleMap.h"
27#include "clang/Lex/Preprocessor.h"
28#include "llvm/ADT/SmallVector.h"
29#include "llvm/ADT/StringSet.h"
73 llvm::StringRef Prefix,
74 llvm::StringRef ProblemFilesListPath);
82 std::vector<std::string> &InputPaths,
83 llvm::StringRef Prefix,
84 llvm::StringRef ProblemFilesListPath);
135 llvm::StringRef InputPath);
141 llvm::StringRef InputPath);
147 llvm::StringRef InputPath);
199 const llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>
DiagIDs;
203 clang::TextDiagnosticPrinter
DC;
209 llvm::IntrusiveRefCntPtr<clang::TargetInfo>
Target;
213 llvm::IntrusiveRefCntPtr<clang::FileManager>
FileMgr;
215 llvm::IntrusiveRefCntPtr<clang::SourceManager>
SourceMgr;
static cl::list< std::string > IncludePaths("I", cl::desc("Include path for coverage check."), cl::value_desc("path"))
Common definitions for Modularize.
llvm::SmallVector< std::string, 4 > DependentsVector
llvm::StringMap< DependentsVector > DependencyMap
std::vector< HeaderHandle > Path
std::vector< llvm::StringRef > CommandLine
Modularize utilities class.
llvm::SmallVector< std::string, 32 > GoodFileNames
List of header files with no problems during the first pass, that is, no compile errors.
static std::string getCanonicalPath(llvm::StringRef FilePath)
Convert header path to canonical form.
std::vector< std::string > InputFilePaths
The input file paths.
llvm::IntrusiveRefCntPtr< clang::DiagnosticOptions > DiagnosticOpts
Options controlling the diagnostic engine.
std::error_code loadAllHeaderListsAndDependencies()
Load header list and dependencies.
bool collectModuleMapHeaders(clang::ModuleMap *ModMap)
Collect module Map headers.
void displayProblemFiles()
List problem files.
const llvm::IntrusiveRefCntPtr< clang::DiagnosticIDs > DiagIDs
Diagnostic IDs.
std::error_code loadModuleMap(llvm::StringRef InputPath)
Load single module map and extract header file list.
clang::TextDiagnosticPrinter DC
Diagnostic consumer.
std::shared_ptr< clang::TargetOptions > TargetOpts
Options controlling the target.
DependencyMap Dependencies
Map of top-level header file dependencies.
static ModularizeUtilities * createModularizeUtilities(std::vector< std::string > &InputPaths, llvm::StringRef Prefix, llvm::StringRef ProblemFilesListPath)
Create instance of ModularizeUtilities.
llvm::IntrusiveRefCntPtr< clang::SourceManager > SourceMgr
Source manager.
std::error_code loadProblemHeaderList(llvm::StringRef InputPath)
Load problem header list.
bool collectModuleHeaders(const clang::Module &Mod)
Collect referenced headers from one module.
llvm::SmallVector< std::string, 32 > ProblemFileNames
List of header files with problems.
std::unique_ptr< clang::HeaderSearch > HeaderInfo
Header search manager.
llvm::IntrusiveRefCntPtr< clang::TargetInfo > Target
Target information.
llvm::StringRef HeaderPrefix
The header prefix.
std::vector< std::unique_ptr< clang::ModuleMap > > ModuleMaps
void displayCombinedFiles()
List files with problem files commented out.
void addNoCompileErrorsFile(std::string FilePath)
Add file with no compile errors.
void displayGoodFiles()
List files with no problems.
std::shared_ptr< clang::LangOptions > LangOpts
Options controlling the language variant.
llvm::IntrusiveRefCntPtr< clang::FileManager > FileMgr
File system manager.
bool collectUmbrellaHeaders(llvm::StringRef UmbrellaDirName, DependentsVector &Dependents)
Collect headers from an umbrella directory.
llvm::IntrusiveRefCntPtr< clang::DiagnosticsEngine > Diagnostics
Diagnostic engine.
int MissingHeaderCount
Missing header count.
static bool isHeader(llvm::StringRef FileName)
Check for header file extension.
llvm::StringRef ProblemFilesPath
The path of problem files list file.
std::error_code loadSingleHeaderListsAndDependencies(llvm::StringRef InputPath)
Load single header list and dependencies.
llvm::SmallVector< std::string, 32 > HeaderFileNames
List of top-level header files.
std::error_code doCoverageCheck(std::vector< std::string > &IncludePaths, llvm::ArrayRef< std::string > CommandLine)
Do coverage checks.
bool HasModuleMap
True if we have module maps.
clang::FileSystemOptions FileSystemOpts
Options controlling the file system manager.
void addUniqueProblemFile(std::string FilePath)
Add unique problem file.
static std::string getDirectoryFromPath(llvm::StringRef Path)
Get directory path component from file path.