Skip to content

Commit

Permalink
Change MCDisassembler::setSymbolizer to take unique_ptr by value.
Browse files Browse the repository at this point in the history
This changes the interface to be more explicit that ownership is being
transferred.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203223 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
ahmedcharles committed Mar 7, 2014
1 parent 490750b commit cd68cff
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/llvm/MC/MCDisassembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class MCDisassembler {

/// Set \p Symzer as the current symbolizer.
/// This takes ownership of \p Symzer, and deletes the previously set one.
void setSymbolizer(std::unique_ptr<MCSymbolizer> &Symzer);
void setSymbolizer(std::unique_ptr<MCSymbolizer> Symzer);

/// Sets up an external symbolizer that uses the C API callbacks.
void setupForSymbolicDisassembly(LLVMOpInfoCallback GetOpInfo,
Expand Down
4 changes: 2 additions & 2 deletions lib/MC/MCDisassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ void MCDisassembler::tryAddingPcLoadReferenceComment(int64_t Value,
Symbolizer->tryAddingPcLoadReferenceComment(cStream, Value, Address);
}

void MCDisassembler::setSymbolizer(std::unique_ptr<MCSymbolizer> &Symzer) {
Symbolizer.reset(Symzer.release());
void MCDisassembler::setSymbolizer(std::unique_ptr<MCSymbolizer> Symzer) {
Symbolizer = std::move(Symzer);
}
2 changes: 1 addition & 1 deletion lib/MC/MCDisassembler/Disassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ LLVMDisasmContextRef LLVMCreateDisasmCPU(const char *Triple, const char *CPU,

std::unique_ptr<MCSymbolizer> Symbolizer(TheTarget->createMCSymbolizer(
Triple, GetOpInfo, SymbolLookUp, DisInfo, Ctx, RelInfo.release()));
DisAsm->setSymbolizer(Symbolizer);
DisAsm->setSymbolizer(std::move(Symbolizer));
DisAsm->setupForSymbolicDisassembly(GetOpInfo, SymbolLookUp, DisInfo,
Ctx, RelInfo);
// Set up the instruction printer.
Expand Down
2 changes: 1 addition & 1 deletion tools/llvm-objdump/llvm-objdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
std::unique_ptr<MCSymbolizer> Symzer(
MCObjectSymbolizer::createObjectSymbolizer(*Ctx.get(), RelInfo, Obj));
if (Symzer)
DisAsm->setSymbolizer(Symzer);
DisAsm->setSymbolizer(std::move(Symzer));
}
}

Expand Down

0 comments on commit cd68cff

Please sign in to comment.