diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-27 20:03:13 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-27 20:03:13 +0000 |
commit | 1a7f705fba4b387ad251b0f303acec5c7131971d (patch) | |
tree | 632d01e6e0e3fae312f0ce106697c721529ae219 /utils/FileCheck | |
parent | b2f71836eb550319748c96c331c7ffe791f3a9c3 (diff) |
Return a std::unique_ptr when creating a new MemoryBuffer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216583 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/FileCheck')
-rw-r--r-- | utils/FileCheck/FileCheck.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/utils/FileCheck/FileCheck.cpp b/utils/FileCheck/FileCheck.cpp index 9203c4cf33c..9606e64d6f8 100644 --- a/utils/FileCheck/FileCheck.cpp +++ b/utils/FileCheck/FileCheck.cpp @@ -839,8 +839,8 @@ static bool ReadCheckFile(SourceMgr &SM, // If we want to canonicalize whitespace, strip excess whitespace from the // buffer containing the CHECK lines. Remove DOS style line endings. - std::unique_ptr<MemoryBuffer> F = - CanonicalizeInputFile(std::move(*FileOrErr), NoCanonicalizeWhiteSpace); + std::unique_ptr<MemoryBuffer> F = CanonicalizeInputFile( + std::move(FileOrErr.get()), NoCanonicalizeWhiteSpace); // Find all instances of CheckPrefix followed by : in the file. StringRef Buffer = F->getBuffer(); @@ -853,8 +853,9 @@ static bool ReadCheckFile(SourceMgr &SM, // command line option responsible for the specific implicit CHECK-NOT. std::string Prefix = std::string("-") + ImplicitCheckNot.ArgStr + "='"; std::string Suffix = "'"; - std::unique_ptr<MemoryBuffer> CmdLine(MemoryBuffer::getMemBufferCopy( - Prefix + PatternString + Suffix, "command line")); + std::unique_ptr<MemoryBuffer> CmdLine = MemoryBuffer::getMemBufferCopy( + Prefix + PatternString + Suffix, "command line"); + StringRef PatternInBuffer = CmdLine->getBuffer().substr(Prefix.size(), PatternString.size()); SM.AddNewSourceBuffer(std::move(CmdLine), SMLoc()); |