From: Benjamin Kramer Date: Thu, 8 Oct 2015 14:20:14 +0000 (+0000) Subject: [VFS] Use VFS instead of virtual files in PPCallbacks test. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=615cb5a25f4eb7344b6edd14269a7512606fd581;p=clang [VFS] Use VFS instead of virtual files in PPCallbacks test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249693 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/unittests/Lex/PPCallbacksTest.cpp b/unittests/Lex/PPCallbacksTest.cpp index 08bc351e8c..cbce5c6e16 100644 --- a/unittests/Lex/PPCallbacksTest.cpp +++ b/unittests/Lex/PPCallbacksTest.cpp @@ -110,15 +110,16 @@ public: class PPCallbacksTest : public ::testing::Test { protected: PPCallbacksTest() - : FileMgr(FileMgrOpts), DiagID(new DiagnosticIDs()), - DiagOpts(new DiagnosticOptions()), + : InMemoryFileSystem(new vfs::InMemoryFileSystem), + FileMgr(FileSystemOptions(), InMemoryFileSystem), + DiagID(new DiagnosticIDs()), DiagOpts(new DiagnosticOptions()), Diags(DiagID, DiagOpts.get(), new IgnoringDiagConsumer()), SourceMgr(Diags, FileMgr), TargetOpts(new TargetOptions()) { TargetOpts->Triple = "x86_64-apple-darwin11.1.0"; Target = TargetInfo::CreateTargetInfo(Diags, TargetOpts); } - FileSystemOptions FileMgrOpts; + IntrusiveRefCntPtr InMemoryFileSystem; FileManager FileMgr; IntrusiveRefCntPtr DiagID; IntrusiveRefCntPtr DiagOpts; @@ -133,7 +134,8 @@ protected: void AddFakeHeader(HeaderSearch& HeaderInfo, const char* HeaderPath, bool IsSystemHeader) { // Tell FileMgr about header. - FileMgr.getVirtualFile(HeaderPath, 0, 0); + InMemoryFileSystem->addFile(HeaderPath, 0, + llvm::MemoryBuffer::getMemBuffer("\n")); // Add header's parent path to search path. StringRef SearchPath = llvm::sys::path::parent_path(HeaderPath);