summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/RuntimeDyld
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2014-04-24 06:44:33 +0000
committerCraig Topper <craig.topper@gmail.com>2014-04-24 06:44:33 +0000
commite703fcb9757820fe27d9ef98ce3775d9c6d6e898 (patch)
tree723280dd6234fa80ce8d001b0e09378ca717f6c9 /lib/ExecutionEngine/RuntimeDyld
parent2c0470e781355a96f901fcf863f59b814eac20fa (diff)
downloadllvm-e703fcb9757820fe27d9ef98ce3775d9c6d6e898.tar.gz
llvm-e703fcb9757820fe27d9ef98ce3775d9c6d6e898.tar.bz2
llvm-e703fcb9757820fe27d9ef98ce3775d9c6d6e898.tar.xz
[C++] Use 'nullptr'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207083 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/RuntimeDyld')
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/GDBRegistrar.cpp13
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp12
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp17
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp2
4 files changed, 22 insertions, 22 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/GDBRegistrar.cpp b/lib/ExecutionEngine/RuntimeDyld/GDBRegistrar.cpp
index 1d0e9b3f92..8546571587 100644
--- a/lib/ExecutionEngine/RuntimeDyld/GDBRegistrar.cpp
+++ b/lib/ExecutionEngine/RuntimeDyld/GDBRegistrar.cpp
@@ -45,7 +45,7 @@ extern "C" {
// We put information about the JITed function in this global, which the
// debugger reads. Make sure to specify the version statically, because the
// debugger checks the version before we can set it during runtime.
- struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
+ struct jit_descriptor __jit_debug_descriptor = { 1, 0, nullptr, nullptr };
// Debuggers puts a breakpoint in this function.
LLVM_ATTRIBUTE_NOINLINE void __jit_debug_register_code() {
@@ -108,10 +108,10 @@ void NotifyDebugger(jit_code_entry* JITCodeEntry) {
__jit_debug_descriptor.action_flag = JIT_REGISTER_FN;
// Insert this entry at the head of the list.
- JITCodeEntry->prev_entry = NULL;
+ JITCodeEntry->prev_entry = nullptr;
jit_code_entry* NextEntry = __jit_debug_descriptor.first_entry;
JITCodeEntry->next_entry = NextEntry;
- if (NextEntry != NULL) {
+ if (NextEntry) {
NextEntry->prev_entry = JITCodeEntry;
}
__jit_debug_descriptor.first_entry = JITCodeEntry;
@@ -142,11 +142,10 @@ void GDBJITRegistrar::registerObject(const ObjectBuffer &Object) {
"Second attempt to perform debug registration.");
jit_code_entry* JITCodeEntry = new jit_code_entry();
- if (JITCodeEntry == 0) {
+ if (!JITCodeEntry) {
llvm::report_fatal_error(
"Allocation failed when registering a JIT entry!\n");
- }
- else {
+ } else {
JITCodeEntry->symfile_addr = Buffer;
JITCodeEntry->symfile_size = Size;
@@ -198,7 +197,7 @@ void GDBJITRegistrar::deregisterObjectInternal(
}
delete JITCodeEntry;
- JITCodeEntry = NULL;
+ JITCodeEntry = nullptr;
}
llvm::ManagedStatic<GDBJITRegistrar> TheRegistrar;
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
index 65b544dcaf..cc2f29d9df 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -106,7 +106,7 @@ ObjectImage *RuntimeDyldImpl::loadObject(ObjectImage *InputObject) {
std::unique_ptr<ObjectImage> Obj(InputObject);
if (!Obj)
- return NULL;
+ return nullptr;
// Save information about our target
Arch = (Triple::ArchType)Obj->getArch();
@@ -426,7 +426,7 @@ unsigned RuntimeDyldImpl::emitSection(ObjectImage &Obj,
uintptr_t Allocate;
unsigned SectionID = Sections.size();
uint8_t *Addr;
- const char *pData = 0;
+ const char *pData = nullptr;
// Some sections, such as debug info, don't need to be loaded for execution.
// Leave those where they are.
@@ -467,7 +467,7 @@ unsigned RuntimeDyldImpl::emitSection(ObjectImage &Obj,
// to handle later processing (and by 'handle' I mean don't do anything
// with these sections).
Allocate = 0;
- Addr = 0;
+ Addr = nullptr;
DEBUG(dbgs() << "emitSection SectionID: " << SectionID << " Name: " << Name
<< " obj addr: " << format("%p", data.data()) << " new addr: 0"
<< " DataSize: " << DataSize << " StubBufSize: " << StubBufSize
@@ -612,7 +612,7 @@ void RuntimeDyldImpl::resolveRelocationList(const RelocationList &Relocs,
for (unsigned i = 0, e = Relocs.size(); i != e; ++i) {
const RelocationEntry &RE = Relocs[i];
// Ignore relocations for sections that were not loaded
- if (Sections[RE.SectionID].Address == 0)
+ if (Sections[RE.SectionID].Address == nullptr)
continue;
resolveRelocation(RE, Value);
}
@@ -677,7 +677,7 @@ RuntimeDyld::RuntimeDyld(RTDyldMemoryManager *mm) {
// though the public class spawns a new 'impl' instance for each load,
// they share a single memory manager. This can become a problem when page
// permissions are applied.
- Dyld = 0;
+ Dyld = nullptr;
MM = mm;
ProcessAllSections = false;
}
@@ -766,7 +766,7 @@ ObjectImage *RuntimeDyld::loadObject(ObjectBuffer *InputBuffer) {
void *RuntimeDyld::getSymbolAddress(StringRef Name) {
if (!Dyld)
- return NULL;
+ return nullptr;
return Dyld->getSymbolAddress(Name);
}
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
index 434a1adf4f..abe8b6c388 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -167,7 +167,7 @@ void RuntimeDyldELF::deregisterEHFrames() {
ObjectImage *
RuntimeDyldELF::createObjectImageFromFile(object::ObjectFile *ObjFile) {
if (!ObjFile)
- return NULL;
+ return nullptr;
error_code ec;
MemoryBuffer *Buffer =
@@ -176,19 +176,19 @@ RuntimeDyldELF::createObjectImageFromFile(object::ObjectFile *ObjFile) {
if (ObjFile->getBytesInAddress() == 4 && ObjFile->isLittleEndian()) {
DyldELFObject<ELFType<support::little, 2, false>> *Obj =
new DyldELFObject<ELFType<support::little, 2, false>>(Buffer, ec);
- return new ELFObjectImage<ELFType<support::little, 2, false>>(NULL, Obj);
+ return new ELFObjectImage<ELFType<support::little, 2, false>>(nullptr, Obj);
} else if (ObjFile->getBytesInAddress() == 4 && !ObjFile->isLittleEndian()) {
DyldELFObject<ELFType<support::big, 2, false>> *Obj =
new DyldELFObject<ELFType<support::big, 2, false>>(Buffer, ec);
- return new ELFObjectImage<ELFType<support::big, 2, false>>(NULL, Obj);
+ return new ELFObjectImage<ELFType<support::big, 2, false>>(nullptr, Obj);
} else if (ObjFile->getBytesInAddress() == 8 && !ObjFile->isLittleEndian()) {
DyldELFObject<ELFType<support::big, 2, true>> *Obj =
new DyldELFObject<ELFType<support::big, 2, true>>(Buffer, ec);
- return new ELFObjectImage<ELFType<support::big, 2, true>>(NULL, Obj);
+ return new ELFObjectImage<ELFType<support::big, 2, true>>(nullptr, Obj);
} else if (ObjFile->getBytesInAddress() == 8 && ObjFile->isLittleEndian()) {
DyldELFObject<ELFType<support::little, 2, true>> *Obj =
new DyldELFObject<ELFType<support::little, 2, true>>(Buffer, ec);
- return new ELFObjectImage<ELFType<support::little, 2, true>>(NULL, Obj);
+ return new ELFObjectImage<ELFType<support::little, 2, true>>(nullptr, Obj);
} else
llvm_unreachable("Unexpected ELF format");
}
@@ -1152,7 +1152,7 @@ relocation_iterator RuntimeDyldELF::processRelocationRef(
// Extra check to avoid relocation againt empty symbols (usually
// the R_PPC64_TOC).
if (SymType != SymbolRef::ST_Unknown && TargetName.empty())
- Value.SymbolName = NULL;
+ Value.SymbolName = nullptr;
if (Value.SymbolName)
addRelocationForSymbol(RE, Value.SymbolName);
@@ -1284,7 +1284,8 @@ void RuntimeDyldELF::updateGOTEntries(StringRef Name, uint64_t Addr) {
for (it = GOTs.begin(); it != end; ++it) {
GOTRelocations &GOTEntries = it->second;
for (int i = 0, e = GOTEntries.size(); i != e; ++i) {
- if (GOTEntries[i].SymbolName != 0 && GOTEntries[i].SymbolName == Name) {
+ if (GOTEntries[i].SymbolName != nullptr &&
+ GOTEntries[i].SymbolName == Name) {
GOTEntries[i].Offset = Addr;
}
}
@@ -1332,7 +1333,7 @@ uint64_t RuntimeDyldELF::findGOTEntry(uint64_t LoadAddress, uint64_t Offset) {
// Find the matching entry in our vector.
uint64_t SymbolOffset = 0;
for (int i = 0, e = GOTEntries.size(); i != e; ++i) {
- if (GOTEntries[i].SymbolName == 0) {
+ if (!GOTEntries[i].SymbolName) {
if (getSectionLoadAddress(GOTEntries[i].SectionID) == LoadAddress &&
GOTEntries[i].Offset == Offset) {
GOTIndex = i;
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
index 999e8f3261..d91c9bcd0e 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
+++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
@@ -67,7 +67,7 @@ void RuntimeDyldMachO::registerEHFrames() {
continue;
SectionEntry *Text = &Sections[SectionInfo.TextSID];
SectionEntry *EHFrame = &Sections[SectionInfo.EHFrameSID];
- SectionEntry *ExceptTab = NULL;
+ SectionEntry *ExceptTab = nullptr;
if (SectionInfo.ExceptTabSID != RTDYLD_INVALID_SECTION_ID)
ExceptTab = &Sections[SectionInfo.ExceptTabSID];