summaryrefslogtreecommitdiffstats
path: root/include/clang/Basic/SourceManager.h
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-08-27 20:54:45 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-08-27 20:54:45 +0000
commit926a507ee587f1455010dca59ffd0253d2bf70ff (patch)
tree044480b7bdd37e1a016e0727f44de218d9bba5f9 /include/clang/Basic/SourceManager.h
parentc8df8573681a027384d7bec55866f51ae74f8393 (diff)
Overload SourceManager::overrideFileContents so that unconditionally passing ownership is explicitly done using unique_ptr.
Only those callers who are dynamically passing ownership should need the 3 argument form. Those accepting the default ("do pass ownership") should do so explicitly with a unique_ptr now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216614 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceManager.h')
-rw-r--r--include/clang/Basic/SourceManager.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index fb65c4b28d..8addde9d15 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -832,7 +832,11 @@ public:
/// \param DoNotFree If true, then the buffer will not be freed when the
/// source manager is destroyed.
void overrideFileContents(const FileEntry *SourceFile,
- llvm::MemoryBuffer *Buffer, bool DoNotFree = false);
+ llvm::MemoryBuffer *Buffer, bool DoNotFree);
+ void overrideFileContents(const FileEntry *SourceFile,
+ std::unique_ptr<llvm::MemoryBuffer> Buffer) {
+ overrideFileContents(SourceFile, Buffer.release(), /*DoNotFree*/ false);
+ }
/// \brief Override the given source file with another one.
///