r286132 - Fix memory leak caused by r286096.
Eric Liu via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 7 10:40:41 PST 2016
Author: ioeric
Date: Mon Nov 7 12:40:41 2016
New Revision: 286132
URL: http://llvm.org/viewvc/llvm-project?rev=286132&view=rev
Log:
Fix memory leak caused by r286096.
Modified:
cfe/trunk/unittests/Tooling/RefactoringTest.cpp
Modified: cfe/trunk/unittests/Tooling/RefactoringTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/RefactoringTest.cpp?rev=286132&r1=286131&r2=286132&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/RefactoringTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/RefactoringTest.cpp Mon Nov 7 12:40:41 2016
@@ -977,7 +977,7 @@ TEST(DeduplicateByFileTest, PathsWithDot
std::map<std::string, Replacements> FileToReplaces;
llvm::IntrusiveRefCntPtr<vfs::InMemoryFileSystem> VFS(
new vfs::InMemoryFileSystem());
- FileManager *FileMgr = new FileManager(FileSystemOptions(), VFS);
+ FileManager FileMgr(FileSystemOptions(), VFS);
#if !defined(LLVM_ON_WIN32)
StringRef Path1 = "a/b/.././c.h";
StringRef Path2 = "a/c.h";
@@ -989,7 +989,7 @@ TEST(DeduplicateByFileTest, PathsWithDot
EXPECT_TRUE(VFS->addFile(Path2, 0, llvm::MemoryBuffer::getMemBuffer("")));
FileToReplaces[Path1] = Replacements();
FileToReplaces[Path2] = Replacements();
- FileToReplaces = groupReplacementsByFile(*FileMgr, FileToReplaces);
+ FileToReplaces = groupReplacementsByFile(FileMgr, FileToReplaces);
EXPECT_EQ(1u, FileToReplaces.size());
EXPECT_EQ(Path1, FileToReplaces.begin()->first);
}
@@ -998,7 +998,7 @@ TEST(DeduplicateByFileTest, PathWithDotS
std::map<std::string, Replacements> FileToReplaces;
llvm::IntrusiveRefCntPtr<vfs::InMemoryFileSystem> VFS(
new vfs::InMemoryFileSystem());
- FileManager *FileMgr = new FileManager(FileSystemOptions(), VFS);
+ FileManager FileMgr(FileSystemOptions(), VFS);
#if !defined(LLVM_ON_WIN32)
StringRef Path1 = "./a/b/c.h";
StringRef Path2 = "a/b/c.h";
@@ -1010,7 +1010,7 @@ TEST(DeduplicateByFileTest, PathWithDotS
EXPECT_TRUE(VFS->addFile(Path2, 0, llvm::MemoryBuffer::getMemBuffer("")));
FileToReplaces[Path1] = Replacements();
FileToReplaces[Path2] = Replacements();
- FileToReplaces = groupReplacementsByFile(*FileMgr, FileToReplaces);
+ FileToReplaces = groupReplacementsByFile(FileMgr, FileToReplaces);
EXPECT_EQ(1u, FileToReplaces.size());
EXPECT_EQ(Path1, FileToReplaces.begin()->first);
}
@@ -1019,7 +1019,7 @@ TEST(DeduplicateByFileTest, NonExistingF
std::map<std::string, Replacements> FileToReplaces;
llvm::IntrusiveRefCntPtr<vfs::InMemoryFileSystem> VFS(
new vfs::InMemoryFileSystem());
- FileManager *FileMgr = new FileManager(FileSystemOptions(), VFS);
+ FileManager FileMgr(FileSystemOptions(), VFS);
#if !defined(LLVM_ON_WIN32)
StringRef Path1 = "./a/b/c.h";
StringRef Path2 = "a/b/c.h";
@@ -1029,7 +1029,7 @@ TEST(DeduplicateByFileTest, NonExistingF
#endif
FileToReplaces[Path1] = Replacements();
FileToReplaces[Path2] = Replacements();
- FileToReplaces = groupReplacementsByFile(*FileMgr, FileToReplaces);
+ FileToReplaces = groupReplacementsByFile(FileMgr, FileToReplaces);
EXPECT_TRUE(FileToReplaces.empty());
}
More information about the cfe-commits
mailing list