llvm-project/clang/lib/Lex
Manuel Klimek 1f76c4e810 Use the same SourceManager for ModuleMaps and compilations.
This allows using virtual file mappings on the original SourceManager to
map in virtual module.map files. Without this patch, the ModuleMap
search will find a module.map file (as the FileEntry exists in the
FileManager), but will be unable to get the content from the
SourceManager (as ModuleMap previously created its own SourceManager).

Two problems needed to be fixed which this patch exposed:

1. Storing the inferred module map
When writing out a module, the ASTWriter stores the names of the files
in the main source manager; when loading the AST again, the ASTReader
errs out if such a file is found missing, unless it is overridden.
Previously CompilerInstance's compileModule method would store the
inferred module map to a temporary file; the problem with this approach
is 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 to
the compilation; later, when the module is loaded, the temporary file
has already been deleted, which leads to a compilation error. This patch
changes the inferred module map to instead inject a virtual file into
the source manager. This both saves some disk IO, and works with how the
ASTWriter/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, the
VerifyDiagnosticConsumer will not ignore diagnostics created while
parsing the module map file. The module test test/Modules/renamed.m uses
-I test/Modules/Inputs and triggers recursive loading of all module maps
in test/Modules/Inputs, some of which had conflicting names, thus
leading errors while parsing the module maps. Those diagnostics already
occur on trunk, but before this patch they would not break the test, as
they were ignored by the VerifyDiagnosticConsumer. This patch thus
changes the module maps that have been recently introduced which broke
the invariant of compatible modules maps in test/Modules/Inputs.

llvm-svn: 193314
2013-10-24 07:51:24 +00:00
..
CMakeLists.txt clang/Lex: [CMake] Update CMakefiles since r169229. 2012-12-04 07:40:33 +00:00
HeaderMap.cpp Use only explicit bool conversion operator 2013-05-15 07:37:26 +00:00
HeaderSearch.cpp Use the same SourceManager for ModuleMaps and compilations. 2013-10-24 07:51:24 +00:00
Lexer.cpp Lex: Don't restrict legal UCNs when preprocessing assembly 2013-10-21 05:02:28 +00:00
LiteralSupport.cpp NumericLiteralParser::ParseNumberStartingWithZero(): Try to appease MSC16's miscompilation. 2013-09-27 04:42:28 +00:00
MacroArgs.cpp [Preprocessor] For the MacroExpands preprocessor callback, also pass the MacroArgs object that provides information about 2013-05-03 22:31:32 +00:00
MacroInfo.cpp [preprocessor] Minor optimization following r178671. 2013-04-03 21:29:07 +00:00
Makefile
ModuleMap.cpp Use the same SourceManager for ModuleMaps and compilations. 2013-10-24 07:51:24 +00:00
PPCaching.cpp [preprocessor] In Preprocessor::CachingLex() check whether there were more tokens 2012-04-04 02:57:01 +00:00
PPCallbacks.cpp Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch 2011-12-20 02:48:34 +00:00
PPConditionalDirectiveRecord.cpp Add condition expression result to if and elif callbacks. 2013-07-18 00:00:36 +00:00
PPDirectives.cpp Allow a header to be part of multiple modules. 2013-10-22 08:09:47 +00:00
PPExpressions.cpp Partially revert r186903. 2013-07-26 00:06:45 +00:00
PPLexerChange.cpp Relax header guard mismatch warning with edit distance heuristic. 2013-10-12 23:17:37 +00:00
PPMacroExpansion.cpp [-fms-extensions] Permit 'override' in C++98 and 'sealed' as a synonym for 'final' 2013-10-18 00:33:31 +00:00
PTHLexer.cpp Make Preprocessor::Lex non-recursive. 2013-09-19 00:41:32 +00:00
Pragma.cpp Accept #pragma warning(push, 0) without warning 2013-10-02 15:19:23 +00:00
PreprocessingRecord.cpp Add SourceRange to PPCallbacks::Defined callback. 2013-07-19 18:50:04 +00:00
Preprocessor.cpp Make Preprocessor::Lex non-recursive. 2013-09-19 00:41:32 +00:00
PreprocessorLexer.cpp Make Preprocessor::Lex non-recursive. 2013-09-19 00:41:32 +00:00
ScratchBuffer.cpp Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset. 2011-09-19 20:40:19 +00:00
TokenConcatenation.cpp Simplify logic for avoiding concatenation after numeric constants. 2013-02-08 22:30:31 +00:00
TokenLexer.cpp Make Preprocessor::Lex non-recursive. 2013-09-19 00:41:32 +00:00
UnicodeCharSets.h Use new UnicodeCharSet interface. 2013-08-29 12:12:31 +00:00