r216478 - Return a std::unique_ptr from getBufferForFile. NFC.
Rafael Espindola
rafael.espindola at gmail.com
Tue Aug 26 13:17:44 PDT 2014
Author: rafael
Date: Tue Aug 26 15:17:44 2014
New Revision: 216478
URL: http://llvm.org/viewvc/llvm-project?rev=216478&view=rev
Log:
Return a std::unique_ptr from getBufferForFile. NFC.
Modified:
cfe/trunk/include/clang/Frontend/ASTUnit.h
cfe/trunk/lib/Frontend/ASTUnit.cpp
Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=216478&r1=216477&r2=216478&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTUnit.h Tue Aug 26 15:17:44 2014
@@ -683,8 +683,8 @@ public:
/// module file.
bool isModuleFile();
- llvm::MemoryBuffer *getBufferForFile(StringRef Filename,
- std::string *ErrorStr = nullptr);
+ std::unique_ptr<llvm::MemoryBuffer>
+ getBufferForFile(StringRef Filename, std::string *ErrorStr = nullptr);
/// \brief Determine what kind of translation unit this AST represents.
TranslationUnitKind getTranslationUnitKind() const { return TUKind; }
Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=216478&r1=216477&r2=216478&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Tue Aug 26 15:17:44 2014
@@ -635,10 +635,10 @@ ASTDeserializationListener *ASTUnit::get
return nullptr;
}
-llvm::MemoryBuffer *ASTUnit::getBufferForFile(StringRef Filename,
- std::string *ErrorStr) {
+std::unique_ptr<llvm::MemoryBuffer>
+ASTUnit::getBufferForFile(StringRef Filename, std::string *ErrorStr) {
assert(FileMgr);
- return FileMgr->getBufferForFile(Filename, ErrorStr).release();
+ return FileMgr->getBufferForFile(Filename, ErrorStr);
}
/// \brief Configure the diagnostics object for use with ASTUnit.
@@ -1205,7 +1205,7 @@ ASTUnit::ComputePreamble(CompilerInvocat
CreatedBuffer = false;
}
- Buffer = getBufferForFile(RF.second);
+ Buffer = getBufferForFile(RF.second).release();
if (!Buffer)
return std::make_pair(nullptr, std::make_pair(0, true));
CreatedBuffer = true;
@@ -1234,7 +1234,7 @@ ASTUnit::ComputePreamble(CompilerInvocat
// If the main source file was not remapped, load it now.
if (!Buffer) {
- Buffer = getBufferForFile(FrontendOpts.Inputs[0].getFile());
+ Buffer = getBufferForFile(FrontendOpts.Inputs[0].getFile()).release();
if (!Buffer)
return std::make_pair(nullptr, std::make_pair(0, true));
More information about the cfe-commits
mailing list