mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 06:25:18 +00:00
Use std::unique_ptr to make the ownership explicit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214377 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -300,9 +300,9 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
||||
return I->second;
|
||||
Binary *Bin = nullptr;
|
||||
Binary *DbgBin = nullptr;
|
||||
ErrorOr<Binary *> BinaryOrErr = createBinary(Path);
|
||||
ErrorOr<std::unique_ptr<Binary>> BinaryOrErr = createBinary(Path);
|
||||
if (!error(BinaryOrErr.getError())) {
|
||||
std::unique_ptr<Binary> ParsedBinary(BinaryOrErr.get());
|
||||
std::unique_ptr<Binary> ParsedBinary = std::move(BinaryOrErr.get());
|
||||
// Check if it's a universal binary.
|
||||
Bin = ParsedBinary.get();
|
||||
ParsedBinariesAndObjects.push_back(std::move(ParsedBinary));
|
||||
@@ -314,8 +314,8 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
||||
BinaryOrErr = createBinary(ResourcePath);
|
||||
std::error_code EC = BinaryOrErr.getError();
|
||||
if (EC != errc::no_such_file_or_directory && !error(EC)) {
|
||||
DbgBin = BinaryOrErr.get();
|
||||
ParsedBinariesAndObjects.push_back(std::unique_ptr<Binary>(DbgBin));
|
||||
DbgBin = BinaryOrErr.get().get();
|
||||
ParsedBinariesAndObjects.push_back(std::move(BinaryOrErr.get()));
|
||||
}
|
||||
}
|
||||
// Try to locate the debug binary using .gnu_debuglink section.
|
||||
@@ -327,8 +327,8 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
||||
findDebugBinary(Path, DebuglinkName, CRCHash, DebugBinaryPath)) {
|
||||
BinaryOrErr = createBinary(DebugBinaryPath);
|
||||
if (!error(BinaryOrErr.getError())) {
|
||||
DbgBin = BinaryOrErr.get();
|
||||
ParsedBinariesAndObjects.push_back(std::unique_ptr<Binary>(DbgBin));
|
||||
DbgBin = BinaryOrErr.get().get();
|
||||
ParsedBinariesAndObjects.push_back(std::move(BinaryOrErr.get()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user