[llvm-commits] [lld] r152386 - in /lld/trunk: include/lld/Core/Atom.h lib/Core/NativeWriter.cpp
Michael J. Spencer
bigcheesegs at gmail.com
Thu Mar 8 21:26:55 PST 2012
Author: mspencer
Date: Thu Mar 8 23:26:55 2012
New Revision: 152386
URL: http://llvm.org/viewvc/llvm-project?rev=152386&view=rev
Log:
Use nullptr instead of NULL, and remove use of VLA.
Modified:
lld/trunk/include/lld/Core/Atom.h
lld/trunk/lib/Core/NativeWriter.cpp
Modified: lld/trunk/include/lld/Core/Atom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Atom.h?rev=152386&r1=152385&r2=152386&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Atom.h (original)
+++ lld/trunk/include/lld/Core/Atom.h Thu Mar 8 23:26:55 2012
@@ -54,19 +54,19 @@
/// definedAtom - like dynamic_cast, if atom is definitionRegular
/// returns atom cast to DefinedAtom*, else returns nullptr;
- virtual const DefinedAtom* definedAtom() const { return NULL; }
+ virtual const DefinedAtom* definedAtom() const { return nullptr; }
/// undefinedAtom - like dynamic_cast, if atom is definitionUndefined
- /// returns atom cast to UndefinedAtom*, else returns NULL;
- virtual const UndefinedAtom* undefinedAtom() const { return NULL; }
+ /// returns atom cast to UndefinedAtom*, else returns nullptr;
+ virtual const UndefinedAtom* undefinedAtom() const { return nullptr; }
/// sharedLibraryAtom - like dynamic_cast, if atom is definitionSharedLibrary
/// returns atom cast to SharedLibraryAtom*, else returns nullptr;
- virtual const SharedLibraryAtom* sharedLibraryAtom() const { return NULL; }
+ virtual const SharedLibraryAtom* sharedLibraryAtom() const { return nullptr; }
/// absoluteAtom - like dynamic_cast, if atom is definitionAbsolute
/// returns atom cast to AbsoluteAtom*, else returns nullptr;
- virtual const AbsoluteAtom* absoluteAtom() const { return NULL; }
+ virtual const AbsoluteAtom* absoluteAtom() const { return nullptr; }
protected:
/// Atom is an abstract base class. Only subclasses can access constructor.
Modified: lld/trunk/lib/Core/NativeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/NativeWriter.cpp?rev=152386&r1=152385&r2=152386&view=diff
==============================================================================
--- lld/trunk/lib/Core/NativeWriter.cpp (original)
+++ lld/trunk/lib/Core/NativeWriter.cpp Thu Mar 8 23:26:55 2012
@@ -446,7 +446,8 @@
void writeTargetTable(llvm::raw_ostream& out) {
// Build table of target indexes
uint32_t maxTargetIndex = _targetsTableIndex.size();
- uint32_t targetIndexes[maxTargetIndex];
+ assert(maxTargetIndex > 0);
+ std::vector<uint32_t> targetIndexes(maxTargetIndex);
for (TargetToIndex::iterator it = _targetsTableIndex.begin();
it != _targetsTableIndex.end(); ++it) {
const Atom* atom = it->first;
@@ -501,7 +502,7 @@
void writeAddendTable(llvm::raw_ostream& out) {
// Build table of addends
uint32_t maxAddendIndex = _addendsTableIndex.size();
- Reference::Addend addends[maxAddendIndex];
+ std::vector<Reference::Addend> addends(maxAddendIndex);
for (AddendToIndex::iterator it = _addendsTableIndex.begin();
it != _addendsTableIndex.end(); ++it) {
Reference::Addend addend = it->first;
More information about the llvm-commits
mailing list