Author: d0k Date: Wed Oct 7 03:35:23 2015 New Revision: 249526 URL: http://llvm.org/viewvc/llvm-project?rev=249526&view=rev Log: [VFS] Switch clang-tidy tests to use an in-memory fs.
Again, this is both cleaner and completely removes any depedency on the host file system. Modified: clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h Modified: clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h?rev=249526&r1=249525&r2=249526&view=diff ============================================================================== --- clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h (original) +++ clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h Wed Oct 7 03:35:23 2015 @@ -90,17 +90,21 @@ runCheckOnCode(StringRef Code, std::vect ArgCXX11.push_back(Filename.str()); ast_matchers::MatchFinder Finder; + llvm::IntrusiveRefCntPtr<vfs::InMemoryFileSystem> InMemoryFileSystem( + new vfs::InMemoryFileSystem); llvm::IntrusiveRefCntPtr<FileManager> Files( - new FileManager(FileSystemOptions())); + new FileManager(FileSystemOptions(), InMemoryFileSystem)); SmallVector<std::unique_ptr<ClangTidyCheck>, 1> Checks; CheckFactory<CheckList...>::createChecks(&Context, Checks); tooling::ToolInvocation Invocation( ArgCXX11, new TestClangTidyAction(Checks, Finder, Context), Files.get()); - Invocation.mapVirtualFile(Filename.str(), Code); + InMemoryFileSystem->addFile(Filename, 0, + llvm::MemoryBuffer::getMemBuffer(Code)); for (const auto &FileContent : PathsToContent) { - Invocation.mapVirtualFile(Twine("include/" + FileContent.first).str(), - FileContent.second); + InMemoryFileSystem->addFile( + Twine("include/") + FileContent.first, 0, + llvm::MemoryBuffer::getMemBuffer(FileContent.second)); } Invocation.setDiagnosticConsumer(&DiagConsumer); if (!Invocation.run()) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits