}
for (auto &HeaderKind : Mod.Headers)
- for (auto &Header : HeaderKind)
- ModuleMapHeadersSet.insert(ModularizeUtilities::getCanonicalPath(
- Header.Entry->getName()));
+ for (auto &Header : HeaderKind)
+ ModuleMapHeadersSet.insert(ModularizeUtilities::getCanonicalPath(
+ Header.Entry->getName()));
for (Module::submodule_const_iterator MI = Mod.submodule_begin(),
- MIEnd = Mod.submodule_end();
- MI != MIEnd; ++MI)
+ MIEnd = Mod.submodule_end();
+ MI != MIEnd; ++MI)
collectModuleHeaders(**MI);
return true;
ListFileNames, HeaderPrefix));
// Get header file names and dependencies.
- ModUtil->loadAllHeaderListsAndDependencies();
-
+ if (ModUtil->loadAllHeaderListsAndDependencies())
+ HadErrors = 1;
// If we are in assistant mode, output the module map and quit.
if (ModuleMapPath.length() != 0) {
: InputFilePaths(InputPaths),
HeaderPrefix(Prefix),
HasModuleMap(false),
+ MissingHeaderCount(0),
// Init clang stuff needed for loading the module map and preprocessing.
LangOpts(new LangOptions()), DiagIDs(new DiagnosticIDs()),
DiagnosticOpts(new DiagnosticOptions()),
// Do matching end call.
DC.EndSourceFile();
+ // Reset missing header count.
+ MissingHeaderCount = 0;
+
if (!collectModuleMapHeaders(ModMap.get()))
return std::error_code(1, std::generic_category());
// Indicate we are using module maps.
HasModuleMap = true;
+ // Return code of 1 for missing headers.
+ if (MissingHeaderCount)
+ return std::error_code(1, std::generic_category());
+
return std::error_code();
}
HeaderFileNames.push_back(HeaderPath);
}
+ int MissingCountThisModule = Mod.MissingHeaders.size();
+
+ for (int Index = 0; Index < MissingCountThisModule; ++Index) {
+ std::string MissingFile = Mod.MissingHeaders[Index].FileName;
+ SourceLocation Loc = Mod.MissingHeaders[Index].FileNameLoc;
+ errs() << Loc.printToString(*SourceMgr)
+ << ": error : Header not found: " << MissingFile << "\n";
+ }
+
+ MissingHeaderCount += MissingCountThisModule;
+
return true;
}