Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Replace all uses of NULL with nullptr.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@153677 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information...
commit 5816d0ad5ccd6abd556f6e561092a1a6062d0ba7 1 parent 1765778
@Bigcheese authored
View
2  include/lld/Core/AbsoluteAtom.h
@@ -23,7 +23,7 @@ class AbsoluteAtom : public Atom {
}
/// like dynamic_cast, if atom is definitionAbsolute
- /// returns atom cast to AbsoluteAtom*, else returns NULL
+ /// returns atom cast to AbsoluteAtom*, else returns nullptr
virtual const AbsoluteAtom* absoluteAtom() const {
return this;
}
View
2  include/lld/Core/Platform.h
@@ -52,7 +52,7 @@ class Platform {
/// @brief if target must have some atoms, denote here
virtual bool getImplicitDeadStripRoots(std::vector<const DefinedAtom *>&) = 0;
- /// @brief return entry point for output file (e.g. "main") or NULL
+ /// @brief return entry point for output file (e.g. "main") or nullptr
virtual llvm::StringRef entryPointName() = 0;
/// @brief for iterating must-be-defined symbols ("main" or -u command line
View
2  include/lld/Core/Reference.h
@@ -48,7 +48,7 @@ class Reference {
virtual uint64_t offsetInAtom() const = 0;
/// If the reference is an edge to another Atom, then this returns the
- /// other Atom. Otherwise, it returns NULL.
+ /// other Atom. Otherwise, it returns nullptr.
virtual const class Atom * target() const = 0;
/// During linking, the linker may merge graphs which coalesces some nodes
View
4 include/lld/Core/SharedLibraryAtom.h
@@ -27,7 +27,7 @@ class SharedLibraryAtom : public Atom {
}
/// like dynamic_cast, if atom is definitionSharedLibrary
- /// returns atom cast to SharedLibraryAtom*, else returns NULL
+ /// returns atom cast to SharedLibraryAtom*, else returns nullptr
virtual const SharedLibraryAtom* sharedLibraryAtom() const {
return this;
}
@@ -38,7 +38,7 @@ class SharedLibraryAtom : public Atom {
virtual llvm::StringRef loadName() const = 0;
/// Returns if shared library symbol can be missing at runtime and if
- /// so the loader should silently resolve address of symbol to be NULL.
+ /// so the loader should silently resolve address of symbol to be nullptr.
virtual bool canBeNullAtRuntime() const = 0;
protected:
View
4 include/lld/Core/SymbolTable.h
@@ -52,7 +52,7 @@ class SymbolTable {
/// UndefinedAtom
bool isDefined(llvm::StringRef sym);
- /// @brief returns atom in symbol table for specified name (or NULL)
+ /// @brief returns atom in symbol table for specified name (or nullptr)
const Atom *findByName(llvm::StringRef sym);
/// @brief returns vector of remaining UndefinedAtoms
@@ -79,7 +79,7 @@ class SymbolTable {
StringRefMappingInfo> NameToAtom;
struct AtomMappingInfo {
- static const DefinedAtom * getEmptyKey() { return NULL; }
+ static const DefinedAtom * getEmptyKey() { return nullptr; }
static const DefinedAtom * getTombstoneKey() { return (DefinedAtom*)(-1); }
static unsigned getHashValue(const DefinedAtom * const Val);
static bool isEqual(const DefinedAtom * const LHS,
View
8 include/lld/Core/UndefinedAtom.h
@@ -23,23 +23,23 @@ class UndefinedAtom : public Atom {
}
/// like dynamic_cast, if atom is definitionUndefined
- /// returns atom cast to UndefinedAtom*, else returns NULL
+ /// returns atom cast to UndefinedAtom*, else returns nullptr
virtual const UndefinedAtom* undefinedAtom() const {
return this;
}
/// Whether this undefined symbol needs to be resolved,
- /// or whether it can just evaluate to NULL.
+ /// or whether it can just evaluate to nullptr.
/// This concept is often called "weak", but that term
/// is overloaded to mean other things too.
enum CanBeNull {
/// Normal symbols must be resolved at build time
canBeNullNever,
- /// This symbol can be missing at runtime and will evalute to NULL.
+ /// This symbol can be missing at runtime and will evalute to nullptr.
/// That is, the static linker still must find a definition (usually
/// is some shared library), but at runtime, the dynamic loader
- /// will allow the symbol to be missing and resolved to NULL.
+ /// will allow the symbol to be missing and resolved to nullptr.
///
/// On Darwin this is generated using a function prototype with
/// __attribute__((weak_import)).
View
28 lib/Core/NativeReader.cpp
@@ -349,7 +349,7 @@ class NativeFile : public File {
size_t atomsArraySize = chunk->elementCount * atomSize;
uint8_t* atomsStart = reinterpret_cast<uint8_t*>
(operator new(atomsArraySize, std::nothrow));
- if (atomsStart == NULL )
+ if (atomsStart == nullptr)
return make_error_code(native_reader_error::memory_error);
const size_t ivarElementSize = chunk->fileSize
/ chunk->elementCount;
@@ -387,7 +387,7 @@ class NativeFile : public File {
size_t atomsArraySize = chunk->elementCount * atomSize;
uint8_t* atomsStart = reinterpret_cast<uint8_t*>
(operator new(atomsArraySize, std::nothrow));
- if (atomsStart == NULL )
+ if (atomsStart == nullptr)
return make_error_code(native_reader_error::memory_error);
const size_t ivarElementSize = chunk->fileSize
/ chunk->elementCount;
@@ -418,7 +418,7 @@ class NativeFile : public File {
size_t atomsArraySize = chunk->elementCount * atomSize;
uint8_t* atomsStart = reinterpret_cast<uint8_t*>
(operator new(atomsArraySize, std::nothrow));
- if (atomsStart == NULL )
+ if (atomsStart == nullptr)
return make_error_code(native_reader_error::memory_error);
const size_t ivarElementSize = chunk->fileSize
/ chunk->elementCount;
@@ -449,7 +449,7 @@ class NativeFile : public File {
size_t atomsArraySize = chunk->elementCount * atomSize;
uint8_t* atomsStart = reinterpret_cast<uint8_t*>
(operator new(atomsArraySize, std::nothrow));
- if (atomsStart == NULL )
+ if (atomsStart == nullptr)
return make_error_code(native_reader_error::memory_error);
const size_t ivarElementSize = chunk->fileSize
/ chunk->elementCount;
@@ -484,7 +484,7 @@ class NativeFile : public File {
size_t refsArraySize = chunk->elementCount * refSize;
uint8_t* refsStart = reinterpret_cast<uint8_t*>
(operator new(refsArraySize, std::nothrow));
- if (refsStart == NULL )
+ if (refsStart == nullptr)
return make_error_code(native_reader_error::memory_error);
const size_t ivarElementSize = chunk->fileSize
/ chunk->elementCount;
@@ -621,15 +621,15 @@ class NativeFile : public File {
NativeFile(std::unique_ptr<llvm::MemoryBuffer> mb, llvm::StringRef path) :
lld::File(path),
_buffer(std::move(mb)), // NativeFile now takes ownership of buffer
- _header(NULL),
- _targetsTable(NULL),
+ _header(nullptr),
+ _targetsTable(nullptr),
_targetsTableCount(0),
- _strings(NULL),
+ _strings(nullptr),
_stringsMaxOffset(0),
- _addends(NULL),
+ _addends(nullptr),
_addendsMaxIndex(0),
- _contentStart(NULL),
- _contentEnd(NULL)
+ _contentStart(nullptr),
+ _contentEnd(nullptr)
{
_header = reinterpret_cast<const NativeFileHeader*>
(_buffer->getBufferStart());
@@ -638,7 +638,7 @@ class NativeFile : public File {
template <typename T>
class AtomArray : public File::atom_collection<T> {
public:
- AtomArray() : _arrayStart(NULL), _arrayEnd(NULL),
+ AtomArray() : _arrayStart(nullptr), _arrayEnd(nullptr),
_elementSize(0), _elementCount(0) { }
virtual atom_iterator<T> begin() const {
@@ -663,8 +663,8 @@ class NativeFile : public File {
struct IvarArray {
IvarArray() :
- arrayStart(NULL),
- arrayEnd(NULL),
+ arrayStart(nullptr),
+ arrayEnd(nullptr),
elementSize(0),
elementCount(0) { }
View
16 lib/Core/Resolver.cpp
@@ -205,7 +205,7 @@ void Resolver::resolveUndefines() {
// this tentative, so check again
llvm::StringRef tentName = (*dit)->name();
const Atom *curAtom = _symbolTable.findByName(tentName);
- assert(curAtom != NULL);
+ assert(curAtom != nullptr);
if ( const DefinedAtom* curDefAtom = curAtom->definedAtom() ) {
if (curDefAtom->merge() == DefinedAtom::mergeAsTentative )
_inputFiles.searchLibraries(tentName, searchDylibs,
@@ -236,10 +236,10 @@ void Resolver::updateReferences() {
// for dead code stripping, recursively mark atom "live"
void Resolver::markLive(const Atom &atom, WhyLiveBackChain *previous) {
// if -why_live cares about this symbol, then dump chain
- if ((previous->referer != NULL) && _platform.printWhyLive(atom.name())) {
+ if ((previous->referer != nullptr) && _platform.printWhyLive(atom.name())) {
llvm::errs() << atom.name() << " from " << atom.file().path() << "\n";
int depth = 1;
- for (WhyLiveBackChain *p = previous; p != NULL;
+ for (WhyLiveBackChain *p = previous; p != nullptr;
p = p->previous, ++depth) {
for (int i = depth; i > 0; --i)
llvm::errs() << " ";
@@ -279,7 +279,7 @@ void Resolver::deadStripOptimize() {
// add entry point (main) to live roots
const Atom *entry = this->entryPoint();
- if (entry != NULL)
+ if (entry != nullptr)
_deadStripRoots.insert(entry);
// add -exported_symbols_list, -init, and -u entries to live roots
@@ -300,7 +300,7 @@ void Resolver::deadStripOptimize() {
for (std::set<const Atom *>::iterator it = _deadStripRoots.begin();
it != _deadStripRoots.end(); ++it) {
WhyLiveBackChain rootChain;
- rootChain.previous = NULL;
+ rootChain.previous = nullptr;
rootChain.referer = *it;
this->markLive(**it, &rootChain);
}
@@ -343,7 +343,7 @@ void Resolver::checkDylibSymbolCollisions() {
for (std::vector<const Atom *>::const_iterator it = _atoms.begin();
it != _atoms.end(); ++it) {
const DefinedAtom* defAtom = (*it)->definedAtom();
- if ( defAtom == NULL )
+ if (defAtom == nullptr)
continue;
if ( defAtom->merge() != DefinedAtom::mergeAsTentative )
continue;
@@ -358,10 +358,10 @@ void Resolver::checkDylibSymbolCollisions() {
// get "main" atom for linkage unit
const Atom *Resolver::entryPoint() {
llvm::StringRef symbolName = _platform.entryPointName();
- if (symbolName != NULL)
+ if (symbolName != nullptr)
return _symbolTable.findByName(symbolName);
- return NULL;
+ return nullptr;
}
// give platform a chance to tweak the set of atoms
View
16 lib/Core/SymbolTable.cpp
@@ -126,7 +126,7 @@ static MergeResolution mergeSelect(DefinedAtom::Merge first,
void SymbolTable::addByName(const Atom & newAtom) {
llvm::StringRef name = newAtom.name();
const Atom *existing = this->findByName(name);
- if (existing == NULL) {
+ if (existing == nullptr) {
// Name is not in symbol table yet, add it associate with this atom.
_nameTable[name] = &newAtom;
}
@@ -162,8 +162,8 @@ void SymbolTable::addByName(const Atom & newAtom) {
case NCR_DupUndef: {
const UndefinedAtom* existingUndef = existing->undefinedAtom();
const UndefinedAtom* newUndef = newAtom.undefinedAtom();
- assert(existingUndef != NULL);
- assert(newUndef != NULL);
+ assert(existingUndef != nullptr);
+ assert(newUndef != nullptr);
if ( existingUndef->canBeNull() == newUndef->canBeNull() ) {
useNew = false;
}
@@ -178,8 +178,8 @@ void SymbolTable::addByName(const Atom & newAtom) {
case NCR_DupShLib: {
const SharedLibraryAtom* existingShLib = existing->sharedLibraryAtom();
const SharedLibraryAtom* newShLib = newAtom.sharedLibraryAtom();
- assert(existingShLib != NULL);
- assert(newShLib != NULL);
+ assert(existingShLib != nullptr);
+ assert(newShLib != nullptr);
if ( (existingShLib->canBeNullAtRuntime()
== newShLib->canBeNullAtRuntime()) &&
existingShLib->loadName().equals(newShLib->loadName()) ) {
@@ -263,13 +263,13 @@ void SymbolTable::addByContent(const DefinedAtom & newAtom) {
const Atom *SymbolTable::findByName(llvm::StringRef sym) {
NameToAtom::iterator pos = _nameTable.find(sym);
if (pos == _nameTable.end())
- return NULL;
+ return nullptr;
return pos->second;
}
bool SymbolTable::isDefined(llvm::StringRef sym) {
const Atom *atom = this->findByName(sym);
- if (atom == NULL)
+ if (atom == nullptr)
return false;
if (atom->definition() == Atom::definitionUndefined)
return false;
@@ -292,7 +292,7 @@ void SymbolTable::undefines(std::vector<const Atom *> &undefs) {
for (NameToAtom::iterator it = _nameTable.begin(),
end = _nameTable.end(); it != end; ++it) {
const Atom *atom = it->second;
- assert(atom != NULL);
+ assert(atom != nullptr);
if (atom->definition() == Atom::definitionUndefined)
undefs.push_back(atom);
}
View
56 lib/Core/YamlKeyValues.cpp
@@ -69,12 +69,12 @@ static const DefinitionMapping defMappings[] = {
{ "absolute", Atom::definitionAbsolute },
{ "undefined", Atom::definitionUndefined },
{ "shared-library", Atom::definitionSharedLibrary },
- { NULL, Atom::definitionRegular }
+ { nullptr, Atom::definitionRegular }
};
Atom::Definition KeyValues::definition(const char* s)
{
- for (const DefinitionMapping* p = defMappings; p->string != NULL; ++p) {
+ for (const DefinitionMapping* p = defMappings; p->string != nullptr; ++p) {
if ( strcmp(p->string, s) == 0 )
return p->value;
}
@@ -82,7 +82,7 @@ Atom::Definition KeyValues::definition(const char* s)
}
const char* KeyValues::definition(Atom::Definition s) {
- for (const DefinitionMapping* p = defMappings; p->string != NULL; ++p) {
+ for (const DefinitionMapping* p = defMappings; p->string != nullptr; ++p) {
if ( p->value == s )
return p->string;
}
@@ -102,12 +102,12 @@ static const ScopeMapping scopeMappings[] = {
{ "global", DefinedAtom::scopeGlobal },
{ "hidden", DefinedAtom::scopeLinkageUnit },
{ "static", DefinedAtom::scopeTranslationUnit },
- { NULL, DefinedAtom::scopeGlobal }
+ { nullptr, DefinedAtom::scopeGlobal }
};
DefinedAtom::Scope KeyValues::scope(const char* s)
{
- for (const ScopeMapping* p = scopeMappings; p->string != NULL; ++p) {
+ for (const ScopeMapping* p = scopeMappings; p->string != nullptr; ++p) {
if ( strcmp(p->string, s) == 0 )
return p->value;
}
@@ -115,7 +115,7 @@ DefinedAtom::Scope KeyValues::scope(const char* s)
}
const char* KeyValues::scope(DefinedAtom::Scope s) {
- for (const ScopeMapping* p = scopeMappings; p->string != NULL; ++p) {
+ for (const ScopeMapping* p = scopeMappings; p->string != nullptr; ++p) {
if ( p->value == s )
return p->string;
}
@@ -161,12 +161,12 @@ static const ContentTypeMapping typeMappings[] = {
{ "tlv-data", DefinedAtom::typeTLVInitialData },
{ "tlv-zero-fill", DefinedAtom::typeTLVInitialZeroFill },
{ "tlv-init-ptr", DefinedAtom::typeTLVInitializerPtr },
- { NULL, DefinedAtom::typeUnknown }
+ { nullptr, DefinedAtom::typeUnknown }
};
DefinedAtom::ContentType KeyValues::contentType(const char* s)
{
- for (const ContentTypeMapping* p = typeMappings; p->string != NULL; ++p) {
+ for (const ContentTypeMapping* p = typeMappings; p->string != nullptr; ++p) {
if ( strcmp(p->string, s) == 0 )
return p->value;
}
@@ -174,7 +174,7 @@ DefinedAtom::ContentType KeyValues::contentType(const char* s)
}
const char* KeyValues::contentType(DefinedAtom::ContentType s) {
- for (const ContentTypeMapping* p = typeMappings; p->string != NULL; ++p) {
+ for (const ContentTypeMapping* p = typeMappings; p->string != nullptr; ++p) {
if ( p->value == s )
return p->string;
}
@@ -196,12 +196,13 @@ static const DeadStripMapping deadStripMappings[] = {
{ "normal", DefinedAtom::deadStripNormal },
{ "never", DefinedAtom::deadStripNever },
{ "always", DefinedAtom::deadStripAlways },
- { NULL, DefinedAtom::deadStripNormal }
+ { nullptr, DefinedAtom::deadStripNormal }
};
DefinedAtom::DeadStripKind KeyValues::deadStripKind(const char* s)
{
- for (const DeadStripMapping* p = deadStripMappings; p->string != NULL; ++p) {
+ for (const DeadStripMapping* p = deadStripMappings; p->string != nullptr; ++p)
+ {
if ( strcmp(p->string, s) == 0 )
return p->value;
}
@@ -209,7 +210,8 @@ DefinedAtom::DeadStripKind KeyValues::deadStripKind(const char* s)
}
const char* KeyValues::deadStripKind(DefinedAtom::DeadStripKind dsk) {
- for (const DeadStripMapping* p = deadStripMappings; p->string != NULL; ++p) {
+ for (const DeadStripMapping* p = deadStripMappings; p->string != nullptr; ++p)
+ {
if ( p->value == dsk )
return p->string;
}
@@ -229,12 +231,12 @@ static const InterposableMapping interMappings[] = {
{ "no", DefinedAtom::interposeNo },
{ "yes", DefinedAtom::interposeYes },
{ "yesAndWeak", DefinedAtom::interposeYesAndRuntimeWeak },
- { NULL, DefinedAtom::interposeNo }
+ { nullptr, DefinedAtom::interposeNo }
};
DefinedAtom::Interposable KeyValues::interposable(const char* s)
{
- for (const InterposableMapping* p = interMappings; p->string != NULL; ++p) {
+ for (const InterposableMapping* p = interMappings; p->string != nullptr; ++p){
if ( strcmp(p->string, s) == 0 )
return p->value;
}
@@ -242,7 +244,7 @@ DefinedAtom::Interposable KeyValues::interposable(const char* s)
}
const char* KeyValues::interposable(DefinedAtom::Interposable in) {
- for (const InterposableMapping* p = interMappings; p->string != NULL; ++p) {
+ for (const InterposableMapping* p = interMappings; p->string != nullptr; ++p){
if ( p->value == in )
return p->string;
}
@@ -264,12 +266,12 @@ static const MergeMapping mergeMappings[] = {
{ "asTentative", DefinedAtom::mergeAsTentative },
{ "asWeak", DefinedAtom::mergeAsWeak },
{ "asAddressedWeak",DefinedAtom::mergeAsWeakAndAddressUsed },
- { NULL, DefinedAtom::mergeNo }
+ { nullptr, DefinedAtom::mergeNo }
};
DefinedAtom::Merge KeyValues::merge(const char* s)
{
- for (const MergeMapping* p = mergeMappings; p->string != NULL; ++p) {
+ for (const MergeMapping* p = mergeMappings; p->string != nullptr; ++p) {
if ( strcmp(p->string, s) == 0 )
return p->value;
}
@@ -277,7 +279,7 @@ DefinedAtom::Merge KeyValues::merge(const char* s)
}
const char* KeyValues::merge(DefinedAtom::Merge in) {
- for (const MergeMapping* p = mergeMappings; p->string != NULL; ++p) {
+ for (const MergeMapping* p = mergeMappings; p->string != nullptr; ++p) {
if ( p->value == in )
return p->string;
}
@@ -298,12 +300,12 @@ static const SectionChoiceMapping sectMappings[] = {
{ "content", DefinedAtom::sectionBasedOnContent },
{ "custom", DefinedAtom::sectionCustomPreferred },
{ "custom-required", DefinedAtom::sectionCustomRequired },
- { NULL, DefinedAtom::sectionBasedOnContent }
+ { nullptr, DefinedAtom::sectionBasedOnContent }
};
DefinedAtom::SectionChoice KeyValues::sectionChoice(const char* s)
{
- for (const SectionChoiceMapping* p = sectMappings; p->string != NULL; ++p) {
+ for (const SectionChoiceMapping* p = sectMappings; p->string != nullptr; ++p){
if ( strcmp(p->string, s) == 0 )
return p->value;
}
@@ -311,7 +313,7 @@ DefinedAtom::SectionChoice KeyValues::sectionChoice(const char* s)
}
const char* KeyValues::sectionChoice(DefinedAtom::SectionChoice s) {
- for (const SectionChoiceMapping* p = sectMappings; p->string != NULL; ++p) {
+ for (const SectionChoiceMapping* p = sectMappings; p->string != nullptr; ++p){
if ( p->value == s )
return p->string;
}
@@ -335,12 +337,12 @@ static const PermissionsMapping permMappings[] = {
{ "custom-required", DefinedAtom::permR_X },
{ "custom-required", DefinedAtom::permRW_ },
{ "custom-required", DefinedAtom::permRW_L },
- { NULL, DefinedAtom::perm___ }
+ { nullptr, DefinedAtom::perm___ }
};
DefinedAtom::ContentPermissions KeyValues::permissions(const char* s)
{
- for (const PermissionsMapping* p = permMappings; p->string != NULL; ++p) {
+ for (const PermissionsMapping* p = permMappings; p->string != nullptr; ++p) {
if ( strcmp(p->string, s) == 0 )
return p->value;
}
@@ -348,7 +350,7 @@ DefinedAtom::ContentPermissions KeyValues::permissions(const char* s)
}
const char* KeyValues::permissions(DefinedAtom::ContentPermissions s) {
- for (const PermissionsMapping* p = permMappings; p->string != NULL; ++p) {
+ for (const PermissionsMapping* p = permMappings; p->string != nullptr; ++p) {
if ( p->value == s )
return p->string;
}
@@ -402,13 +404,13 @@ static const CanBeNullMapping cbnMappings[] = {
{ "never", UndefinedAtom::canBeNullNever },
{ "at-runtime", UndefinedAtom::canBeNullAtRuntime },
{ "at-buildtime", UndefinedAtom::canBeNullAtBuildtime },
- { NULL, UndefinedAtom::canBeNullNever }
+ { nullptr, UndefinedAtom::canBeNullNever }
};
UndefinedAtom::CanBeNull KeyValues::canBeNull(const char* s)
{
- for (const CanBeNullMapping* p = cbnMappings; p->string != NULL; ++p) {
+ for (const CanBeNullMapping* p = cbnMappings; p->string != nullptr; ++p) {
if ( strcmp(p->string, s) == 0 )
return p->value;
}
@@ -416,7 +418,7 @@ UndefinedAtom::CanBeNull KeyValues::canBeNull(const char* s)
}
const char* KeyValues::canBeNull(UndefinedAtom::CanBeNull c) {
- for (const CanBeNullMapping* p = cbnMappings; p->string != NULL; ++p) {
+ for (const CanBeNullMapping* p = cbnMappings; p->string != nullptr; ++p) {
if ( p->value == c )
return p->string;
}
View
54 lib/Core/YamlReader.cpp
@@ -43,7 +43,7 @@ class YAML {
Entry(const char *k, const char *v, std::vector<uint8_t>* vs,
int d, bool bd, bool bs)
: key(strdup(k))
- , value(v ? strdup(v) : NULL)
+ , value(v ? strdup(v) : nullptr)
, valueSequenceBytes(vs)
, depth(d)
, beginSequence(bs)
@@ -79,12 +79,12 @@ void YAML::parse(llvm::MemoryBuffer *mb, std::vector<const Entry *> &entries) {
State state = start;
char key[64];
char value[64];
- char *p = NULL;
+ char *p = nullptr;
unsigned int lineNumber = 1;
int depth = 0;
bool nextKeyIsStartOfDocument = false;
bool nextKeyIsStartOfSequence = false;
- std::vector<uint8_t>* sequenceBytes = NULL;
+ std::vector<uint8_t>* sequenceBytes = nullptr;
unsigned contentByte = 0;
for (const char *s = mb->getBufferStart(); s < mb->getBufferEnd(); ++s) {
char c = *s;
@@ -183,7 +183,7 @@ void YAML::parse(llvm::MemoryBuffer *mb, std::vector<const Entry *> &entries) {
*p++ = c;
state = inValue;
} else if (c == '\n') {
- entries.push_back(new Entry(key, "", NULL, depth,
+ entries.push_back(new Entry(key, "", nullptr, depth,
nextKeyIsStartOfDocument,
nextKeyIsStartOfSequence));
nextKeyIsStartOfSequence = false;
@@ -205,7 +205,7 @@ void YAML::parse(llvm::MemoryBuffer *mb, std::vector<const Entry *> &entries) {
case inValue:
if (c == '\n') {
*p = '\0';
- entries.push_back(new Entry(key, value, NULL, depth,
+ entries.push_back(new Entry(key, value, nullptr, depth,
nextKeyIsStartOfDocument,
nextKeyIsStartOfSequence));
nextKeyIsStartOfSequence = false;
@@ -240,7 +240,7 @@ void YAML::parse(llvm::MemoryBuffer *mb, std::vector<const Entry *> &entries) {
break;
case inValueSequenceEnd:
if (c == '\n') {
- entries.push_back(new Entry(key, NULL, sequenceBytes, depth,
+ entries.push_back(new Entry(key, nullptr, sequenceBytes, depth,
nextKeyIsStartOfDocument,
nextKeyIsStartOfSequence));
nextKeyIsStartOfSequence = false;
@@ -257,7 +257,7 @@ void YAML::parse(llvm::MemoryBuffer *mb, std::vector<const Entry *> &entries) {
class YAMLReference : public Reference {
public:
- YAMLReference() : _target(NULL), _targetName(NULL),
+ YAMLReference() : _target(nullptr), _targetName(nullptr),
_offsetInAtom(0), _addend(0), _kind(0) { }
virtual uint64_t offsetInAtom() const {
@@ -386,7 +386,7 @@ class YAMLDefinedAtom : public DefinedAtom {
}
virtual llvm::StringRef name() const {
- if ( _name == NULL )
+ if (_name == nullptr)
return llvm::StringRef();
else
return _name;
@@ -441,7 +441,7 @@ class YAMLDefinedAtom : public DefinedAtom {
}
llvm::ArrayRef<uint8_t> rawContent() const {
- if ( _content != NULL )
+ if (_content != nullptr)
return llvm::ArrayRef<uint8_t>(*_content);
else
return llvm::ArrayRef<uint8_t>();
@@ -615,7 +615,7 @@ Atom* YAMLFile::findAtom(const char* name) {
void YAMLFile::addDefinedAtom(YAMLDefinedAtom* atom, const char* refName) {
_definedAtoms._atoms.push_back(atom);
- assert(refName != NULL);
+ assert(refName != nullptr);
_nameToAtomMapping.push_back(NameAtomPair(refName, atom));
}
@@ -676,14 +676,14 @@ class YAMLAtomState {
YAMLAtomState::YAMLAtomState(Platform& platform)
: _platform(platform)
- , _name(NULL)
- , _refName(NULL)
- , _sectionName(NULL)
- , _loadName(NULL)
+ , _name(nullptr)
+ , _refName(nullptr)
+ , _sectionName(nullptr)
+ , _loadName(nullptr)
, _size(0)
, _value(0)
, _ordinal(0)
- , _content(NULL)
+ , _content(nullptr)
, _alignment(0, 0)
, _definition(KeyValues::definitionDefault)
, _scope(KeyValues::scopeDefault)
@@ -728,14 +728,14 @@ void YAMLAtomState::makeAtom(YAMLFile& f) {
}
// reset state for next atom
- _name = NULL;
- _refName = NULL;
- _sectionName = NULL;
- _loadName = NULL;
+ _name = nullptr;
+ _refName = nullptr;
+ _sectionName = nullptr;
+ _loadName = nullptr;
_size = 0;
_value = 0;
_ordinal = 0;
- _content = NULL;
+ _content = nullptr;
_alignment.powerOf2= 0;
_alignment.modulus = 0;
_definition = KeyValues::definitionDefault;
@@ -749,8 +749,8 @@ void YAMLAtomState::makeAtom(YAMLFile& f) {
_isThumb = KeyValues::isThumbDefault;
_isAlias = KeyValues::isAliasDefault;
_canBeNull = KeyValues::canBeNullDefault;
- _ref._target = NULL;
- _ref._targetName = NULL;
+ _ref._target = nullptr;
+ _ref._targetName = nullptr;
_ref._addend = 0;
_ref._offsetInAtom = 0;
_ref._kind = 0;
@@ -781,8 +781,8 @@ void YAMLAtomState::setFixupTarget(const char *s) {
void YAMLAtomState::addFixup(YAMLFile *f) {
f->_references.push_back(_ref);
// clear for next ref
- _ref._target = NULL;
- _ref._targetName = NULL;
+ _ref._target = nullptr;
+ _ref._targetName = nullptr;
_ref._addend = 0;
_ref._offsetInAtom = 0;
_ref._kind = 0;
@@ -803,7 +803,7 @@ llvm::error_code parseObjectText( llvm::MemoryBuffer *mb
std::vector<const YAML::Entry *> entries;
YAML::parse(mb, entries);
- YAMLFile *file = NULL;
+ YAMLFile *file = nullptr;
YAMLAtomState atomState(platform);
bool inAtoms = false;
bool inFixups = false;
@@ -818,7 +818,7 @@ llvm::error_code parseObjectText( llvm::MemoryBuffer *mb
const YAML::Entry *entry = *it;
if (entry->beginDocument) {
- if (file != NULL) {
+ if (file != nullptr) {
if (haveAtom) {
atomState.makeAtom(*file);
haveAtom = false;
@@ -976,7 +976,7 @@ llvm::error_code parseObjectText( llvm::MemoryBuffer *mb
if (haveAtom) {
atomState.makeAtom(*file);
}
- if ( file != NULL ) {
+ if (file != nullptr) {
file->bindTargetReferences();
result.push_back(file);
}
View
2  lib/Core/YamlWriter.cpp
@@ -333,7 +333,7 @@ class AtomWriter {
<< _platform.kindToString(ref->kind())
<< "\n";
const Atom* target = ref->target();
- if ( target != NULL ) {
+ if (target != nullptr) {
llvm::StringRef refName = target->name();
if ( _rnb.hasRefName(target) )
refName = _rnb.refName(target);
View
10 lib/Passes/GOTPass.cpp
@@ -56,14 +56,14 @@ void GOTPass::perform() {
bool canBypassGOT;
if ( _platform.isGOTAccess(ref->kind(), canBypassGOT) ) {
const Atom* target = ref->target();
- assert(target != NULL);
+ assert(target != nullptr);
const DefinedAtom* defTarget = target->definedAtom();
bool replaceTargetWithGOTAtom = false;
if ( target->definition() == Atom::definitionSharedLibrary ) {
// Accesses to shared library symbols must go through GOT.
replaceTargetWithGOTAtom = true;
}
- else if ( (defTarget != NULL)
+ else if ( (defTarget != nullptr)
&& (defTarget->interposable() != DefinedAtom::interposeNo) ) {
// Accesses to interposable symbols in same linkage unit
// must also go through GOT.
@@ -78,19 +78,19 @@ void GOTPass::perform() {
}
if ( replaceTargetWithGOTAtom ) {
// Replace the target with a reference to a GOT entry.
- const DefinedAtom* gotEntry = NULL;
+ const DefinedAtom* gotEntry = nullptr;
auto pos = targetToGOT.find(target);
if ( pos == targetToGOT.end() ) {
// This is no existing GOT entry. Create a new one.
gotEntry = _platform.makeGOTEntry(*target, _file);
- assert(gotEntry != NULL);
+ assert(gotEntry != nullptr);
assert(gotEntry->contentType() == DefinedAtom::typeGOT);
targetToGOT[target] = gotEntry;
}
else {
// Reuse an existing GOT entry.
gotEntry = pos->second;
- assert(gotEntry != NULL);
+ assert(gotEntry != nullptr);
}
// Switch reference to GOT atom.
(const_cast<Reference*>(ref))->setTarget(gotEntry);
View
6 lib/Passes/StubsPass.cpp
@@ -42,7 +42,7 @@ void StubsPass::perform() {
// Look at call-sites.
if ( _platform.isCallSite(ref->kind()) ) {
const Atom* target = ref->target();
- assert(target != NULL);
+ assert(target != nullptr);
bool replaceCalleeWithStub = false;
if ( target->definition() == Atom::definitionSharedLibrary ) {
// Calls to shared libraries go through stubs.
@@ -63,14 +63,14 @@ void StubsPass::perform() {
if ( pos == targetToStub.end() ) {
// This is no existing stub. Create a new one.
stub = _platform.makeStub(*target, _file);
- assert(stub != NULL);
+ assert(stub != nullptr);
assert(stub->contentType() == DefinedAtom::typeStub);
targetToStub[target] = stub;
}
else {
// Reuse an existing stub.
stub = pos->second;
- assert(stub != NULL);
+ assert(stub != nullptr);
}
// Switch call site to reference stub atom.
(const_cast<Reference*>(ref))->setTarget(stub);
View
30 tools/lld-core/lld-core.cpp
@@ -119,15 +119,15 @@ class TestingStubAtom : public DefinedAtom {
}
virtual reference_iterator referencesBegin() const {
- return reference_iterator(*this, NULL);
+ return reference_iterator(*this, nullptr);
}
virtual reference_iterator referencesEnd() const {
- return reference_iterator(*this, NULL);
+ return reference_iterator(*this, nullptr);
}
virtual const Reference* derefIterator(const void* iter) const {
- return NULL;
+ return nullptr;
}
virtual void incrementIterator(const void*& iter) const {
@@ -218,15 +218,15 @@ class TestingGOTAtom : public DefinedAtom {
}
virtual reference_iterator referencesBegin() const {
- return reference_iterator(*this, NULL);
+ return reference_iterator(*this, nullptr);
}
virtual reference_iterator referencesEnd() const {
- return reference_iterator(*this, NULL);
+ return reference_iterator(*this, nullptr);
}
virtual const Reference* derefIterator(const void* iter) const {
- return NULL;
+ return nullptr;
}
virtual void incrementIterator(const void*& iter) const {
@@ -283,18 +283,18 @@ class TestingPlatform : public Platform {
return false;
}
- // return entry point for output file (e.g. "main") or NULL
+ // return entry point for output file (e.g. "main") or nullptr
virtual llvm::StringRef entryPointName() {
- return NULL;
+ return nullptr;
}
// for iterating must-be-defined symbols ("main" or -u command line option)
typedef llvm::StringRef const *UndefinesIterator;
virtual UndefinesIterator initialUndefinesBegin() const {
- return NULL;
+ return nullptr;
}
virtual UndefinesIterator initialUndefinesEnd() const {
- return NULL;
+ return nullptr;
}
// if platform wants resolvers to search libraries for overrides
@@ -353,7 +353,7 @@ class TestingPlatform : public Platform {
static const KindMapping _s_kindMappings[];
virtual Reference::Kind kindFromString(llvm::StringRef kindName) {
- for (const KindMapping* p = _s_kindMappings; p->string != NULL; ++p) {
+ for (const KindMapping* p = _s_kindMappings; p->string != nullptr; ++p) {
if ( kindName.equals(p->string) )
return p->value;
}
@@ -364,7 +364,7 @@ class TestingPlatform : public Platform {
}
virtual llvm::StringRef kindToString(Reference::Kind value) {
- for (const KindMapping* p = _s_kindMappings; p->string != NULL; ++p) {
+ for (const KindMapping* p = _s_kindMappings; p->string != nullptr; ++p) {
if ( value == p->value)
return p->string;
}
@@ -376,7 +376,7 @@ class TestingPlatform : public Platform {
}
virtual bool isCallSite(Reference::Kind kind) {
- for (const KindMapping* p = _s_kindMappings; p->string != NULL; ++p) {
+ for (const KindMapping* p = _s_kindMappings; p->string != nullptr; ++p) {
if ( kind == p->value )
return p->isBranch;
}
@@ -384,7 +384,7 @@ class TestingPlatform : public Platform {
}
virtual bool isGOTAccess(Reference::Kind kind, bool& canBypassGOT) {
- for (const KindMapping* p = _s_kindMappings; p->string != NULL; ++p) {
+ for (const KindMapping* p = _s_kindMappings; p->string != nullptr; ++p) {
if ( kind == p->value ) {
canBypassGOT = p->isGotLoad;
return p->isGotUse;
@@ -422,7 +422,7 @@ const TestingPlatform::KindMapping TestingPlatform::_s_kindMappings[] = {
{ "gotLoad32", 3, false, true, true },
{ "gotUse32", 4, false, false, true },
{ "lea32wasGot", 5, false, false, false },
- { NULL, 0, false, false, false }
+ { nullptr, 0, false, false, false }
};
Please sign in to comment.
Something went wrong with that request. Please try again.