diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-08-21 20:44:56 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-08-21 20:44:56 +0000 |
commit | 1961f14cf965e63d944d8888a089067cde142d10 (patch) | |
tree | 22b9817765f165fa1d6f170c4c029b48e7c8c718 /llvm/lib/MC | |
parent | e423ed36f064e0830040c623f2f0a66df1c20814 (diff) | |
download | bcm5719-llvm-1961f14cf965e63d944d8888a089067cde142d10.tar.gz bcm5719-llvm-1961f14cf965e63d944d8888a089067cde142d10.zip |
Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using std::unique_ptr
llvm-svn: 216223
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index aafc5e1850e..5e44266e26e 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -2123,8 +2123,8 @@ bool AsmParser::handleMacroEntry(const MCAsmMacro *M, SMLoc NameLoc) { // instantiation. OS << ".endmacro\n"; - MemoryBuffer *Instantiation = - MemoryBuffer::getMemBufferCopy(OS.str(), "<instantiation>"); + std::unique_ptr<MemoryBuffer> Instantiation( + MemoryBuffer::getMemBufferCopy(OS.str(), "<instantiation>")); // Create the macro instantiation object and add to the current macro // instantiation stack. @@ -2134,7 +2134,7 @@ bool AsmParser::handleMacroEntry(const MCAsmMacro *M, SMLoc NameLoc) { ActiveMacros.push_back(MI); // Jump to the macro instantiation and prime the lexer. - CurBuffer = SrcMgr.AddNewSourceBuffer(Instantiation, SMLoc()); + CurBuffer = SrcMgr.AddNewSourceBuffer(std::move(Instantiation), SMLoc()); Lexer.setBuffer(SrcMgr.getMemoryBuffer(CurBuffer)->getBuffer()); Lex(); @@ -4310,8 +4310,8 @@ void AsmParser::instantiateMacroLikeBody(MCAsmMacro *M, SMLoc DirectiveLoc, raw_svector_ostream &OS) { OS << ".endr\n"; - MemoryBuffer *Instantiation = - MemoryBuffer::getMemBufferCopy(OS.str(), "<instantiation>"); + std::unique_ptr<MemoryBuffer> Instantiation( + MemoryBuffer::getMemBufferCopy(OS.str(), "<instantiation>")); // Create the macro instantiation object and add to the current macro // instantiation stack. @@ -4321,7 +4321,7 @@ void AsmParser::instantiateMacroLikeBody(MCAsmMacro *M, SMLoc DirectiveLoc, ActiveMacros.push_back(MI); // Jump to the macro instantiation and prime the lexer. - CurBuffer = SrcMgr.AddNewSourceBuffer(Instantiation, SMLoc()); + CurBuffer = SrcMgr.AddNewSourceBuffer(std::move(Instantiation), SMLoc()); Lexer.setBuffer(SrcMgr.getMemoryBuffer(CurBuffer)->getBuffer()); Lex(); } |