mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-01 16:26:29 +00:00
Return an ErrorOr<Binary *> from createBinary.
I did write a version returning ErrorOr<OwningPtr<Binary> >, but it is too cumbersome to use without std::move. I will keep the patch locally and submit when we switch to c++11. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199326 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -301,9 +301,9 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
||||
return I->second;
|
||||
Binary *Bin = 0;
|
||||
Binary *DbgBin = 0;
|
||||
OwningPtr<Binary> ParsedBinary;
|
||||
OwningPtr<Binary> ParsedDbgBinary;
|
||||
if (!error(createBinary(Path, ParsedBinary))) {
|
||||
ErrorOr<Binary *> BinaryOrErr = createBinary(Path);
|
||||
if (!error(BinaryOrErr.getError())) {
|
||||
OwningPtr<Binary> ParsedBinary(BinaryOrErr.get());
|
||||
// Check if it's a universal binary.
|
||||
Bin = ParsedBinary.take();
|
||||
ParsedBinariesAndObjects.push_back(Bin);
|
||||
@@ -312,9 +312,10 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
||||
// resource directory.
|
||||
const std::string &ResourcePath =
|
||||
getDarwinDWARFResourceForPath(Path);
|
||||
error_code EC = createBinary(ResourcePath, ParsedDbgBinary);
|
||||
BinaryOrErr = createBinary(ResourcePath);
|
||||
error_code EC = BinaryOrErr.getError();
|
||||
if (EC != errc::no_such_file_or_directory && !error(EC)) {
|
||||
DbgBin = ParsedDbgBinary.take();
|
||||
DbgBin = BinaryOrErr.get();
|
||||
ParsedBinariesAndObjects.push_back(DbgBin);
|
||||
}
|
||||
}
|
||||
@@ -324,10 +325,12 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
||||
uint32_t CRCHash;
|
||||
std::string DebugBinaryPath;
|
||||
if (getGNUDebuglinkContents(Bin, DebuglinkName, CRCHash) &&
|
||||
findDebugBinary(Path, DebuglinkName, CRCHash, DebugBinaryPath) &&
|
||||
!error(createBinary(DebugBinaryPath, ParsedDbgBinary))) {
|
||||
DbgBin = ParsedDbgBinary.take();
|
||||
ParsedBinariesAndObjects.push_back(DbgBin);
|
||||
findDebugBinary(Path, DebuglinkName, CRCHash, DebugBinaryPath)) {
|
||||
BinaryOrErr = createBinary(DebugBinaryPath);
|
||||
if (!error(BinaryOrErr.getError())) {
|
||||
DbgBin = BinaryOrErr.get();
|
||||
ParsedBinariesAndObjects.push_back(DbgBin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user