parent
45ef715768
commit
e0aa5fea15
|
@ -26,7 +26,7 @@ can be included on the command line after the module map file argument.
|
|||
|
||||
Warning message have the form::
|
||||
|
||||
warning: module.map does not account for file: header.h
|
||||
warning: module.modulemap does not account for file: header.h
|
||||
|
||||
Note that for the case of the module map referencing a file that does
|
||||
not exist, the module map parser in Clang will display an error message.
|
||||
|
@ -73,7 +73,7 @@ Module-Map-Checker Command Line Options
|
|||
.. option:: -I (include path)
|
||||
|
||||
Look at headers only in this directory tree.
|
||||
Must be a path relative to the module.map file.
|
||||
Must be a path relative to the module.modulemap file.
|
||||
There can be multiple ``-I`` options, for when the
|
||||
module map covers multiple directories, and
|
||||
excludes higher or sibling directories not
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
// Options:
|
||||
//
|
||||
// -I(include path) Look at headers only in this directory tree.
|
||||
// Must be a path relative to the module.map file.
|
||||
// Must be a path relative to the module.modulemap file.
|
||||
// There can be multiple -I options, for when the
|
||||
// module map covers multiple directories, and
|
||||
// excludes higher or sibling directories not
|
||||
|
@ -52,7 +52,7 @@
|
|||
//
|
||||
// Warning message have the form:
|
||||
//
|
||||
// warning: module.map does not account for file: Level3A.h
|
||||
// warning: module.modulemap does not account for file: Level3A.h
|
||||
//
|
||||
// Note that for the case of the module map referencing a file that does
|
||||
// not exist, the module map parser in Clang will (at the time of this
|
||||
|
@ -100,7 +100,7 @@ namespace sys = llvm::sys;
|
|||
// Option for include paths.
|
||||
static cl::list<std::string>
|
||||
IncludePaths("I", cl::desc("Include path."
|
||||
" Must be relative to module.map file."),
|
||||
" Must be relative to module.modulemap file."),
|
||||
cl::ZeroOrMore, cl::value_desc("path"));
|
||||
|
||||
// Option for dumping the parsed module map.
|
||||
|
@ -108,11 +108,11 @@ static cl::opt<bool>
|
|||
DumpModuleMap("dump-module-map", cl::init(false),
|
||||
cl::desc("Dump the parsed module map information."));
|
||||
|
||||
// Option for module.map path.
|
||||
// Option for module.modulemap path.
|
||||
static cl::opt<std::string>
|
||||
ModuleMapPath(cl::Positional, cl::init("module.map"),
|
||||
cl::desc("<The module.map file path."
|
||||
" Uses module.map in current directory if omitted.>"));
|
||||
ModuleMapPath(cl::Positional, cl::init("module.modulemap"),
|
||||
cl::desc("<The module.modulemap file path."
|
||||
" Uses module.modulemap in current directory if omitted.>"));
|
||||
|
||||
// Collect all other arguments, which will be passed to the front end.
|
||||
static cl::list<std::string>
|
||||
|
@ -235,10 +235,10 @@ ModuleMapChecker *ModuleMapChecker::createModuleMapChecker(
|
|||
}
|
||||
|
||||
// Do checks.
|
||||
// Starting from the directory of the module.map file,
|
||||
// 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.map file.
|
||||
// the headers referenced by the module.modulemap file.
|
||||
// Display warnings for unaccounted-for header files.
|
||||
// Returns error_code of 0 if there were no errors or warnings, 1 if there
|
||||
// were warnings, 2 if any other problem, such as if a bad
|
||||
|
@ -276,9 +276,9 @@ std::error_code ModuleMapChecker::doChecks() {
|
|||
// The following functions are called by doChecks.
|
||||
|
||||
// Load module map.
|
||||
// Returns true if module.map file loaded successfully.
|
||||
// Returns true if module.modulemap file loaded successfully.
|
||||
bool ModuleMapChecker::loadModuleMap() {
|
||||
// Get file entry for module.map file.
|
||||
// Get file entry for module.modulemap file.
|
||||
const FileEntry *ModuleMapEntry =
|
||||
SourceMgr->getFileManager().getFile(ModuleMapPath);
|
||||
|
||||
|
@ -305,7 +305,7 @@ bool ModuleMapChecker::loadModuleMap() {
|
|||
assert(Dir && "parent must exist");
|
||||
}
|
||||
|
||||
// Parse module.map file into module map.
|
||||
// Parse module.modulemap file into module map.
|
||||
if (ModMap->parseModuleMapFile(ModuleMapEntry, false, Dir))
|
||||
return false;
|
||||
|
||||
|
@ -429,18 +429,18 @@ void ModuleMapChecker::collectUmbrellaHeaderHeader(StringRef HeaderName) {
|
|||
|
||||
// Collect file system header files.
|
||||
// This function scans the file system for header files,
|
||||
// starting at the directory of the module.map file,
|
||||
// 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.
|
||||
bool ModuleMapChecker::collectFileSystemHeaders() {
|
||||
|
||||
// Get directory containing the module.map file.
|
||||
// Get directory containing the module.modulemap file.
|
||||
// Might be relative to current directory, absolute, or empty.
|
||||
ModuleMapDirectory = getDirectoryFromPath(ModuleMapPath);
|
||||
|
||||
// If no include paths specified, we do the whole tree starting
|
||||
// at the module.map directory.
|
||||
// at the module.modulemap directory.
|
||||
if (IncludePaths.size() == 0) {
|
||||
if (!collectFileSystemHeaders(StringRef("")))
|
||||
return false;
|
||||
|
@ -464,7 +464,7 @@ bool ModuleMapChecker::collectFileSystemHeaders() {
|
|||
// 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.map file.
|
||||
// relative to the directory of the module.modulemap file.
|
||||
// \returns True if no errors.
|
||||
bool ModuleMapChecker::collectFileSystemHeaders(StringRef IncludePath) {
|
||||
|
||||
|
|
|
@ -44,11 +44,11 @@ public:
|
|||
class ModuleMapChecker {
|
||||
// Checker arguments.
|
||||
|
||||
/// The module.map file path. Can be relative or absolute.
|
||||
/// The module.modulemap file path. Can be relative or absolute.
|
||||
llvm::StringRef ModuleMapPath;
|
||||
/// 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.map
|
||||
/// To expect all files to be accounted for from the module.modulemap
|
||||
/// file directory on down, leave this empty.)
|
||||
std::vector<std::string> IncludePaths;
|
||||
/// Flag to dump the module map information during check.
|
||||
|
@ -102,11 +102,11 @@ public:
|
|||
/// Constructor.
|
||||
/// You can use the static createModuleMapChecker to create an instance
|
||||
/// of this object.
|
||||
/// \param ModuleMapPath The module.map file path.
|
||||
/// \param ModuleMapPath The module.modulemap file path.
|
||||
/// Can be relative or absolute.
|
||||
/// \param 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.map
|
||||
/// To expect all files to be accounted for from the module.modulemap
|
||||
/// file directory on down, leave this empty.)
|
||||
/// \param DumpModuleMap Flag to dump the module map information
|
||||
/// during check.
|
||||
|
@ -115,11 +115,11 @@ public:
|
|||
llvm::ArrayRef<std::string> CommandLine);
|
||||
|
||||
/// Create instance of ModuleMapChecker.
|
||||
/// \param ModuleMapPath The module.map file path.
|
||||
/// \param ModuleMapPath The module.modulemap file path.
|
||||
/// Can be relative or absolute.
|
||||
/// \param 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.map
|
||||
/// To expect all files to be accounted for from the module.modulemap
|
||||
/// file directory on down, leave this empty.)
|
||||
/// \param DumpModuleMap Flag to dump the module map information
|
||||
/// during check.
|
||||
|
@ -129,10 +129,10 @@ public:
|
|||
bool DumpModuleMap, llvm::ArrayRef<std::string> CommandLine);
|
||||
|
||||
/// Do checks.
|
||||
/// Starting from the directory of the module.map file,
|
||||
/// 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.map file.
|
||||
/// 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
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
// The following functions are called by doChecks.
|
||||
|
||||
/// Load module map.
|
||||
/// \returns True if module.map file loaded successfully.
|
||||
/// \returns True if module.modulemap file loaded successfully.
|
||||
bool loadModuleMap();
|
||||
|
||||
/// Collect module headers.
|
||||
|
@ -174,7 +174,7 @@ public:
|
|||
|
||||
/// Collect file system header files.
|
||||
/// This function scans the file system for header files,
|
||||
/// starting at the directory of the module.map file,
|
||||
/// 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.
|
||||
|
@ -183,7 +183,7 @@ public:
|
|||
/// 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.map file.
|
||||
/// relative to the directory of the module.modulemap file.
|
||||
/// \returns True if no errors.
|
||||
bool collectFileSystemHeaders(llvm::StringRef IncludePath);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// module.map
|
||||
// module.modulemap
|
||||
|
||||
module Level1A {
|
||||
header "Includes1/Level1A.h"
|
|
@ -1,4 +1,4 @@
|
|||
// module.map
|
||||
// module.modulemap
|
||||
|
||||
module Level1A {
|
||||
header "Level1A.h"
|
|
@ -1 +1 @@
|
|||
# RUN: module-map-checker -I Includes1 -I Includes2 %S/Inputs/includes-test/module.map
|
||||
# RUN: module-map-checker -I Includes1 -I Includes2 %S/Inputs/includes-test/module.modulemap
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: not module-map-checker %S/Inputs/main-test/module.map 2>&1 | FileCheck %s
|
||||
# RUN: not module-map-checker %S/Inputs/main-test/module.modulemap 2>&1 | FileCheck %s
|
||||
|
||||
# CHECK: warning: {{.*}}{{[/\\]}}Inputs/main-test/module.map does not account for file: {{.*}}{{[/\\]}}Inputs/main-test/Level3A.h
|
||||
# CHECK-NEXT: warning: {{.*}}{{[/\\]}}Inputs/main-test/module.map does not account for file: {{.*}}{{[/\\]}}Inputs/main-test/Sub/Level3B.h
|
||||
# CHECK: warning: {{.*}}{{[/\\]}}Inputs/main-test/module.modulemap does not account for file: {{.*}}{{[/\\]}}Inputs/main-test/Level3A.h
|
||||
# CHECK-NEXT: warning: {{.*}}{{[/\\]}}Inputs/main-test/module.modulemap does not account for file: {{.*}}{{[/\\]}}Inputs/main-test/Sub/Level3B.h
|
||||
|
|
Loading…
Reference in New Issue