[VFS] Use VFS instead of virtual files in PPCallbacks test.

llvm-svn: 249693
This commit is contained in:
Benjamin Kramer 2015-10-08 14:20:14 +00:00
parent 989157a3ad
commit 46d311da19
1 changed files with 6 additions and 4 deletions

View File

@ -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<vfs::InMemoryFileSystem> InMemoryFileSystem;
FileManager FileMgr;
IntrusiveRefCntPtr<DiagnosticIDs> DiagID;
IntrusiveRefCntPtr<DiagnosticOptions> 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);