[llvm-commits] [lld] r153677 - in /lld/trunk: include/lld/Core/AbsoluteAtom.h include/lld/Core/Platform.h include/lld/Core/Reference.h include/lld/Core/SharedLibraryAtom.h include/lld/Core/SymbolTable.h include/lld/Core/UndefinedAtom.h lib/Core/NativeReader.cpp lib/Core/Resolver.cpp lib/Core/SymbolTable.cpp lib/Core/YamlKeyValues.cpp lib/Core/YamlReader.cpp lib/Core/YamlWriter.cpp lib/Passes/GOTPass.cpp lib/Passes/StubsPass.cpp tools/lld-core/lld-core.cpp
Michael J. Spencer
bigcheesegs at gmail.com
Thu Mar 29 12:39:14 PDT 2012
Author: mspencer
Date: Thu Mar 29 14:39:14 2012
New Revision: 153677
URL: http://llvm.org/viewvc/llvm-project?rev=153677&view=rev
Log:
Replace all uses of NULL with nullptr.
Modified:
lld/trunk/include/lld/Core/AbsoluteAtom.h
lld/trunk/include/lld/Core/Platform.h
lld/trunk/include/lld/Core/Reference.h
lld/trunk/include/lld/Core/SharedLibraryAtom.h
lld/trunk/include/lld/Core/SymbolTable.h
lld/trunk/include/lld/Core/UndefinedAtom.h
lld/trunk/lib/Core/NativeReader.cpp
lld/trunk/lib/Core/Resolver.cpp
lld/trunk/lib/Core/SymbolTable.cpp
lld/trunk/lib/Core/YamlKeyValues.cpp
lld/trunk/lib/Core/YamlReader.cpp
lld/trunk/lib/Core/YamlWriter.cpp
lld/trunk/lib/Passes/GOTPass.cpp
lld/trunk/lib/Passes/StubsPass.cpp
lld/trunk/tools/lld-core/lld-core.cpp
Modified: lld/trunk/include/lld/Core/AbsoluteAtom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/AbsoluteAtom.h?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/AbsoluteAtom.h (original)
+++ lld/trunk/include/lld/Core/AbsoluteAtom.h Thu Mar 29 14:39:14 2012
@@ -23,7 +23,7 @@
}
/// 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;
}
Modified: lld/trunk/include/lld/Core/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Platform.h?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Platform.h (original)
+++ lld/trunk/include/lld/Core/Platform.h Thu Mar 29 14:39:14 2012
@@ -52,7 +52,7 @@
/// @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
Modified: lld/trunk/include/lld/Core/Reference.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Reference.h?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Reference.h (original)
+++ lld/trunk/include/lld/Core/Reference.h Thu Mar 29 14:39:14 2012
@@ -48,7 +48,7 @@
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
Modified: lld/trunk/include/lld/Core/SharedLibraryAtom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/SharedLibraryAtom.h?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/SharedLibraryAtom.h (original)
+++ lld/trunk/include/lld/Core/SharedLibraryAtom.h Thu Mar 29 14:39:14 2012
@@ -27,7 +27,7 @@
}
/// 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 @@
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:
Modified: lld/trunk/include/lld/Core/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/SymbolTable.h?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/SymbolTable.h (original)
+++ lld/trunk/include/lld/Core/SymbolTable.h Thu Mar 29 14:39:14 2012
@@ -52,7 +52,7 @@
/// 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 @@
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,
Modified: lld/trunk/include/lld/Core/UndefinedAtom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/UndefinedAtom.h?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/UndefinedAtom.h (original)
+++ lld/trunk/include/lld/Core/UndefinedAtom.h Thu Mar 29 14:39:14 2012
@@ -23,23 +23,23 @@
}
/// 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)).
Modified: lld/trunk/lib/Core/NativeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/NativeReader.cpp?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/lib/Core/NativeReader.cpp (original)
+++ lld/trunk/lib/Core/NativeReader.cpp Thu Mar 29 14:39:14 2012
@@ -349,7 +349,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
struct IvarArray {
IvarArray() :
- arrayStart(NULL),
- arrayEnd(NULL),
+ arrayStart(nullptr),
+ arrayEnd(nullptr),
elementSize(0),
elementCount(0) { }
Modified: lld/trunk/lib/Core/Resolver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Resolver.cpp?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/lib/Core/Resolver.cpp (original)
+++ lld/trunk/lib/Core/Resolver.cpp Thu Mar 29 14:39:14 2012
@@ -205,7 +205,7 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
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 @@
// 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
Modified: lld/trunk/lib/Core/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/SymbolTable.cpp?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/lib/Core/SymbolTable.cpp (original)
+++ lld/trunk/lib/Core/SymbolTable.cpp Thu Mar 29 14:39:14 2012
@@ -126,7 +126,7 @@
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 @@
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 @@
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 @@
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 @@
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);
}
Modified: lld/trunk/lib/Core/YamlKeyValues.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/YamlKeyValues.cpp?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/lib/Core/YamlKeyValues.cpp (original)
+++ lld/trunk/lib/Core/YamlKeyValues.cpp Thu Mar 29 14:39:14 2012
@@ -69,12 +69,12 @@
{ "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 @@
}
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 @@
{ "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 @@
}
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 @@
{ "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 @@
}
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 @@
{ "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 @@
}
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 @@
{ "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 @@
}
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 @@
{ "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 @@
}
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 @@
{ "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 @@
}
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 @@
{ "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 @@
}
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 @@
{ "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 @@
}
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;
}
Modified: lld/trunk/lib/Core/YamlReader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/YamlReader.cpp?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/lib/Core/YamlReader.cpp (original)
+++ lld/trunk/lib/Core/YamlReader.cpp Thu Mar 29 14:39:14 2012
@@ -43,7 +43,7 @@
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 @@
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 @@
*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 @@
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 @@
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 @@
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 @@
}
virtual llvm::StringRef name() const {
- if ( _name == NULL )
+ if (_name == nullptr)
return llvm::StringRef();
else
return _name;
@@ -441,7 +441,7 @@
}
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 @@
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 @@
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 @@
}
// 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 @@
_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::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 @@
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 @@
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 @@
if (haveAtom) {
atomState.makeAtom(*file);
}
- if ( file != NULL ) {
+ if (file != nullptr) {
file->bindTargetReferences();
result.push_back(file);
}
Modified: lld/trunk/lib/Core/YamlWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/YamlWriter.cpp?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/lib/Core/YamlWriter.cpp (original)
+++ lld/trunk/lib/Core/YamlWriter.cpp Thu Mar 29 14:39:14 2012
@@ -333,7 +333,7 @@
<< _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);
Modified: lld/trunk/lib/Passes/GOTPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/GOTPass.cpp?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/lib/Passes/GOTPass.cpp (original)
+++ lld/trunk/lib/Passes/GOTPass.cpp Thu Mar 29 14:39:14 2012
@@ -56,14 +56,14 @@
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 @@
}
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);
Modified: lld/trunk/lib/Passes/StubsPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/StubsPass.cpp?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/lib/Passes/StubsPass.cpp (original)
+++ lld/trunk/lib/Passes/StubsPass.cpp Thu Mar 29 14:39:14 2012
@@ -42,7 +42,7 @@
// 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 @@
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);
Modified: lld/trunk/tools/lld-core/lld-core.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/tools/lld-core/lld-core.cpp?rev=153677&r1=153676&r2=153677&view=diff
==============================================================================
--- lld/trunk/tools/lld-core/lld-core.cpp (original)
+++ lld/trunk/tools/lld-core/lld-core.cpp Thu Mar 29 14:39:14 2012
@@ -119,15 +119,15 @@
}
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 @@
}
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 @@
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 @@
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 @@
}
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 @@
}
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 @@
}
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 @@
{ "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 }
};
More information about the llvm-commits
mailing list