diff options
Diffstat (limited to 'unittests/Basic/SourceManagerTest.cpp')
-rw-r--r-- | unittests/Basic/SourceManagerTest.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/unittests/Basic/SourceManagerTest.cpp b/unittests/Basic/SourceManagerTest.cpp index 9ea093c..1dda54d 100644 --- a/unittests/Basic/SourceManagerTest.cpp +++ b/unittests/Basic/SourceManagerTest.cpp @@ -74,8 +74,8 @@ TEST_F(SourceManagerTest, isBeforeInTranslationUnit) { const char *source = "#define M(x) [x]\n" "M(foo)"; - MemoryBuffer *buf = MemoryBuffer::getMemBuffer(source); - FileID mainFileID = SourceMgr.createFileID(buf); + std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(source); + FileID mainFileID = SourceMgr.createFileID(std::move(Buf)); SourceMgr.setMainFileID(mainFileID); VoidModuleLoader ModLoader; @@ -127,8 +127,8 @@ TEST_F(SourceManagerTest, getColumnNumber) { "int x;\n" "int y;"; - MemoryBuffer *Buf = MemoryBuffer::getMemBuffer(Source); - FileID MainFileID = SourceMgr.createFileID(Buf); + std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(Source); + FileID MainFileID = SourceMgr.createFileID(std::move(Buf)); SourceMgr.setMainFileID(MainFileID); bool Invalid; @@ -186,14 +186,14 @@ TEST_F(SourceManagerTest, getMacroArgExpandedLocation) { "#define CONCAT(X, Y) X##Y\n" "CONCAT(1,1)\n"; - MemoryBuffer *headerBuf = MemoryBuffer::getMemBuffer(header); - MemoryBuffer *mainBuf = MemoryBuffer::getMemBuffer(main); - FileID mainFileID = SourceMgr.createFileID(mainBuf); + std::unique_ptr<MemoryBuffer> HeaderBuf = MemoryBuffer::getMemBuffer(header); + std::unique_ptr<MemoryBuffer> MainBuf = MemoryBuffer::getMemBuffer(main); + FileID mainFileID = SourceMgr.createFileID(std::move(MainBuf)); SourceMgr.setMainFileID(mainFileID); const FileEntry *headerFile = FileMgr.getVirtualFile("/test-header.h", - headerBuf->getBufferSize(), 0); - SourceMgr.overrideFileContents(headerFile, headerBuf); + HeaderBuf->getBufferSize(), 0); + SourceMgr.overrideFileContents(headerFile, std::move(HeaderBuf)); VoidModuleLoader ModLoader; HeaderSearch HeaderInfo(new HeaderSearchOptions, SourceMgr, Diags, LangOpts, @@ -285,13 +285,13 @@ TEST_F(SourceManagerTest, isBeforeInTranslationUnitWithMacroInInclude) { "#define INC2 </test-header.h>\n" "#include M(INC2)\n"; - MemoryBuffer *headerBuf = MemoryBuffer::getMemBuffer(header); - MemoryBuffer *mainBuf = MemoryBuffer::getMemBuffer(main); - SourceMgr.setMainFileID(SourceMgr.createFileID(mainBuf)); + std::unique_ptr<MemoryBuffer> HeaderBuf = MemoryBuffer::getMemBuffer(header); + std::unique_ptr<MemoryBuffer> MainBuf = MemoryBuffer::getMemBuffer(main); + SourceMgr.setMainFileID(SourceMgr.createFileID(std::move(MainBuf))); const FileEntry *headerFile = FileMgr.getVirtualFile("/test-header.h", - headerBuf->getBufferSize(), 0); - SourceMgr.overrideFileContents(headerFile, headerBuf); + HeaderBuf->getBufferSize(), 0); + SourceMgr.overrideFileContents(headerFile, std::move(HeaderBuf)); VoidModuleLoader ModLoader; HeaderSearch HeaderInfo(new HeaderSearchOptions, SourceMgr, Diags, LangOpts, @@ -303,7 +303,7 @@ TEST_F(SourceManagerTest, isBeforeInTranslationUnitWithMacroInInclude) { PP.Initialize(*Target); std::vector<MacroAction> Macros; - PP.addPPCallbacks(new MacroTracker(Macros)); + PP.addPPCallbacks(llvm::make_unique<MacroTracker>(Macros)); PP.EnterMainSourceFile(); |