Use the same SourceManager for ModuleMaps and compilations.This allows using virtual file mappings on the original SourceManager tomap in virtual module.map files. Without this patch, the ModuleMa
Use the same SourceManager for ModuleMaps and compilations.This allows using virtual file mappings on the original SourceManager tomap in virtual module.map files. Without this patch, the ModuleMapsearch will find a module.map file (as the FileEntry exists in theFileManager), but will be unable to get the content from theSourceManager (as ModuleMap previously created its own SourceManager).Two problems needed to be fixed which this patch exposed:1. Storing the inferred module mapWhen writing out a module, the ASTWriter stores the names of the filesin the main source manager; when loading the AST again, the ASTReadererrs out if such a file is found missing, unless it is overridden.Previously CompilerInstance's compileModule method would store theinferred module map to a temporary file; the problem with this approachis that now that the module map is handled by the main source manager,the ASTWriter stores the name of the temporary module map as source tothe compilation; later, when the module is loaded, the temporary filehas already been deleted, which leads to a compilation error. This patchchanges the inferred module map to instead inject a virtual file intothe source manager. This both saves some disk IO, and works with how theASTWriter/ASTReader handle overridden source files.2. Changing test input in test/Modules/Inputs/*Now that the module map file is handled by the main source manager, theVerifyDiagnosticConsumer will not ignore diagnostics created whileparsing the module map file. The module test test/Modules/renamed.m uses-I test/Modules/Inputs and triggers recursive loading of all module mapsin test/Modules/Inputs, some of which had conflicting names, thusleading errors while parsing the module maps. Those diagnostics alreadyoccur on trunk, but before this patch they would not break the test, asthey were ignored by the VerifyDiagnosticConsumer. This patch thuschanges the module maps that have been recently introduced which brokethe invariant of compatible modules maps in test/Modules/Inputs.llvm-svn: 193314
show more ...
Test files for private header patch.llvm-svn: 184472