clang-tools 22.0.0git
Modularize.cpp File Reference
#include "Modularize.h"
#include "ModularizeUtilities.h"
#include "PreprocessorTracker.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Driver/Options.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Tooling/CompilationDatabase.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/OptTable.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include <algorithm>
#include <iterator>
#include <map>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  Location
struct  Entry
struct  HeaderEntry
class  EntityMap
class  CollectEntitiesVisitor
class  CollectEntitiesConsumer
class  CollectEntitiesAction
class  ModularizeFrontendActionFactory
class  CompileCheckVisitor
class  CompileCheckConsumer
class  CompileCheckAction
class  CompileCheckFrontendActionFactory

Typedefs

typedef std::vector< HeaderEntryHeaderContents

Functions

static cl::list< std::string > ListFileNames (cl::Positional, cl::value_desc("list"), cl::desc("<list of one or more header list files>"), cl::CommaSeparated)
static cl::list< std::string > CC1Arguments (cl::ConsumeAfter, cl::desc("<arguments to be passed to front end>..."))
static cl::opt< std::string > HeaderPrefix ("prefix", cl::init(""), cl::desc("Prepend header file paths with this prefix." " If not specified," " the files are considered to be relative to the header list file."))
static cl::opt< std::string > ModuleMapPath ("module-map-path", cl::init(""), cl::desc("Turn on module map output and specify output path or file name." " If no path is specified and if prefix option is specified," " use prefix for file path."))
static cl::opt< std::string > ProblemFilesList ("problem-files-list", cl::init(""), cl::desc("List of files with compilation or modularization problems for" " assistant mode. This will be excluded."))
static cl::opt< std::string > RootModule ("root-module", cl::init(""), cl::desc("Specify the name of the root module."))
static cl::opt< bool > BlockCheckHeaderListOnly ("block-check-header-list-only", cl::init(false), cl::desc("Only warn if #include directives are inside extern or namespace" " blocks if the included header is in the header list."))
static cl::list< std::string > IncludePaths ("I", cl::desc("Include path for coverage check."), cl::value_desc("path"))
static cl::opt< bool > NoCoverageCheck ("no-coverage-check", cl::desc("Don't do the coverage check."))
static cl::opt< bool > CoverageCheckOnly ("coverage-check-only", cl::init(false), cl::desc("Only do the coverage check."))
static cl::opt< bool > DisplayFileLists ("display-file-lists", cl::init(false), cl::desc("Display lists of good files (no compile errors), problem files," " and a combined list with problem files preceded by a '#'."))
static std::string findInputFile (const CommandLineArguments &CLArgs)
static ArgumentsAdjuster getModularizeArgumentsAdjuster (DependencyMap &Dependencies)
int main (int Argc, const char **Argv)

Variables

const char * Argv0
std::string CommandLine

Typedef Documentation

◆ HeaderContents

typedef std::vector<HeaderEntry> HeaderContents

Definition at line 475 of file Modularize.cpp.

Function Documentation

◆ BlockCheckHeaderListOnly()

cl::opt< bool > BlockCheckHeaderListOnly ( "block-check-header-list-only" ,
cl::init(false) ,
cl::desc("Only warn if #include directives are inside extern or namespace" " blocks if the included header is in the header list.")  )
static

Referenced by main().

◆ CC1Arguments()

cl::list< std::string > CC1Arguments ( cl::ConsumeAfter ,
cl::desc("<arguments to be passed to front end>...")  )
static

Referenced by main().

◆ CoverageCheckOnly()

cl::opt< bool > CoverageCheckOnly ( "coverage-check-only" ,
cl::init(false) ,
cl::desc("Only do the coverage check.")  )
static

Referenced by main().

◆ DisplayFileLists()

cl::opt< bool > DisplayFileLists ( "display-file-lists" ,
cl::init(false) ,
cl::desc("Display lists of good files (no compile errors), problem files," " and a combined list with problem files preceded by a '#'.")  )
static

Referenced by main().

◆ findInputFile()

std::string findInputFile ( const CommandLineArguments & CLArgs)
static

◆ getModularizeArgumentsAdjuster()

ArgumentsAdjuster getModularizeArgumentsAdjuster ( DependencyMap & Dependencies)
static

Definition at line 354 of file Modularize.cpp.

References findInputFile().

Referenced by main().

◆ HeaderPrefix()

cl::opt< std::string > HeaderPrefix ( "prefix" ,
cl::init("") ,
cl::desc("Prepend header file paths with this prefix." " If not specified," " the files are considered to be relative to the header list file.")  )
static

◆ IncludePaths()

cl::list< std::string > IncludePaths ( "I" ,
cl::desc("Include path for coverage check.") ,
cl::value_desc("path")  )
static

◆ ListFileNames()

cl::list< std::string > ListFileNames ( cl::Positional ,
cl::value_desc("list") ,
cl::desc("<list of one or more header list files>") ,
cl::CommaSeparated  )
static

Referenced by main().

◆ main()

◆ ModuleMapPath()

cl::opt< std::string > ModuleMapPath ( "module-map-path" ,
cl::init("") ,
cl::desc("Turn on module map output and specify output path or file name." " If no path is specified and if prefix option is specified," " use prefix for file path.")  )
static

◆ NoCoverageCheck()

cl::opt< bool > NoCoverageCheck ( "no-coverage-check" ,
cl::desc("Don't do the coverage check.")  )
static

Referenced by main().

◆ ProblemFilesList()

cl::opt< std::string > ProblemFilesList ( "problem-files-list" ,
cl::init("") ,
cl::desc("List of files with compilation or modularization problems for" " assistant mode. This will be excluded.")  )
static

Referenced by main().

◆ RootModule()

cl::opt< std::string > RootModule ( "root-module" ,
cl::init("") ,
cl::desc("Specify the name of the root module.")  )
static

Variable Documentation

◆ Argv0

const char* Argv0

Definition at line 333 of file Modularize.cpp.

Referenced by getAssetFiles(), getMustacheHtmlFiles(), main(), and writeModuleMap().

◆ CommandLine