llvm-project/clang/unittests/Tooling
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 Adding Replacement serialization support 2013-08-20 19:07:21 +00:00
CommentHandlerTest.cpp Add testing for CommentHandler, and fix a bug where trailing comments in #else 2012-06-24 23:56:26 +00:00
CompilationDatabaseTest.cpp Include Path.h instead of PathV2.h. 2013-06-11 22:15:02 +00:00
Makefile [Driver] Refactor clang driver to use LLVM's Option library 2013-06-14 17:17:23 +00:00
RecursiveASTVisitorTest.cpp Add a test case to test RAV visits parameters of implicit copy constructor. 2013-09-12 20:59:33 +00:00
RefactoringCallbacksTest.cpp Really sort the #include lines in unittests/... 2012-12-04 09:53:37 +00:00
RefactoringTest.cpp Reverted r192992 broke windows and freebsd builds. 2013-10-18 19:48:31 +00:00
ReplacementsYamlTest.cpp Do not quote YAML plain string myself. Let YAMLIO do that. 2013-09-11 04:00:35 +00:00
RewriterTest.cpp Adds a method overwriteChangedFiles to the Rewriter. This is implemented by 2012-05-22 17:01:35 +00:00
RewriterTestContext.h Use llvm::sys::fs::createTemporaryFile. 2013-07-05 20:00:06 +00:00
TestVisitor.h Teach RAV to visit parameter variable declarations of implicit functions. Fixes PR16182. 2013-09-11 15:53:29 +00:00
ToolingTest.cpp Use the same SourceManager for ModuleMaps and compilations. 2013-10-24 07:51:24 +00:00