Added support for multiple header list files, as a precursor for when we need to load multiple module maps.

llvm-svn: 228935
This commit is contained in:
John Thompson 2015-02-12 16:22:09 +00:00
parent 71e1eb5ab4
commit 469bbc002a
3 changed files with 17 additions and 10 deletions

View File

@ -2,7 +2,8 @@
Modularize Usage Modularize Usage
================ ================
``modularize [<modularize-options>] <include-files-list> [<front-end-options>...]`` ``modularize [<modularize-options>] <include-files-list>[,<include-files-list>]*
[<front-end-options>...]``
``<modularize-options>`` is a place-holder for options ``<modularize-options>`` is a place-holder for options
specific to modularize, which are described below in specific to modularize, which are described below in

View File

@ -178,9 +178,10 @@ using namespace llvm::opt;
using namespace Modularize; using namespace Modularize;
// Option to specify a file name for a list of header files to check. // Option to specify a file name for a list of header files to check.
cl::opt<std::string> cl::list<std::string>
ListFileName(cl::Positional, ListFileNames(cl::Positional, cl::value_desc("list"),
cl::desc("<name of file containing list of headers to check>")); cl::desc("<list of one or more header list files>"),
cl::CommaSeparated);
// Collect all other arguments, which will be passed to the front end. // Collect all other arguments, which will be passed to the front end.
cl::list<std::string> cl::list<std::string>
@ -700,7 +701,7 @@ int main(int Argc, const char **Argv) {
cl::ParseCommandLineOptions(Argc, Argv, "modularize.\n"); cl::ParseCommandLineOptions(Argc, Argv, "modularize.\n");
// No go if we have no header list file. // No go if we have no header list file.
if (ListFileName.size() == 0) { if (ListFileNames.size() == 0) {
cl::PrintHelpMessage(); cl::PrintHelpMessage();
return 1; return 1;
} }
@ -708,12 +709,15 @@ int main(int Argc, const char **Argv) {
// Get header file names and dependencies. // Get header file names and dependencies.
SmallVector<std::string, 32> Headers; SmallVector<std::string, 32> Headers;
DependencyMap Dependencies; DependencyMap Dependencies;
typedef std::vector<std::string>::iterator Iter;
for (Iter I = ListFileNames.begin(), E = ListFileNames.end(); I != E; ++I) {
if (std::error_code EC = getHeaderFileNames(Headers, Dependencies, if (std::error_code EC = getHeaderFileNames(Headers, Dependencies,
ListFileName, HeaderPrefix)) { *I, HeaderPrefix)) {
errs() << Argv[0] << ": error: Unable to get header list '" << ListFileName errs() << Argv[0] << ": error: Unable to get header list '" << *I
<< "': " << EC.message() << '\n'; << "': " << EC.message() << '\n';
return 1; return 1;
} }
}
// If we are in assistant mode, output the module map and quit. // If we are in assistant mode, output the module map and quit.
if (ModuleMapPath.length() != 0) { if (ModuleMapPath.length() != 0) {

View File

@ -0,0 +1,2 @@
# RUN: modularize NoProblems.modularize,NoProblemsAnonymous.modularize -x c++
# RUN: modularize -prefix=%p NoProblems.modularize,NoProblemsAnonymous.modularize -x c++