mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
Use a reference instead of a pointer.
This makes using a std::unique_ptr in the caller more convenient. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214433 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
156ce6cc13
commit
81becb73ab
@ -124,7 +124,7 @@ public:
|
||||
virtual ~DIContext();
|
||||
|
||||
/// getDWARFContext - get a context for binary DWARF data.
|
||||
static DIContext *getDWARFContext(object::ObjectFile *);
|
||||
static DIContext *getDWARFContext(object::ObjectFile &);
|
||||
|
||||
virtual void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All) = 0;
|
||||
|
||||
|
@ -13,6 +13,6 @@ using namespace llvm;
|
||||
|
||||
DIContext::~DIContext() {}
|
||||
|
||||
DIContext *DIContext::getDWARFContext(object::ObjectFile *Obj) {
|
||||
DIContext *DIContext::getDWARFContext(object::ObjectFile &Obj) {
|
||||
return new DWARFContextInMemory(Obj);
|
||||
}
|
||||
|
@ -621,10 +621,10 @@ static bool consumeCompressedDebugSectionHeader(StringRef &data,
|
||||
return true;
|
||||
}
|
||||
|
||||
DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj)
|
||||
: IsLittleEndian(Obj->isLittleEndian()),
|
||||
AddressSize(Obj->getBytesInAddress()) {
|
||||
for (const SectionRef &Section : Obj->sections()) {
|
||||
DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile &Obj)
|
||||
: IsLittleEndian(Obj.isLittleEndian()),
|
||||
AddressSize(Obj.getBytesInAddress()) {
|
||||
for (const SectionRef &Section : Obj.sections()) {
|
||||
StringRef name;
|
||||
Section.getName(name);
|
||||
StringRef data;
|
||||
@ -687,7 +687,7 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj)
|
||||
}
|
||||
|
||||
section_iterator RelocatedSection = Section.getRelocatedSection();
|
||||
if (RelocatedSection == Obj->section_end())
|
||||
if (RelocatedSection == Obj.section_end())
|
||||
continue;
|
||||
|
||||
StringRef RelSecName;
|
||||
@ -724,12 +724,12 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj)
|
||||
Reloc.getType(Type);
|
||||
uint64_t SymAddr = 0;
|
||||
// ELF relocations may need the symbol address
|
||||
if (Obj->isELF()) {
|
||||
if (Obj.isELF()) {
|
||||
object::symbol_iterator Sym = Reloc.getSymbol();
|
||||
Sym->getAddress(SymAddr);
|
||||
}
|
||||
|
||||
object::RelocVisitor V(Obj->getFileFormatName());
|
||||
object::RelocVisitor V(Obj.getFileFormatName());
|
||||
// The section address is always 0 for debug sections.
|
||||
object::RelocToApply R(V.visit(Type, Reloc, 0, SymAddr));
|
||||
if (V.error()) {
|
||||
|
@ -245,7 +245,7 @@ class DWARFContextInMemory : public DWARFContext {
|
||||
SmallVector<SmallString<32>, 4> UncompressedSections;
|
||||
|
||||
public:
|
||||
DWARFContextInMemory(object::ObjectFile *);
|
||||
DWARFContextInMemory(object::ObjectFile &);
|
||||
bool isLittleEndian() const override { return IsLittleEndian; }
|
||||
uint8_t getAddressSize() const override { return AddressSize; }
|
||||
const Section &getInfoSection() override { return InfoSection; }
|
||||
|
@ -237,7 +237,7 @@ size_t DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
|
||||
|
||||
DWARFUnit::DWOHolder::DWOHolder(object::ObjectFile *DWOFile)
|
||||
: DWOFile(DWOFile),
|
||||
DWOContext(cast<DWARFContext>(DIContext::getDWARFContext(DWOFile))),
|
||||
DWOContext(cast<DWARFContext>(DIContext::getDWARFContext(*DWOFile))),
|
||||
DWOU(nullptr) {
|
||||
if (DWOContext->getNumDWOCompileUnits() > 0)
|
||||
DWOU = DWOContext->getDWOCompileUnitAtIndex(0);
|
||||
|
@ -82,7 +82,7 @@ static void DumpInput(const StringRef &Filename) {
|
||||
}
|
||||
std::unique_ptr<ObjectFile> Obj = std::move(ObjOrErr.get());
|
||||
|
||||
std::unique_ptr<DIContext> DICtx(DIContext::getDWARFContext(Obj.get()));
|
||||
std::unique_ptr<DIContext> DICtx(DIContext::getDWARFContext(*Obj));
|
||||
|
||||
outs() << Filename
|
||||
<< ":\tfile format " << Obj->getFileFormatName() << "\n\n";
|
||||
|
@ -298,7 +298,7 @@ static void DisassembleInputMachO2(StringRef Filename,
|
||||
}
|
||||
|
||||
// Setup the DIContext
|
||||
diContext.reset(DIContext::getDWARFContext(DbgObj));
|
||||
diContext.reset(DIContext::getDWARFContext(*DbgObj));
|
||||
}
|
||||
|
||||
for (unsigned SectIdx = 0; SectIdx != Sections.size(); SectIdx++) {
|
||||
|
@ -213,7 +213,7 @@ static int printLineInfoForInput() {
|
||||
Dyld.resolveRelocations();
|
||||
|
||||
std::unique_ptr<DIContext> Context(
|
||||
DIContext::getDWARFContext(LoadedObject->getObjectFile()));
|
||||
DIContext::getDWARFContext(*LoadedObject->getObjectFile()));
|
||||
|
||||
// Use symbol info to iterate functions in the object.
|
||||
for (object::symbol_iterator I = LoadedObject->begin_symbols(),
|
||||
|
@ -388,7 +388,7 @@ LLVMSymbolizer::getOrCreateModuleInfo(const std::string &ModuleName) {
|
||||
Modules.insert(make_pair(ModuleName, (ModuleInfo *)nullptr));
|
||||
return nullptr;
|
||||
}
|
||||
DIContext *Context = DIContext::getDWARFContext(DbgObj);
|
||||
DIContext *Context = DIContext::getDWARFContext(*DbgObj);
|
||||
assert(Context);
|
||||
ModuleInfo *Info = new ModuleInfo(Obj, Context);
|
||||
Modules.insert(make_pair(ModuleName, Info));
|
||||
|
Loading…
Reference in New Issue
Block a user