diff options
Diffstat (limited to 'lld/lib/Core')
| -rw-r--r-- | lld/lib/Core/NativeReader.cpp | 28 | ||||
| -rw-r--r-- | lld/lib/Core/Resolver.cpp | 16 | ||||
| -rw-r--r-- | lld/lib/Core/SymbolTable.cpp | 16 | ||||
| -rw-r--r-- | lld/lib/Core/YamlKeyValues.cpp | 56 | ||||
| -rw-r--r-- | lld/lib/Core/YamlReader.cpp | 54 | ||||
| -rw-r--r-- | lld/lib/Core/YamlWriter.cpp | 2 |
6 files changed, 87 insertions, 85 deletions
diff --git a/lld/lib/Core/NativeReader.cpp b/lld/lib/Core/NativeReader.cpp index f3548d65620..1bb0d554979 100644 --- a/lld/lib/Core/NativeReader.cpp +++ b/lld/lib/Core/NativeReader.cpp @@ -349,7 +349,7 @@ private: 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 @@ private: 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 @@ private: 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 @@ private: 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 @@ private: 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 @@ private: 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 @@ private: 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 @@ private: struct IvarArray { IvarArray() : - arrayStart(NULL), - arrayEnd(NULL), + arrayStart(nullptr), + arrayEnd(nullptr), elementSize(0), elementCount(0) { } diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp index 617431eb68d..13541840736 100644 --- a/lld/lib/Core/Resolver.cpp +++ b/lld/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 diff --git a/lld/lib/Core/SymbolTable.cpp b/lld/lib/Core/SymbolTable.cpp index bec71006faa..277ce3b60e7 100644 --- a/lld/lib/Core/SymbolTable.cpp +++ b/lld/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); } diff --git a/lld/lib/Core/YamlKeyValues.cpp b/lld/lib/Core/YamlKeyValues.cpp index 86d2a8cd694..31f09f92e89 100644 --- a/lld/lib/Core/YamlKeyValues.cpp +++ b/lld/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; } diff --git a/lld/lib/Core/YamlReader.cpp b/lld/lib/Core/YamlReader.cpp index c4c826d6f6e..3bfa0cfe712 100644 --- a/lld/lib/Core/YamlReader.cpp +++ b/lld/lib/Core/YamlReader.cpp @@ -43,7 +43,7 @@ public: 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 @@ public: } virtual llvm::StringRef name() const { - if ( _name == NULL ) + if (_name == nullptr) return llvm::StringRef(); else return _name; @@ -441,7 +441,7 @@ public: } 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 @@ public: 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); } diff --git a/lld/lib/Core/YamlWriter.cpp b/lld/lib/Core/YamlWriter.cpp index 7f9b0c3170e..15ebe6213d2 100644 --- a/lld/lib/Core/YamlWriter.cpp +++ b/lld/lib/Core/YamlWriter.cpp @@ -333,7 +333,7 @@ public: << _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); |

