mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
Use unique_ptr to manage ParsedBinariesAndObjects in LLVMSymbolizer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206866 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
073440f3d4
commit
f749021c54
@ -207,7 +207,6 @@ std::string LLVMSymbolizer::symbolizeData(const std::string &ModuleName,
|
||||
|
||||
void LLVMSymbolizer::flush() {
|
||||
DeleteContainerSeconds(Modules);
|
||||
DeleteContainerPointers(ParsedBinariesAndObjects);
|
||||
BinaryForPath.clear();
|
||||
ObjectFileForArch.clear();
|
||||
}
|
||||
@ -305,8 +304,8 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
||||
if (!error(BinaryOrErr.getError())) {
|
||||
std::unique_ptr<Binary> ParsedBinary(BinaryOrErr.get());
|
||||
// Check if it's a universal binary.
|
||||
Bin = ParsedBinary.release();
|
||||
ParsedBinariesAndObjects.push_back(Bin);
|
||||
Bin = ParsedBinary.get();
|
||||
ParsedBinariesAndObjects.push_back(std::move(ParsedBinary));
|
||||
if (Bin->isMachO() || Bin->isMachOUniversalBinary()) {
|
||||
// On Darwin we may find DWARF in separate object file in
|
||||
// resource directory.
|
||||
@ -316,7 +315,7 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
||||
error_code EC = BinaryOrErr.getError();
|
||||
if (EC != errc::no_such_file_or_directory && !error(EC)) {
|
||||
DbgBin = BinaryOrErr.get();
|
||||
ParsedBinariesAndObjects.push_back(DbgBin);
|
||||
ParsedBinariesAndObjects.push_back(std::unique_ptr<Binary>(DbgBin));
|
||||
}
|
||||
}
|
||||
// Try to locate the debug binary using .gnu_debuglink section.
|
||||
@ -329,7 +328,7 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
||||
BinaryOrErr = createBinary(DebugBinaryPath);
|
||||
if (!error(BinaryOrErr.getError())) {
|
||||
DbgBin = BinaryOrErr.get();
|
||||
ParsedBinariesAndObjects.push_back(DbgBin);
|
||||
ParsedBinariesAndObjects.push_back(std::unique_ptr<Binary>(DbgBin));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -353,8 +352,8 @@ LLVMSymbolizer::getObjectFileFromBinary(Binary *Bin, const std::string &ArchName
|
||||
return I->second;
|
||||
std::unique_ptr<ObjectFile> ParsedObj;
|
||||
if (!UB->getObjectForArch(Triple(ArchName).getArch(), ParsedObj)) {
|
||||
Res = ParsedObj.release();
|
||||
ParsedBinariesAndObjects.push_back(Res);
|
||||
Res = ParsedObj.get();
|
||||
ParsedBinariesAndObjects.push_back(std::move(ParsedObj));
|
||||
}
|
||||
ObjectFileForArch[std::make_pair(UB, ArchName)] = Res;
|
||||
} else if (Bin->isObject()) {
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
@ -72,7 +73,7 @@ private:
|
||||
std::string printDILineInfo(DILineInfo LineInfo) const;
|
||||
|
||||
// Owns all the parsed binaries and object files.
|
||||
SmallVector<Binary*, 4> ParsedBinariesAndObjects;
|
||||
SmallVector<std::unique_ptr<Binary>, 4> ParsedBinariesAndObjects;
|
||||
// Owns module info objects.
|
||||
typedef std::map<std::string, ModuleInfo *> ModuleMapTy;
|
||||
ModuleMapTy Modules;
|
||||
|
Loading…
x
Reference in New Issue
Block a user