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