[C++11] More 'nullptr' conversion or in some cases just using a boolean check instead of comparing to nullptr.

llvm-svn: 206129
This commit is contained in:
Craig Topper 2014-04-13 04:57:38 +00:00
parent f72ca1f7d5
commit bd0a634bba
53 changed files with 240 additions and 226 deletions

View File

@ -83,7 +83,7 @@ struct ilist_sentinel_traits {
/// provideInitialHead - when constructing an ilist, provide a starting
/// value for its Head
/// @return null node to indicate that it needs to be allocated later
static NodeTy *provideInitialHead() { return 0; }
static NodeTy *provideInitialHead() { return nullptr; }
/// ensureHead - make sure that Head is either already
/// initialized or assigned a fresh sentinel
@ -92,7 +92,7 @@ struct ilist_sentinel_traits {
if (!Head) {
Head = ilist_traits<NodeTy>::createSentinel();
ilist_traits<NodeTy>::noteHead(Head, Head);
ilist_traits<NodeTy>::setNext(Head, 0);
ilist_traits<NodeTy>::setNext(Head, nullptr);
return Head;
}
return ilist_traits<NodeTy>::getPrev(Head);

View File

@ -60,7 +60,7 @@ public:
// Check for sentinel.
if (!Prev->getNext())
return 0;
return nullptr;
return Prev;
}
@ -82,7 +82,7 @@ public:
// Check for sentinel.
if (!Next->getNext())
return 0;
return nullptr;
return Next;
}

View File

@ -365,7 +365,7 @@ namespace llvm {
/// specify a section to switch to if the translation unit doesn't have any
/// trampolines that require an executable stack.
virtual const MCSection *getNonexecutableStackSection(MCContext &Ctx) const{
return 0;
return nullptr;
}
virtual const MCExpr *

View File

@ -86,7 +86,7 @@ private:
/// @}
protected:
MCFragment(FragmentType _Kind, MCSectionData *_Parent = 0);
MCFragment(FragmentType _Kind, MCSectionData *_Parent = nullptr);
public:
// Only for sentinel.
@ -137,7 +137,7 @@ class MCEncodedFragment : public MCFragment {
uint8_t BundlePadding;
public:
MCEncodedFragment(MCFragment::FragmentType FType, MCSectionData *SD = 0)
MCEncodedFragment(MCFragment::FragmentType FType, MCSectionData *SD = nullptr)
: MCFragment(FType, SD), BundlePadding(0)
{
}
@ -175,7 +175,7 @@ class MCEncodedFragmentWithFixups : public MCEncodedFragment {
public:
MCEncodedFragmentWithFixups(MCFragment::FragmentType FType,
MCSectionData *SD = 0)
MCSectionData *SD = nullptr)
: MCEncodedFragment(FType, SD)
{
}
@ -215,7 +215,7 @@ class MCDataFragment : public MCEncodedFragmentWithFixups {
/// Fixups - The list of fixups in this fragment.
SmallVector<MCFixup, 4> Fixups;
public:
MCDataFragment(MCSectionData *SD = 0)
MCDataFragment(MCSectionData *SD = nullptr)
: MCEncodedFragmentWithFixups(FT_Data, SD),
HasInstructions(false), AlignToBundleEnd(false)
{
@ -264,7 +264,7 @@ class MCCompactEncodedInstFragment : public MCEncodedFragment {
SmallVector<char, 4> Contents;
public:
MCCompactEncodedInstFragment(MCSectionData *SD = 0)
MCCompactEncodedInstFragment(MCSectionData *SD = nullptr)
: MCEncodedFragment(FT_CompactEncodedInst, SD), AlignToBundleEnd(false)
{
}
@ -307,7 +307,7 @@ class MCRelaxableFragment : public MCEncodedFragmentWithFixups {
public:
MCRelaxableFragment(const MCInst &_Inst,
const MCSubtargetInfo &_STI,
MCSectionData *SD = 0)
MCSectionData *SD = nullptr)
: MCEncodedFragmentWithFixups(FT_Relaxable, SD), Inst(_Inst), STI(_STI) {
}
@ -363,7 +363,7 @@ class MCAlignFragment : public MCFragment {
public:
MCAlignFragment(unsigned _Alignment, int64_t _Value, unsigned _ValueSize,
unsigned _MaxBytesToEmit, MCSectionData *SD = 0)
unsigned _MaxBytesToEmit, MCSectionData *SD = nullptr)
: MCFragment(FT_Align, SD), Alignment(_Alignment),
Value(_Value),ValueSize(_ValueSize),
MaxBytesToEmit(_MaxBytesToEmit), EmitNops(false) {}
@ -404,7 +404,7 @@ class MCFillFragment : public MCFragment {
public:
MCFillFragment(int64_t _Value, unsigned _ValueSize, uint64_t _Size,
MCSectionData *SD = 0)
MCSectionData *SD = nullptr)
: MCFragment(FT_Fill, SD),
Value(_Value), ValueSize(_ValueSize), Size(_Size) {
assert((!ValueSize || (Size % ValueSize) == 0) &&
@ -437,7 +437,8 @@ class MCOrgFragment : public MCFragment {
int8_t Value;
public:
MCOrgFragment(const MCExpr &_Offset, int8_t _Value, MCSectionData *SD = 0)
MCOrgFragment(const MCExpr &_Offset, int8_t _Value,
MCSectionData *SD = nullptr)
: MCFragment(FT_Org, SD),
Offset(&_Offset), Value(_Value) {}
@ -466,7 +467,8 @@ class MCLEBFragment : public MCFragment {
SmallString<8> Contents;
public:
MCLEBFragment(const MCExpr &Value_, bool IsSigned_, MCSectionData *SD = 0)
MCLEBFragment(const MCExpr &Value_, bool IsSigned_,
MCSectionData *SD = nullptr)
: MCFragment(FT_LEB, SD),
Value(&Value_), IsSigned(IsSigned_) { Contents.push_back(0); }
@ -502,7 +504,7 @@ class MCDwarfLineAddrFragment : public MCFragment {
public:
MCDwarfLineAddrFragment(int64_t _LineDelta, const MCExpr &_AddrDelta,
MCSectionData *SD = 0)
MCSectionData *SD = nullptr)
: MCFragment(FT_Dwarf, SD),
LineDelta(_LineDelta), AddrDelta(&_AddrDelta) { Contents.push_back(0); }
@ -533,7 +535,8 @@ class MCDwarfCallFrameFragment : public MCFragment {
SmallString<8> Contents;
public:
MCDwarfCallFrameFragment(const MCExpr &_AddrDelta, MCSectionData *SD = 0)
MCDwarfCallFrameFragment(const MCExpr &_AddrDelta,
MCSectionData *SD = nullptr)
: MCFragment(FT_DwarfFrame, SD),
AddrDelta(&_AddrDelta) { Contents.push_back(0); }
@ -614,7 +617,7 @@ private:
public:
// Only for use as sentinel.
MCSectionData();
MCSectionData(const MCSection &Section, MCAssembler *A = 0);
MCSectionData(const MCSection &Section, MCAssembler *A = nullptr);
const MCSection &getSection() const { return *Section; }
@ -724,7 +727,7 @@ public:
// Only for use as sentinel.
MCSymbolData();
MCSymbolData(const MCSymbol &_Symbol, MCFragment *_Fragment, uint64_t _Offset,
MCAssembler *A = 0);
MCAssembler *A = nullptr);
/// @name Accessors
/// @{
@ -1184,7 +1187,7 @@ public:
}
MCSectionData &getOrCreateSectionData(const MCSection &Section,
bool *Created = 0) {
bool *Created = nullptr) {
MCSectionData *&Entry = SectionMap[&Section];
if (Created) *Created = !Entry;
@ -1195,7 +1198,7 @@ public:
}
bool hasSymbolData(const MCSymbol &Symbol) const {
return SymbolMap.lookup(&Symbol) != 0;
return SymbolMap.lookup(&Symbol) != nullptr;
}
MCSymbolData &getSymbolData(const MCSymbol &Symbol) const {
@ -1205,12 +1208,12 @@ public:
}
MCSymbolData &getOrCreateSymbolData(const MCSymbol &Symbol,
bool *Created = 0) {
bool *Created = nullptr) {
MCSymbolData *&Entry = SymbolMap[&Symbol];
if (Created) *Created = !Entry;
if (!Entry)
Entry = new MCSymbolData(Symbol, 0, 0, this);
Entry = new MCSymbolData(Symbol, nullptr, 0, this);
return *Entry;
}

View File

@ -171,8 +171,8 @@ namespace llvm {
public:
explicit MCContext(const MCAsmInfo *MAI, const MCRegisterInfo *MRI,
const MCObjectFileInfo *MOFI, const SourceMgr *Mgr = 0,
bool DoAutoReset = true);
const MCObjectFileInfo *MOFI,
const SourceMgr *Mgr = nullptr, bool DoAutoReset = true);
~MCContext();
const SourceMgr *getSourceManager() const { return SrcMgr; }
@ -272,7 +272,7 @@ namespace llvm {
SectionKind Kind,
StringRef COMDATSymName,
int Selection,
const MCSectionCOFF *Assoc = 0);
const MCSectionCOFF *Assoc = nullptr);
const MCSectionCOFF *getCOFFSection(StringRef Section,
unsigned Characteristics,

View File

@ -57,7 +57,7 @@ public:
/// Constructor - Performs initial setup for the disassembler.
MCDisassembler(const MCSubtargetInfo &STI)
: STI(STI), Symbolizer(), CommentStream(0) {}
: STI(STI), Symbolizer(), CommentStream(nullptr) {}
virtual ~MCDisassembler();

View File

@ -464,9 +464,9 @@ public:
struct MCDwarfFrameInfo {
MCDwarfFrameInfo()
: Begin(0), End(0), Personality(0), Lsda(0), Function(0), Instructions(),
PersonalityEncoding(), LsdaEncoding(0), CompactUnwindEncoding(0),
IsSignalFrame(false), IsSimple(false) {}
: Begin(nullptr), End(nullptr), Personality(nullptr), Lsda(nullptr),
Function(nullptr), Instructions(), PersonalityEncoding(), LsdaEncoding(0),
CompactUnwindEncoding(0), IsSignalFrame(false), IsSimple(false) {}
MCSymbol *Begin;
MCSymbol *End;
const MCSymbol *Personality;

View File

@ -68,7 +68,7 @@ public:
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override;
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0) override;
void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment = 0) override;

View File

@ -184,18 +184,18 @@ public:
/// \brief Dump the MCInst as prettily as possible using the additional MC
/// structures, if given. Operators are separated by the \p Separator
/// string.
void dump_pretty(raw_ostream &OS, const MCAsmInfo *MAI = 0,
const MCInstPrinter *Printer = 0,
void dump_pretty(raw_ostream &OS, const MCAsmInfo *MAI = nullptr,
const MCInstPrinter *Printer = nullptr,
StringRef Separator = " ") const;
};
inline raw_ostream& operator<<(raw_ostream &OS, const MCOperand &MO) {
MO.print(OS, 0);
MO.print(OS, nullptr);
return OS;
}
inline raw_ostream& operator<<(raw_ostream &OS, const MCInst &MI) {
MI.print(OS, 0);
MI.print(OS, nullptr);
return OS;
}

View File

@ -57,8 +57,9 @@ protected:
public:
MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii,
const MCRegisterInfo &mri)
: CommentStream(0), MAI(mai), MII(mii), MRI(mri), AvailableFeatures(0),
UseMarkup(0), PrintImmHex(0), PrintHexStyle(HexStyle::C) {}
: CommentStream(nullptr), MAI(mai), MII(mii), MRI(mri),
AvailableFeatures(0), UseMarkup(0), PrintImmHex(0),
PrintHexStyle(HexStyle::C) {}
virtual ~MCInstPrinter();

View File

@ -504,7 +504,7 @@ public:
/// \brief Return the number of implicit uses this instruction has.
unsigned getNumImplicitUses() const {
if (ImplicitUses == 0) return 0;
if (!ImplicitUses) return 0;
unsigned i = 0;
for (; ImplicitUses[i]; ++i) /*empty*/;
return i;
@ -526,7 +526,7 @@ public:
/// \brief Return the number of implicit defs this instruct has.
unsigned getNumImplicitDefs() const {
if (ImplicitDefs == 0) return 0;
if (!ImplicitDefs) return 0;
unsigned i = 0;
for (; ImplicitDefs[i]; ++i) /*empty*/;
return i;
@ -544,7 +544,7 @@ public:
/// \brief Return true if this instruction implicitly
/// defines the specified physical register.
bool hasImplicitDefOfPhysReg(unsigned Reg,
const MCRegisterInfo *MRI = 0) const {
const MCRegisterInfo *MRI = nullptr) const {
if (const uint16_t *ImpDefs = ImplicitDefs)
for (; *ImpDefs; ++ImpDefs)
if (*ImpDefs == Reg || (MRI && MRI->isSubRegister(Reg, *ImpDefs)))

View File

@ -119,8 +119,8 @@ public:
/// Ctors.
///
InstrItineraryData() : SchedModel(&MCSchedModel::DefaultSchedModel),
Stages(0), OperandCycles(0),
Forwardings(0), Itineraries(0) {}
Stages(nullptr), OperandCycles(nullptr),
Forwardings(nullptr), Itineraries(nullptr) {}
InstrItineraryData(const MCSchedModel *SM, const InstrStage *S,
const unsigned *OS, const unsigned *F)
@ -129,7 +129,7 @@ public:
/// isEmpty - Returns true if there are no itineraries.
///
bool isEmpty() const { return Itineraries == 0; }
bool isEmpty() const { return Itineraries == nullptr; }
/// isEndMarker - Returns true if the index is for the end marker
/// itinerary.

View File

@ -191,7 +191,7 @@ public:
protected:
/// Create an invalid iterator. Call init() to point to something useful.
DiffListIterator() : Val(0), List(0) {}
DiffListIterator() : Val(0), List(nullptr) {}
/// init - Point the iterator to InitVal, decoding subsequent values from
/// DiffList. The iterator will initially point to InitVal, sub-classes are
@ -223,7 +223,7 @@ public:
void operator++() {
// The end of the list is encoded as a 0 differential.
if (!advance())
List = 0;
List = nullptr;
}
};

View File

@ -201,10 +201,9 @@ public:
LoadLatency(DefaultLoadLatency),
HighLatency(DefaultHighLatency),
MispredictPenalty(DefaultMispredictPenalty),
CompleteModel(true),
ProcID(0), ProcResourceTable(0), SchedClassTable(0),
NumProcResourceKinds(0), NumSchedClasses(0),
InstrItineraries(0) {
CompleteModel(true), ProcID(0), ProcResourceTable(nullptr),
SchedClassTable(nullptr), NumProcResourceKinds(0),
NumSchedClasses(0), InstrItineraries(nullptr) {
(void)NumProcResourceKinds;
(void)NumSchedClasses;
}

View File

@ -58,7 +58,7 @@ class MCSymbol;
assert ((Characteristics & 0x00F00000) == 0 &&
"alignment must not be set upon section creation");
assert ((Selection == COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE) ==
(Assoc != 0) &&
(Assoc != nullptr) &&
"associative COMDAT section must have an associated section");
}
~MCSectionCOFF();
@ -79,7 +79,8 @@ class MCSymbol;
int getSelection() const { return Selection; }
const MCSectionCOFF *getAssocSection() const { return Assoc; }
void setSelection(int Selection, const MCSectionCOFF *Assoc = 0) const;
void setSelection(int Selection,
const MCSectionCOFF *Assoc = nullptr) const;
void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS,
const MCExpr *Subsection) const override;

View File

@ -332,7 +332,8 @@ public:
/// @p Section. This is required to update CurSection.
///
/// This corresponds to assembler directives like .section, .text, etc.
void SwitchSection(const MCSection *Section, const MCExpr *Subsection = 0) {
void SwitchSection(const MCSection *Section,
const MCExpr *Subsection = nullptr) {
assert(Section && "Cannot switch to a null section!");
MCSectionSubPair curSection = SectionStack.back().first;
SectionStack.back().second = curSection;
@ -346,7 +347,7 @@ public:
/// emitted to @p Section. This is required to update CurSection. This
/// version does not call ChangeSection.
void SwitchSectionNoChange(const MCSection *Section,
const MCExpr *Subsection = 0) {
const MCExpr *Subsection = nullptr) {
assert(Section && "Cannot switch to a null section!");
MCSectionSubPair curSection = SectionStack.back().first;
SectionStack.back().second = curSection;
@ -495,8 +496,9 @@ public:
/// @param Size - The size of the zerofill symbol.
/// @param ByteAlignment - The alignment of the zerofill symbol if
/// non-zero. This must be a power of 2 on some targets.
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
uint64_t Size = 0, unsigned ByteAlignment = 0) = 0;
virtual void EmitZerofill(const MCSection *Section,
MCSymbol *Symbol = nullptr, uint64_t Size = 0,
unsigned ByteAlignment = 0) = 0;
/// EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol.
///

View File

@ -60,7 +60,7 @@ namespace llvm {
friend class MCExpr;
friend class MCContext;
MCSymbol(StringRef name, bool isTemporary)
: Name(name), Section(0), Value(0),
: Name(name), Section(nullptr), Value(nullptr),
IsTemporary(isTemporary), IsUsed(false) {}
MCSymbol(const MCSymbol&) LLVM_DELETED_FUNCTION;
@ -87,7 +87,7 @@ namespace llvm {
///
/// Defined symbols are either absolute or in some section.
bool isDefined() const {
return Section != 0;
return Section != nullptr;
}
/// isInSection - Check if this symbol is defined in some section (i.e., it
@ -118,7 +118,7 @@ namespace llvm {
/// setUndefined - Mark the symbol as undefined.
void setUndefined() {
Section = 0;
Section = nullptr;
}
/// setAbsolute - Mark the symbol as absolute.
@ -130,7 +130,7 @@ namespace llvm {
/// isVariable - Check if this is a variable symbol.
bool isVariable() const {
return Value != 0;
return Value != nullptr;
}
/// getVariableValue() - Get the value for variable symbols.

View File

@ -61,7 +61,8 @@ public:
/// dump - Print the value to stderr.
void dump() const;
static MCValue get(const MCSymbolRefExpr *SymA, const MCSymbolRefExpr *SymB=0,
static MCValue get(const MCSymbolRefExpr *SymA,
const MCSymbolRefExpr *SymB = nullptr,
int64_t Val = 0, uint32_t RefKind = 0) {
MCValue R;
assert((!SymB || SymA) && "Invalid relocatable MCValue!");
@ -75,8 +76,8 @@ public:
static MCValue get(int64_t Val) {
MCValue R;
R.Cst = Val;
R.SymA = 0;
R.SymB = 0;
R.SymA = nullptr;
R.SymB = nullptr;
R.RefKind = 0;
return R;
}

View File

@ -61,11 +61,11 @@ namespace llvm {
};
struct MCWin64EHUnwindInfo {
MCWin64EHUnwindInfo() : Begin(0), End(0), ExceptionHandler(0),
Function(0), PrologEnd(0), Symbol(0),
HandlesUnwind(false), HandlesExceptions(false),
LastFrameInst(-1), ChainedParent(0),
Instructions() {}
MCWin64EHUnwindInfo()
: Begin(nullptr), End(nullptr),ExceptionHandler(nullptr),
Function(nullptr), PrologEnd(nullptr), Symbol(nullptr),
HandlesUnwind(false), HandlesExceptions(false), LastFrameInst(-1),
ChainedParent(nullptr), Instructions() {}
MCSymbol *Begin;
MCSymbol *End;
const MCSymbol *ExceptionHandler;

View File

@ -128,7 +128,8 @@ public:
/// @param Source The data to create the Binary from. Ownership is transferred
/// to the Binary if successful. If an error is returned,
/// Source is destroyed by createBinary before returning.
ErrorOr<Binary *> createBinary(MemoryBuffer *Source, LLVMContext *Context = 0);
ErrorOr<Binary *> createBinary(MemoryBuffer *Source,
LLVMContext *Context = nullptr);
ErrorOr<Binary *> createBinary(StringRef Path);
}

View File

@ -65,7 +65,7 @@ public:
typedef value_type *pointer;
/// \brief Default construct iterator.
ELFEntityIterator() : EntitySize(0), Current(0) {}
ELFEntityIterator() : EntitySize(0), Current(nullptr) {}
ELFEntityIterator(uintX_t EntSize, const char *Start)
: EntitySize(EntSize), Current(Start) {}
@ -249,7 +249,7 @@ private:
/// \brief Represents a region described by entries in the .dynamic table.
struct DynRegionInfo {
DynRegionInfo() : Addr(0), Size(0), EntSize(0) {}
DynRegionInfo() : Addr(nullptr), Size(0), EntSize(0) {}
/// \brief Address in current address space.
const void *Addr;
/// \brief Size in bytes of the region.
@ -273,19 +273,19 @@ private:
public:
// If the integer is 0, this is an Elf_Verdef*.
// If the integer is 1, this is an Elf_Vernaux*.
VersionMapEntry() : PointerIntPair<const void*, 1>(NULL, 0) { }
VersionMapEntry() : PointerIntPair<const void*, 1>(nullptr, 0) { }
VersionMapEntry(const Elf_Verdef *verdef)
: PointerIntPair<const void*, 1>(verdef, 0) { }
VersionMapEntry(const Elf_Vernaux *vernaux)
: PointerIntPair<const void*, 1>(vernaux, 1) { }
bool isNull() const { return getPointer() == NULL; }
bool isNull() const { return getPointer() == nullptr; }
bool isVerdef() const { return !isNull() && getInt() == 0; }
bool isVernaux() const { return !isNull() && getInt() == 1; }
const Elf_Verdef *getVerdef() const {
return isVerdef() ? (const Elf_Verdef*)getPointer() : NULL;
return isVerdef() ? (const Elf_Verdef*)getPointer() : nullptr;
}
const Elf_Vernaux *getVernaux() const {
return isVernaux() ? (const Elf_Vernaux*)getPointer() : NULL;
return isVernaux() ? (const Elf_Vernaux*)getPointer() : nullptr;
}
};
mutable SmallVector<VersionMapEntry, 16> VersionMap;
@ -338,7 +338,7 @@ public:
if (DynSymRegion.Addr)
return Elf_Sym_Iter(DynSymRegion.EntSize, (const char *)DynSymRegion.Addr,
true);
return Elf_Sym_Iter(0, 0, true);
return Elf_Sym_Iter(0, nullptr, true);
}
Elf_Sym_Iter end_dynamic_symbols() const {
@ -346,7 +346,7 @@ public:
return Elf_Sym_Iter(DynSymRegion.EntSize,
(const char *)DynSymRegion.Addr + DynSymRegion.Size,
true);
return Elf_Sym_Iter(0, 0, true);
return Elf_Sym_Iter(0, nullptr, true);
}
Elf_Rela_Iter begin_rela(const Elf_Shdr *sec) const {
@ -478,7 +478,7 @@ void ELFFile<ELFT>::LoadVersionNeeds(const Elf_Shdr *sec) const {
template <class ELFT>
void ELFFile<ELFT>::LoadVersionMap() const {
// If there is no dynamic symtab or version table, there is nothing to do.
if (DynSymRegion.Addr == NULL || dot_gnu_version_sec == NULL)
if (!DynSymRegion.Addr || !dot_gnu_version_sec)
return;
// Has the VersionMap already been loaded?
@ -510,7 +510,7 @@ ELFFile<ELFT>::getSection(const Elf_Sym *symb) const {
if (symb->st_shndx == ELF::SHN_XINDEX)
return getSection(ExtendedSymbolTable.lookup(symb));
if (symb->st_shndx >= ELF::SHN_LORESERVE)
return 0;
return nullptr;
return getSection(symb->st_shndx);
}
@ -612,7 +612,7 @@ ELFFile<ELFT>::ELFFile(MemoryBuffer *Object, error_code &ec)
dot_gnu_version_sec(0),
dot_gnu_version_r_sec(0),
dot_gnu_version_d_sec(0),
dt_soname(0) {
dt_soname(nullptr) {
const uint64_t FileSize = Buf->getBufferSize();
if (sizeof(Elf_Ehdr) > FileSize)
@ -761,7 +761,7 @@ typename ELFFile<ELFT>::Elf_Shdr_Iter ELFFile<ELFT>::end_sections() const {
template <class ELFT>
typename ELFFile<ELFT>::Elf_Sym_Iter ELFFile<ELFT>::begin_symbols() const {
if (!dot_symtab_sec)
return Elf_Sym_Iter(0, 0, false);
return Elf_Sym_Iter(0, nullptr, false);
return Elf_Sym_Iter(dot_symtab_sec->sh_entsize,
(const char *)base() + dot_symtab_sec->sh_offset, false);
}
@ -842,7 +842,7 @@ template <class ELFT>
const typename ELFFile<ELFT>::Elf_Shdr *
ELFFile<ELFT>::getSection(uint32_t index) const {
if (index == 0)
return 0;
return nullptr;
if (!SectionHeaderTable || index >= getNumSections())
// FIXME: Proper error handling.
report_fatal_error("Invalid section index!");
@ -871,7 +871,7 @@ const char *ELFFile<ELFT>::getString(const Elf_Shdr *section,
template <class ELFT>
const char *ELFFile<ELFT>::getDynamicString(uintX_t Offset) const {
if (!DynStrRegion.Addr || Offset >= DynStrRegion.Size)
return 0;
return nullptr;
return (const char *)DynStrRegion.Addr + Offset;
}
@ -913,7 +913,7 @@ ErrorOr<StringRef> ELFFile<ELFT>::getSymbolVersion(const Elf_Shdr *section,
const Elf_Sym *symb,
bool &IsDefault) const {
// Handle non-dynamic symbols.
if (section != DynSymRegion.Addr && section != 0) {
if (section != DynSymRegion.Addr && section != nullptr) {
// Non-dynamic symbols can have versions in their names
// A name of the form 'foo@V1' indicates version 'V1', non-default.
// A name of the form 'foo@@V2' indicates version 'V2', default version.
@ -937,7 +937,7 @@ ErrorOr<StringRef> ELFFile<ELFT>::getSymbolVersion(const Elf_Shdr *section,
}
// This is a dynamic symbol. Look in the GNU symbol version table.
if (dot_gnu_version_sec == NULL) {
if (!dot_gnu_version_sec) {
// No version table.
IsDefault = false;
return StringRef("");

View File

@ -31,7 +31,7 @@ class DiceRef {
const ObjectFile *OwningObject;
public:
DiceRef() : OwningObject(NULL) { }
DiceRef() : OwningObject(nullptr) { }
DiceRef(DataRefImpl DiceP, const ObjectFile *Owner);

View File

@ -38,7 +38,7 @@ class RelocationRef {
const ObjectFile *OwningObject;
public:
RelocationRef() : OwningObject(NULL) { }
RelocationRef() : OwningObject(nullptr) { }
RelocationRef(DataRefImpl RelocationP, const ObjectFile *Owner);
@ -82,7 +82,7 @@ class SectionRef {
const ObjectFile *OwningObject;
public:
SectionRef() : OwningObject(NULL) { }
SectionRef() : OwningObject(nullptr) { }
SectionRef(DataRefImpl SectionP, const ObjectFile *Owner);
@ -184,7 +184,7 @@ class LibraryRef {
const ObjectFile *OwningObject;
public:
LibraryRef() : OwningObject(NULL) { }
LibraryRef() : OwningObject(nullptr) { }
LibraryRef(DataRefImpl LibraryP, const ObjectFile *Owner);

View File

@ -90,7 +90,7 @@ public:
// (e.g. section symbols)
};
BasicSymbolRef() : OwningObject(NULL) { }
BasicSymbolRef() : OwningObject(nullptr) { }
BasicSymbolRef(DataRefImpl SymbolP, const SymbolicFile *Owner);
bool operator==(const BasicSymbolRef &Other) const;
@ -147,7 +147,8 @@ public:
LLVMContext *Context);
static ErrorOr<SymbolicFile *> createSymbolicFile(MemoryBuffer *Object) {
return createSymbolicFile(Object, true, sys::fs::file_magic::unknown, 0);
return createSymbolicFile(Object, true, sys::fs::file_magic::unknown,
nullptr);
}
static ErrorOr<SymbolicFile *> createSymbolicFile(StringRef ObjectPath);

View File

@ -541,7 +541,7 @@ public:
}
document_iterator operator ++() {
assert(Doc != 0 && "incrementing iterator past the end.");
assert(Doc && "incrementing iterator past the end.");
if (!(*Doc)->skip()) {
Doc->reset(nullptr);
} else {

View File

@ -176,7 +176,8 @@ struct has_ScalarEnumerationTraits
static double test(...);
public:
static bool const value = (sizeof(test<ScalarEnumerationTraits<T> >(0)) == 1);
static bool const value =
(sizeof(test<ScalarEnumerationTraits<T> >(nullptr)) == 1);
};
@ -232,7 +233,7 @@ struct has_MappingTraits
static double test(...);
public:
static bool const value = (sizeof(test<MappingTraits<T> >(0)) == 1);
static bool const value = (sizeof(test<MappingTraits<T> >(nullptr)) == 1);
};
// Test if MappingTraits<T>::validate() is defined on type T.
@ -266,7 +267,7 @@ struct has_SequenceMethodTraits
static double test(...);
public:
static bool const value = (sizeof(test<SequenceTraits<T> >(0)) == 1);
static bool const value = (sizeof(test<SequenceTraits<T> >(nullptr)) == 1);
};
@ -296,7 +297,7 @@ struct has_FlowTraits<T, true>
static char (&f(...))[2];
public:
static bool const value = sizeof(f<Derived>(0)) == 2;
static bool const value = sizeof(f<Derived>(nullptr)) == 2;
};

View File

@ -509,8 +509,8 @@ uint64_t ELFObjectWriter::SymbolValue(MCSymbolData &OrigData,
Symbol = &A->getSymbol();
Data = &Layout.getAssembler().getSymbolData(*Symbol);
} else {
Symbol = 0;
Data = 0;
Symbol = nullptr;
Data = nullptr;
}
}

View File

@ -61,8 +61,8 @@ MCAsmInfo::MCAsmInfo() {
UsesELFSectionDirectiveForBSS = false;
AlignmentIsInBytes = true;
TextAlignFillValue = 0;
GPRel64Directive = 0;
GPRel32Directive = 0;
GPRel64Directive = nullptr;
GPRel32Directive = nullptr;
GlobalDirective = "\t.globl\t";
HasSetDirective = true;
HasAggressiveSymbolFolding = true;
@ -72,7 +72,7 @@ MCAsmInfo::MCAsmInfo() {
HasSingleParameterDotFile = true;
HasIdentDirective = false;
HasNoDeadStrip = false;
WeakRefDirective = 0;
WeakRefDirective = nullptr;
HasWeakDefDirective = false;
HasWeakDefCanBeHiddenDirective = false;
HasLinkOnceDirective = false;

View File

@ -167,7 +167,7 @@ public:
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override;
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0) override;
void EmitTBSSSymbol (const MCSection *Section, MCSymbol *Symbol,
@ -560,7 +560,7 @@ void MCAsmStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {
// Common symbols do not belong to any actual section.
AssignSection(Symbol, NULL);
AssignSection(Symbol, nullptr);
OS << "\t.comm\t" << *Symbol << ',' << Size;
if (ByteAlignment != 0) {
@ -579,7 +579,7 @@ void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
void MCAsmStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlign) {
// Common symbols do not belong to any actual section.
AssignSection(Symbol, NULL);
AssignSection(Symbol, nullptr);
OS << "\t.lcomm\t" << *Symbol << ',' << Size;
if (ByteAlign > 1) {
@ -610,7 +610,7 @@ void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
const MCSectionMachO *MOSection = ((const MCSectionMachO*)Section);
OS << MOSection->getSegmentName() << "," << MOSection->getSectionName();
if (Symbol != NULL) {
if (Symbol) {
OS << ',' << *Symbol << ',' << Size;
if (ByteAlignment != 0)
OS << ',' << Log2_32(ByteAlignment);
@ -625,7 +625,7 @@ void MCAsmStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) {
AssignSection(Symbol, Section);
assert(Symbol != NULL && "Symbol shouldn't be NULL!");
assert(Symbol && "Symbol shouldn't be NULL!");
// Instead of using the Section we'll just use the shortcut.
// This is a mach-o specific directive and section.
OS << ".tbss " << *Symbol << ", " << Size;
@ -706,7 +706,7 @@ void MCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size) {
assert(Size <= 8 && "Invalid size");
assert(getCurrentSection().first &&
"Cannot emit contents before setting section!");
const char *Directive = 0;
const char *Directive = nullptr;
switch (Size) {
default: break;
case 1: Directive = MAI->getData8bitsDirective(); break;
@ -775,13 +775,13 @@ void MCAsmStreamer::EmitSLEB128Value(const MCExpr *Value) {
}
void MCAsmStreamer::EmitGPRel64Value(const MCExpr *Value) {
assert(MAI->getGPRel64Directive() != 0);
assert(MAI->getGPRel64Directive() != nullptr);
OS << MAI->getGPRel64Directive() << *Value;
EmitEOL();
}
void MCAsmStreamer::EmitGPRel32Value(const MCExpr *Value) {
assert(MAI->getGPRel32Directive() != 0);
assert(MAI->getGPRel32Directive() != nullptr);
OS << MAI->getGPRel32Directive() << *Value;
EmitEOL();
}
@ -1464,7 +1464,7 @@ MCSymbolData &MCAsmStreamer::getOrCreateSymbolData(const MCSymbol *Symbol) {
MCSymbolData *&Entry = SymbolMap[Symbol];
if (!Entry)
Entry = new MCSymbolData(*Symbol, 0, 0, 0);
Entry = new MCSymbolData(*Symbol, nullptr, 0, nullptr);
return *Entry;
}

View File

@ -212,7 +212,7 @@ MCFragment::~MCFragment() {
}
MCFragment::MCFragment(FragmentType _Kind, MCSectionData *_Parent)
: Kind(_Kind), Parent(_Parent), Atom(0), Offset(~UINT64_C(0))
: Kind(_Kind), Parent(_Parent), Atom(nullptr), Offset(~UINT64_C(0))
{
if (Parent)
Parent->getFragmentList().push_back(this);
@ -230,7 +230,7 @@ MCEncodedFragmentWithFixups::~MCEncodedFragmentWithFixups() {
/* *** */
MCSectionData::MCSectionData() : Section(0) {}
MCSectionData::MCSectionData() : Section(nullptr) {}
MCSectionData::MCSectionData(const MCSection &_Section, MCAssembler *A)
: Section(&_Section),
@ -250,7 +250,7 @@ MCSectionData::getSubsectionInsertionPoint(unsigned Subsection) {
SmallVectorImpl<std::pair<unsigned, MCFragment *> >::iterator MI =
std::lower_bound(SubsectionFragmentMap.begin(), SubsectionFragmentMap.end(),
std::make_pair(Subsection, (MCFragment *)0));
std::make_pair(Subsection, (MCFragment *)nullptr));
bool ExactMatch = false;
if (MI != SubsectionFragmentMap.end()) {
ExactMatch = MI->first == Subsection;
@ -275,13 +275,13 @@ MCSectionData::getSubsectionInsertionPoint(unsigned Subsection) {
/* *** */
MCSymbolData::MCSymbolData() : Symbol(0) {}
MCSymbolData::MCSymbolData() : Symbol(nullptr) {}
MCSymbolData::MCSymbolData(const MCSymbol &_Symbol, MCFragment *_Fragment,
uint64_t _Offset, MCAssembler *A)
: Symbol(&_Symbol), Fragment(_Fragment), Offset(_Offset),
IsExternal(false), IsPrivateExtern(false),
CommonSize(0), SymbolSize(0), CommonAlign(0),
CommonSize(0), SymbolSize(nullptr), CommonAlign(0),
Flags(0), Index(0)
{
if (A)
@ -342,13 +342,13 @@ const MCSymbolData *MCAssembler::getAtom(const MCSymbolData *SD) const {
// Absolute and undefined symbols have no defining atom.
if (!SD->getFragment())
return 0;
return nullptr;
// Non-linker visible symbols in sections which can't be atomized have no
// defining atom.
if (!getBackend().isSectionAtomizable(
SD->getFragment()->getParent()->getSection()))
return 0;
return nullptr;
// Otherwise, return the atom for the containing fragment.
return SD->getFragment()->getAtom();
@ -948,7 +948,7 @@ bool MCAssembler::layoutSectionOnce(MCAsmLayout &Layout, MCSectionData &SD) {
// remain NULL if none were relaxed.
// When a fragment is relaxed, all the fragments following it should get
// invalidated because their offset is going to change.
MCFragment *FirstRelaxedFragment = NULL;
MCFragment *FirstRelaxedFragment = nullptr;
// Attempt to relax all the fragments in the section.
for (MCSectionData::iterator I = SD.begin(), IE = SD.end(); I != IE; ++I) {

View File

@ -44,7 +44,7 @@ MCContext::MCContext(const MCAsmInfo *mai, const MCRegisterInfo *mri,
CompilationDir.clear();
SecureLogFile = getenv("AS_SECURE_LOG_FILE");
SecureLog = 0;
SecureLog = nullptr;
SecureLogUsed = false;
if (SrcMgr && SrcMgr->getNumBuffers() > 0)
@ -250,7 +250,7 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
SectionKind Kind, unsigned EntrySize, StringRef Group) {
// Do the lookup, if we have a hit, return it.
auto IterBool = ELFUniquingMap.insert(
std::make_pair(SectionGroupPair(Section, Group), (MCSectionELF *)0));
std::make_pair(SectionGroupPair(Section, Group), nullptr));
auto &Entry = *IterBool.first;
if (!IterBool.second) return Entry.second;
@ -259,7 +259,7 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
EntrySize = MCSectionELF::DetermineEntrySize(Kind);
}
MCSymbol *GroupSym = NULL;
MCSymbol *GroupSym = nullptr;
if (!Group.empty())
GroupSym = GetOrCreateSymbol(Group);
@ -273,7 +273,7 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
const MCSectionELF *MCContext::CreateELFGroupSection() {
MCSectionELF *Result =
new (*this) MCSectionELF(".group", ELF::SHT_GROUP, 0,
SectionKind::getReadOnly(), 4, NULL);
SectionKind::getReadOnly(), 4, nullptr);
return Result;
}
@ -284,12 +284,12 @@ MCContext::getCOFFSection(StringRef Section, unsigned Characteristics,
// Do the lookup, if we have a hit, return it.
SectionGroupPair P(Section, COMDATSymName);
auto IterBool = COFFUniquingMap.insert(std::make_pair(P, (MCSectionCOFF *)0));
auto IterBool = COFFUniquingMap.insert(std::make_pair(P, nullptr));
auto Iter = IterBool.first;
if (!IterBool.second)
return Iter->second;
const MCSymbol *COMDATSymbol = NULL;
const MCSymbol *COMDATSymbol = nullptr;
if (!COMDATSymName.empty())
COMDATSymbol = GetOrCreateSymbol(COMDATSymName);
@ -311,7 +311,7 @@ const MCSectionCOFF *MCContext::getCOFFSection(StringRef Section) {
SectionGroupPair P(Section, "");
auto Iter = COFFUniquingMap.find(P);
if (Iter == COFFUniquingMap.end())
return 0;
return nullptr;
return Iter->second;
}

View File

@ -122,7 +122,7 @@ EmitDwarfLineTable(MCStreamer *MCOS, const MCSection *Section,
unsigned Flags = DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT : 0;
unsigned Isa = 0;
unsigned Discriminator = 0;
MCSymbol *LastLabel = NULL;
MCSymbol *LastLabel = nullptr;
// Loop through each MCLineEntry and encode the dwarf line number table.
for (auto it = LineEntries.begin(),
@ -779,8 +779,8 @@ void MCGenDwarfInfo::Emit(MCStreamer *MCOS) {
MCSymbol *LineSectionSymbol = nullptr;
if (CreateDwarfSectionSymbols)
LineSectionSymbol = MCOS->getDwarfLineTableSymbol(0);
MCSymbol *AbbrevSectionSymbol = NULL;
MCSymbol *InfoSectionSymbol = NULL;
MCSymbol *AbbrevSectionSymbol = nullptr;
MCSymbol *InfoSectionSymbol = nullptr;
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfInfoSection());
if (CreateDwarfSectionSymbols) {
InfoSectionSymbol = context.CreateTempSymbol();
@ -882,7 +882,7 @@ static unsigned getSizeForEncoding(MCStreamer &streamer,
static void EmitFDESymbol(MCStreamer &streamer, const MCSymbol &symbol,
unsigned symbolEncoding, bool isEH,
const char *comment = 0) {
const char *comment = nullptr) {
MCContext &context = streamer.getContext();
const MCAsmInfo *asmInfo = context.getAsmInfo();
const MCExpr *v = asmInfo->getExprForFDESymbol(&symbol,
@ -917,7 +917,7 @@ namespace {
public:
FrameEmitterImpl(bool usingCFI, bool isEH)
: CFAOffset(0), CIENum(0), UsingCFI(usingCFI), IsEH(isEH),
SectionStart(0) {}
SectionStart(nullptr) {}
void setSectionStart(const MCSymbol *Label) { SectionStart = Label; }
@ -1344,7 +1344,7 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(MCStreamer &streamer,
if (!IsSimple) {
const std::vector<MCCFIInstruction> &Instructions =
MAI->getInitialFrameState();
EmitCFIInstructions(streamer, Instructions, NULL);
EmitCFIInstructions(streamer, Instructions, nullptr);
}
// Padding
@ -1431,8 +1431,12 @@ MCSymbol *FrameEmitterImpl::EmitFDE(MCStreamer &streamer,
namespace {
struct CIEKey {
static const CIEKey getEmptyKey() { return CIEKey(0, 0, -1, false, false); }
static const CIEKey getTombstoneKey() { return CIEKey(0, -1, 0, false, false); }
static const CIEKey getEmptyKey() {
return CIEKey(nullptr, 0, -1, false, false);
}
static const CIEKey getTombstoneKey() {
return CIEKey(nullptr, -1, 0, false, false);
}
CIEKey(const MCSymbol* Personality_, unsigned PersonalityEncoding_,
unsigned LsdaEncoding_, bool IsSignalFrame_, bool IsSimple_) :
@ -1514,10 +1518,10 @@ void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer, MCAsmBackend *MAB,
Streamer.EmitLabel(SectionStart);
Emitter.setSectionStart(SectionStart);
MCSymbol *FDEEnd = NULL;
MCSymbol *FDEEnd = nullptr;
DenseMap<CIEKey, const MCSymbol*> CIEStarts;
const MCSymbol *DummyDebugKey = NULL;
const MCSymbol *DummyDebugKey = nullptr;
NeedsEHFrameSection = !MOFI->getSupportsCompactUnwindWithoutEHFrame();
for (unsigned i = 0, n = FrameArray.size(); i < n; ++i) {
const MCDwarfFrameInfo &Frame = FrameArray[i];
@ -1525,7 +1529,7 @@ void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer, MCAsmBackend *MAB,
// Emit the label from the previous iteration
if (FDEEnd) {
Streamer.EmitLabel(FDEEnd);
FDEEnd = NULL;
FDEEnd = nullptr;
}
if (!NeedsEHFrameSection && Frame.CompactUnwindEncoding !=

View File

@ -537,7 +537,7 @@ void MCELFStreamer::Flush() {
}
void MCELFStreamer::FinishImpl() {
EmitFrames(NULL, true);
EmitFrames(nullptr, true);
Flush();

View File

@ -444,12 +444,12 @@ void MCTargetExpr::anchor() {}
/* *** */
bool MCExpr::EvaluateAsAbsolute(int64_t &Res) const {
return EvaluateAsAbsolute(Res, 0, 0, 0);
return EvaluateAsAbsolute(Res, nullptr, nullptr, nullptr);
}
bool MCExpr::EvaluateAsAbsolute(int64_t &Res,
const MCAsmLayout &Layout) const {
return EvaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, 0);
return EvaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, nullptr);
}
bool MCExpr::EvaluateAsAbsolute(int64_t &Res,
@ -459,7 +459,7 @@ bool MCExpr::EvaluateAsAbsolute(int64_t &Res,
}
bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const {
return EvaluateAsAbsolute(Res, &Asm, 0, 0);
return EvaluateAsAbsolute(Res, &Asm, nullptr, nullptr);
}
bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
@ -518,7 +518,7 @@ static void AttemptToFoldSymbolOffsetDifference(const MCAssembler *Asm,
// Clear the symbol expr pointers to indicate we have folded these
// operands.
A = B = 0;
A = B = nullptr;
return;
}
@ -544,7 +544,7 @@ static void AttemptToFoldSymbolOffsetDifference(const MCAssembler *Asm,
// Clear the symbol expr pointers to indicate we have folded these
// operands.
A = B = 0;
A = B = nullptr;
}
/// \brief Evaluate the result of an add between (conceptually) two MCValues.
@ -627,8 +627,8 @@ static bool EvaluateSymbolicAdd(const MCAssembler *Asm,
bool MCExpr::EvaluateAsRelocatable(MCValue &Res,
const MCAsmLayout *Layout) const {
MCAssembler *Assembler = Layout ? &Layout->getAssembler() : 0;
return EvaluateAsRelocatableImpl(Res, Assembler, Layout, 0, false);
MCAssembler *Assembler = Layout ? &Layout->getAssembler() : nullptr;
return EvaluateAsRelocatableImpl(Res, Assembler, Layout, nullptr, false);
}
bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
@ -676,7 +676,7 @@ bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
}
}
Res = MCValue::get(SRE, 0, 0);
Res = MCValue::get(SRE, nullptr, 0);
return true;
}
@ -795,7 +795,7 @@ const MCSection *MCExpr::FindAssociatedSection() const {
if (Sym.isDefined())
return &Sym.getSection();
return 0;
return nullptr;
}
case Unary:

View File

@ -83,7 +83,7 @@ bool MCExternalSymbolizer::tryAddingSymbolicOperand(MCInst &MI,
return false;
}
const MCExpr *Add = NULL;
const MCExpr *Add = nullptr;
if (SymbolicOp.AddSymbol.Present) {
if (SymbolicOp.AddSymbol.Name) {
StringRef Name(SymbolicOp.AddSymbol.Name);
@ -94,7 +94,7 @@ bool MCExternalSymbolizer::tryAddingSymbolicOperand(MCInst &MI,
}
}
const MCExpr *Sub = NULL;
const MCExpr *Sub = nullptr;
if (SymbolicOp.SubtractSymbol.Present) {
if (SymbolicOp.SubtractSymbol.Name) {
StringRef Name(SymbolicOp.SubtractSymbol.Name);
@ -105,7 +105,7 @@ bool MCExternalSymbolizer::tryAddingSymbolicOperand(MCInst &MI,
}
}
const MCExpr *Off = NULL;
const MCExpr *Off = nullptr;
if (SymbolicOp.Value != 0)
Off = MCConstantExpr::Create(SymbolicOp.Value, Ctx);
@ -116,17 +116,17 @@ bool MCExternalSymbolizer::tryAddingSymbolicOperand(MCInst &MI,
LHS = MCBinaryExpr::CreateSub(Add, Sub, Ctx);
else
LHS = MCUnaryExpr::CreateMinus(Sub, Ctx);
if (Off != 0)
if (Off)
Expr = MCBinaryExpr::CreateAdd(LHS, Off, Ctx);
else
Expr = LHS;
} else if (Add) {
if (Off != 0)
if (Off)
Expr = MCBinaryExpr::CreateAdd(Add, Off, Ctx);
else
Expr = Add;
} else {
if (Off != 0)
if (Off)
Expr = Off;
else
Expr = MCConstantExpr::Create(0, Ctx);
@ -189,7 +189,7 @@ MCSymbolizer *createMCSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo,
void *DisInfo,
MCContext *Ctx,
MCRelocationInfo *RelInfo) {
assert(Ctx != 0 && "No MCContext given for symbolic disassembly");
assert(Ctx && "No MCContext given for symbolic disassembly");
return new MCExternalSymbolizer(*Ctx,
std::unique_ptr<MCRelocationInfo>(RelInfo),

View File

@ -35,7 +35,7 @@ MCBasicBlock *MCFunction::find(uint64_t StartAddr) {
for (const_iterator I = begin(), E = end(); I != E; ++I)
if ((*I)->getInsts()->getBeginAddr() == StartAddr)
return *I;
return 0;
return nullptr;
}
const MCBasicBlock *MCFunction::find(uint64_t StartAddr) const {

View File

@ -34,7 +34,7 @@ void MCOperand::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void MCOperand::dump() const {
print(dbgs(), 0);
print(dbgs(), nullptr);
dbgs() << "\n";
}
#endif
@ -66,7 +66,7 @@ void MCInst::dump_pretty(raw_ostream &OS, const MCAsmInfo *MAI,
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void MCInst::dump() const {
print(dbgs(), 0);
print(dbgs(), nullptr);
dbgs() << "\n";
}
#endif

View File

@ -89,7 +89,7 @@ public:
}
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override;
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0) override;
virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment = 0) override;
@ -172,7 +172,7 @@ void MCMachOStreamer::EmitDataRegion(DataRegionData::KindTy Kind) {
MCSymbol *Start = getContext().CreateTempSymbol();
EmitLabel(Start);
// Record the region for the object writer to use.
DataRegionData Data = { Kind, Start, NULL };
DataRegionData Data = { Kind, Start, nullptr };
std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
Regions.push_back(Data);
}
@ -183,7 +183,7 @@ void MCMachOStreamer::EmitDataRegionEnd() {
std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
assert(Regions.size() && "Mismatched .end_data_region!");
DataRegionData &Data = Regions.back();
assert(Data.End == NULL && "Mismatched .end_data_region!");
assert(!Data.End && "Mismatched .end_data_region!");
// Create a temporary label to mark the end of the data region.
Data.End = getContext().CreateTempSymbol();
EmitLabel(Data.End);
@ -352,7 +352,7 @@ void MCMachOStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
// FIXME: Darwin 'as' does appear to allow redef of a .comm by itself.
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
AssignSection(Symbol, NULL);
AssignSection(Symbol, nullptr);
MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
SD.setExternal(true);
@ -444,7 +444,7 @@ void MCMachOStreamer::FinishImpl() {
// symbol.
for (MCAssembler::iterator it = getAssembler().begin(),
ie = getAssembler().end(); it != ie; ++it) {
MCSymbolData *CurrentAtom = 0;
MCSymbolData *CurrentAtom = nullptr;
for (MCSectionData::iterator it2 = it->begin(),
ie2 = it->end(); it2 != ie2; ++it2) {
if (MCSymbolData *SD = DefiningSymbolMap.lookup(it2))

View File

@ -77,7 +77,7 @@ const MCAtom *MCModule::findAtomContaining(uint64_t Addr) const {
Addr, AtomComp);
if (I != atom_end() && (*I)->getBeginAddr() <= Addr)
return *I;
return 0;
return nullptr;
}
MCAtom *MCModule::findAtomContaining(uint64_t Addr) {
@ -90,7 +90,7 @@ const MCAtom *MCModule::findFirstAtomAfter(uint64_t Addr) const {
Addr, AtomCompInv);
if (I != atom_end())
return *I;
return 0;
return nullptr;
}
MCAtom *MCModule::findFirstAtomAfter(uint64_t Addr) {

View File

@ -64,7 +64,7 @@ namespace {
unsigned ByteAlignment) override {}
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override {}
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0) override {}
void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) override {}

View File

@ -34,7 +34,7 @@ using namespace object;
MCObjectDisassembler::MCObjectDisassembler(const ObjectFile &Obj,
const MCDisassembler &Dis,
const MCInstrAnalysis &MIA)
: Obj(Obj), Dis(Dis), MIA(MIA), MOS(0) {}
: Obj(Obj), Dis(Dis), MIA(MIA), MOS(nullptr) {}
uint64_t MCObjectDisassembler::getEntrypoint() {
for (const SymbolRef &Symbol : Obj.symbols()) {
@ -115,8 +115,8 @@ void MCObjectDisassembler::buildSectionAtoms(MCModule *Module) {
Section.getName(SecName);
if (isText) {
MCTextAtom *Text = 0;
MCDataAtom *InvalidData = 0;
MCTextAtom *Text = nullptr;
MCDataAtom *InvalidData = nullptr;
uint64_t InstSize;
for (uint64_t Index = 0; Index < SecSize; Index += InstSize) {
@ -129,11 +129,11 @@ void MCObjectDisassembler::buildSectionAtoms(MCModule *Module) {
Text->setName(SecName);
}
Text->addInst(Inst, InstSize);
InvalidData = 0;
InvalidData = nullptr;
} else {
assert(InstSize && "getInstruction() consumed no bytes");
if (!InvalidData) {
Text = 0;
Text = nullptr;
InvalidData = Module->createDataAtom(CurAddr, CurAddr+InstSize - 1);
}
for (uint64_t I = 0; I < InstSize; ++I)
@ -160,7 +160,7 @@ namespace {
BBInfoSetTy Preds;
MCObjectDisassembler::AddressSetTy SuccAddrs;
BBInfo() : Atom(0), BB(0) {}
BBInfo() : Atom(nullptr), BB(nullptr) {}
void addSucc(BBInfo &Succ) {
Succs.insert(&Succ);

View File

@ -44,7 +44,7 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
SectionKind::getDataRel());
// BSSSection might not be expected initialized on msvc.
BSSSection = 0;
BSSSection = nullptr;
TLSDataSection // .tdata
= Ctx->getMachOSection("__DATA", "__thread_data",
@ -147,7 +147,7 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
LSDASection = Ctx->getMachOSection("__TEXT", "__gcc_except_tab", 0,
SectionKind::getReadOnlyWithRel());
COFFDebugSymbolsSection = 0;
COFFDebugSymbolsSection = nullptr;
if ((T.isMacOSX() && !T.isMacOSXVersionLT(10, 6)) ||
(T.isOSDarwin() && T.getArch() == Triple::arm64)) {
@ -461,7 +461,7 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
ELF::SHF_ALLOC,
SectionKind::getReadOnly());
COFFDebugSymbolsSection = 0;
COFFDebugSymbolsSection = nullptr;
// Debug Info Sections.
DwarfAbbrevSection =
@ -760,12 +760,12 @@ void MCObjectFileInfo::InitMCObjectFileInfo(StringRef TT, Reloc::Model relocm,
CompactUnwindDwarfEHFrameOnly = 0;
EHFrameSection = 0; // Created on demand.
CompactUnwindSection = 0; // Used only by selected targets.
DwarfAccelNamesSection = 0; // Used only by selected targets.
DwarfAccelObjCSection = 0; // Used only by selected targets.
DwarfAccelNamespaceSection = 0; // Used only by selected targets.
DwarfAccelTypesSection = 0; // Used only by selected targets.
EHFrameSection = nullptr; // Created on demand.
CompactUnwindSection = nullptr; // Used only by selected targets.
DwarfAccelNamesSection = nullptr; // Used only by selected targets.
DwarfAccelObjCSection = nullptr; // Used only by selected targets.
DwarfAccelNamespaceSection = nullptr; // Used only by selected targets.
DwarfAccelTypesSection = nullptr; // Used only by selected targets.
Triple T(TT);
Triple::ArchType Arch = T.getArch();

View File

@ -27,12 +27,12 @@ MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
: MCStreamer(Context),
Assembler(new MCAssembler(Context, TAB, *Emitter_,
*TAB.createObjectWriter(OS), OS)),
CurSectionData(0) {}
CurSectionData(nullptr) {}
MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
raw_ostream &OS, MCCodeEmitter *Emitter_,
MCAssembler *_Assembler)
: MCStreamer(Context), Assembler(_Assembler), CurSectionData(0) {}
: MCStreamer(Context), Assembler(_Assembler), CurSectionData(nullptr) {}
MCObjectStreamer::~MCObjectStreamer() {
delete &Assembler->getBackend();
@ -44,7 +44,7 @@ MCObjectStreamer::~MCObjectStreamer() {
void MCObjectStreamer::reset() {
if (Assembler)
Assembler->reset();
CurSectionData = 0;
CurSectionData = nullptr;
CurInsertionPoint = MCSectionData::iterator();
MCStreamer::reset();
}
@ -55,7 +55,7 @@ MCFragment *MCObjectStreamer::getCurrentFragment() const {
if (CurInsertionPoint != getCurrentSectionData()->getFragmentList().begin())
return std::prev(CurInsertionPoint);
return 0;
return nullptr;
}
MCDataFragment *MCObjectStreamer::getOrCreateDataFragment() const {

View File

@ -215,11 +215,11 @@ const SectionRef *MCObjectSymbolizer::findSectionContaining(uint64_t Addr) {
It = std::lower_bound(SortedSections.begin(), EndIt,
Addr, SectionStartsBefore);
if (It == EndIt)
return 0;
return nullptr;
uint64_t SAddr; It->getAddress(SAddr);
uint64_t SSize; It->getSize(SSize);
if (Addr >= SAddr + SSize)
return 0;
return nullptr;
return &*It;
}
@ -229,7 +229,7 @@ const RelocationRef *MCObjectSymbolizer::findRelocationAt(uint64_t Addr) {
AddrToRelocMap::const_iterator RI = AddrToReloc.find(Addr);
if (RI == AddrToReloc.end())
return 0;
return nullptr;
return &RI->second;
}

View File

@ -23,14 +23,14 @@ MCRelocationInfo::~MCRelocationInfo() {
const MCExpr *
MCRelocationInfo::createExprForRelocation(object::RelocationRef Rel) {
return 0;
return nullptr;
}
const MCExpr *
MCRelocationInfo::createExprForCAPIVariantKind(const MCExpr *SubExpr,
unsigned VariantKind) {
if (VariantKind != LLVMDisassembler_VariantKind_None)
return 0;
return nullptr;
return SubExpr;
}

View File

@ -34,7 +34,7 @@ void MCSectionCOFF::setSelection(int Selection,
const MCSectionCOFF *Assoc) const {
assert(Selection != 0 && "invalid COMDAT selection type");
assert((Selection == COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE) ==
(Assoc != 0) &&
(Assoc != nullptr) &&
"associative COMDAT section must have an associated section");
this->Selection = Selection;
this->Assoc = Assoc;

View File

@ -20,7 +20,7 @@ static const struct {
const char *AssemblerName, *EnumName;
} SectionTypeDescriptors[MachO::LAST_KNOWN_SECTION_TYPE+1] = {
{ "regular", "S_REGULAR" }, // 0x00
{ 0, "S_ZEROFILL" }, // 0x01
{ nullptr, "S_ZEROFILL" }, // 0x01
{ "cstring_literals", "S_CSTRING_LITERALS" }, // 0x02
{ "4byte_literals", "S_4BYTE_LITERALS" }, // 0x03
{ "8byte_literals", "S_8BYTE_LITERALS" }, // 0x04
@ -31,11 +31,11 @@ static const struct {
{ "mod_init_funcs", "S_MOD_INIT_FUNC_POINTERS" }, // 0x09
{ "mod_term_funcs", "S_MOD_TERM_FUNC_POINTERS" }, // 0x0A
{ "coalesced", "S_COALESCED" }, // 0x0B
{ 0, /*FIXME??*/ "S_GB_ZEROFILL" }, // 0x0C
{ nullptr, /*FIXME??*/ "S_GB_ZEROFILL" }, // 0x0C
{ "interposing", "S_INTERPOSING" }, // 0x0D
{ "16byte_literals", "S_16BYTE_LITERALS" }, // 0x0E
{ 0, /*FIXME??*/ "S_DTRACE_DOF" }, // 0x0F
{ 0, /*FIXME??*/ "S_LAZY_DYLIB_SYMBOL_POINTERS" }, // 0x10
{ nullptr, /*FIXME??*/ "S_DTRACE_DOF" }, // 0x0F
{ nullptr, /*FIXME??*/ "S_LAZY_DYLIB_SYMBOL_POINTERS" }, // 0x10
{ "thread_local_regular", "S_THREAD_LOCAL_REGULAR" }, // 0x11
{ "thread_local_zerofill", "S_THREAD_LOCAL_ZEROFILL" }, // 0x12
{ "thread_local_variables", "S_THREAD_LOCAL_VARIABLES" }, // 0x13
@ -62,11 +62,11 @@ ENTRY("no_dead_strip", S_ATTR_NO_DEAD_STRIP)
ENTRY("live_support", S_ATTR_LIVE_SUPPORT)
ENTRY("self_modifying_code", S_ATTR_SELF_MODIFYING_CODE)
ENTRY("debug", S_ATTR_DEBUG)
ENTRY(0 /*FIXME*/, S_ATTR_SOME_INSTRUCTIONS)
ENTRY(0 /*FIXME*/, S_ATTR_EXT_RELOC)
ENTRY(0 /*FIXME*/, S_ATTR_LOC_RELOC)
ENTRY(nullptr /*FIXME*/, S_ATTR_SOME_INSTRUCTIONS)
ENTRY(nullptr /*FIXME*/, S_ATTR_EXT_RELOC)
ENTRY(nullptr /*FIXME*/, S_ATTR_LOC_RELOC)
#undef ENTRY
{ 0, "none", 0 }, // used if section has no attributes but has a stub size
{ 0, "none", nullptr }, // used if section has no attributes but has a stub size
};
MCSectionMachO::MCSectionMachO(StringRef Segment, StringRef Section,

View File

@ -38,7 +38,7 @@ void MCTargetStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
MCStreamer::MCStreamer(MCContext &Ctx)
: Context(Ctx), EmitEHFrame(true), EmitDebugFrame(false),
CurrentW64UnwindInfo(0), LastSymbol(0) {
CurrentW64UnwindInfo(nullptr), LastSymbol(nullptr) {
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
}
@ -53,8 +53,8 @@ void MCStreamer::reset() {
W64UnwindInfos.clear();
EmitEHFrame = true;
EmitDebugFrame = false;
CurrentW64UnwindInfo = 0;
LastSymbol = 0;
CurrentW64UnwindInfo = nullptr;
LastSymbol = nullptr;
SectionStack.clear();
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
}
@ -203,7 +203,7 @@ MCSymbol *MCStreamer::getDwarfLineTableSymbol(unsigned CUID) {
MCDwarfFrameInfo *MCStreamer::getCurrentFrameInfo() {
if (FrameInfos.empty())
return 0;
return nullptr;
return &FrameInfos.back();
}
@ -641,7 +641,7 @@ void MCStreamer::Finish() {
MCSymbolData &MCStreamer::getOrCreateSymbolData(const MCSymbol *Symbol) {
report_fatal_error("Not supported!");
return *(static_cast<MCSymbolData*>(0));
return *(static_cast<MCSymbolData*>(nullptr));
}
void MCStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {

View File

@ -38,6 +38,6 @@ void MCValue::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void MCValue::dump() const {
print(dbgs(), 0);
print(dbgs(), nullptr);
}
#endif

View File

@ -669,7 +669,7 @@ IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
// - addr(atom(B)) - offset(B)
// and the offsets are not relocatable, so the fixup is fully resolved when
// addr(atom(A)) - addr(atom(B)) == 0.
const MCSymbolData *A_Base = 0, *B_Base = 0;
const MCSymbolData *A_Base = nullptr, *B_Base = nullptr;
const MCSymbol &SA = DataA.getSymbol().AliasedSymbol();
const MCSection &SecA = SA.getSection();

View File

@ -126,7 +126,7 @@ static const SubtargetFeatureKV *Find(StringRef S, const SubtargetFeatureKV *A,
// Binary search the array
const SubtargetFeatureKV *F = std::lower_bound(A, Hi, S);
// If not found then return NULL
if (F == Hi || StringRef(F->Key) != S) return NULL;
if (F == Hi || StringRef(F->Key) != S) return nullptr;
// Return the found array item
return F;
}

View File

@ -81,7 +81,7 @@ struct COFFRelocation {
COFF::relocation Data;
COFFSymbol *Symb;
COFFRelocation() : Symb(NULL) {}
COFFRelocation() : Symb(nullptr) {}
static size_t size() { return COFF::RelocationSize; }
};
@ -192,10 +192,10 @@ static inline void write_uint32_le(void *Data, uint32_t const &Value) {
COFFSymbol::COFFSymbol(StringRef name)
: Name(name.begin(), name.end())
, Other(NULL)
, Section(NULL)
, Other(nullptr)
, Section(nullptr)
, Relocations(0)
, MCData(NULL) {
, MCData(nullptr) {
memset(&Data, 0, sizeof(Data));
}
@ -214,7 +214,7 @@ void COFFSymbol::set_name_offset(uint32_t Offset) {
/// logic to decide if the symbol should be reported in the symbol table
bool COFFSymbol::should_keep() const {
// no section means its external, keep it
if (Section == NULL)
if (!Section)
return true;
// if it has relocations pointing at it, keep it
@ -244,8 +244,8 @@ bool COFFSymbol::should_keep() const {
COFFSection::COFFSection(StringRef name)
: Name(name)
, MCData(NULL)
, Symbol(NULL) {
, MCData(nullptr)
, Symbol(nullptr) {
memset(&Header, 0, sizeof(Header));
}
@ -452,7 +452,7 @@ void WinCOFFObjectWriter::DefineSymbol(MCSymbolData const &SymbolData,
// If no storage class was specified in the streamer, define it here.
if (coff_symbol->Data.StorageClass == 0) {
bool external = ResSymData.isExternal() || (ResSymData.Fragment == NULL);
bool external = ResSymData.isExternal() || !ResSymData.Fragment;
coff_symbol->Data.StorageClass =
external ? COFF::IMAGE_SYM_CLASS_EXTERNAL : COFF::IMAGE_SYM_CLASS_STATIC;
@ -460,7 +460,7 @@ void WinCOFFObjectWriter::DefineSymbol(MCSymbolData const &SymbolData,
if (Symbol.isAbsolute() || Symbol.AliasedSymbol().isVariable())
coff_symbol->Data.SectionNumber = COFF::IMAGE_SYM_ABSOLUTE;
else if (ResSymData.Fragment != NULL)
else if (ResSymData.Fragment)
coff_symbol->Section =
SectionMap[&ResSymData.Fragment->getParent()->getSection()];
@ -661,7 +661,7 @@ void WinCOFFObjectWriter::RecordRelocation(const MCAssembler &Asm,
MCValue Target,
bool &IsPCRel,
uint64_t &FixedValue) {
assert(Target.getSymA() != NULL && "Relocation must reference a symbol!");
assert(Target.getSymA() && "Relocation must reference a symbol!");
const MCSymbol &Symbol = Target.getSymA()->getSymbol();
const MCSymbol &A = Symbol.AliasedSymbol();
@ -770,8 +770,8 @@ void WinCOFFObjectWriter::WriteObject(MCAssembler &Asm,
MCSymbolData const *SymbolData = coff_symbol->MCData;
// Update section number & offset for symbols that have them.
if ((SymbolData != NULL) && (SymbolData->Fragment != NULL)) {
assert(coff_symbol->Section != NULL);
if (SymbolData && SymbolData->Fragment) {
assert(coff_symbol->Section != nullptr);
coff_symbol->Data.SectionNumber = coff_symbol->Section->Number;
coff_symbol->Data.Value = Layout.getFragmentOffset(SymbolData->Fragment)
@ -791,7 +791,7 @@ void WinCOFFObjectWriter::WriteObject(MCAssembler &Asm,
// Fixup weak external references.
for (symbols::iterator i = Symbols.begin(), e = Symbols.end(); i != e; i++) {
COFFSymbol *coff_symbol = *i;
if (coff_symbol->Other != NULL) {
if (coff_symbol->Other) {
assert(coff_symbol->Index != -1);
assert(coff_symbol->Aux.size() == 1 &&
"Symbol must contain one aux symbol!");

View File

@ -96,7 +96,7 @@ private:
WinCOFFStreamer::WinCOFFStreamer(MCContext &Context, MCAsmBackend &MAB,
MCCodeEmitter &CE, raw_ostream &OS)
: MCObjectStreamer(Context, MAB, OS, &CE), CurSymbol(NULL) {}
: MCObjectStreamer(Context, MAB, OS, &CE), CurSymbol(nullptr) {}
// MCStreamer interface
@ -166,13 +166,13 @@ void WinCOFFStreamer::BeginCOFFSymbolDef(MCSymbol const *Symbol) {
assert((Symbol->isInSection()
? Symbol->getSection().getVariant() == MCSection::SV_COFF
: true) && "Got non-COFF section in the COFF backend!");
assert(CurSymbol == NULL && "EndCOFFSymbolDef must be called between calls "
"to BeginCOFFSymbolDef!");
assert(!CurSymbol && "EndCOFFSymbolDef must be called between calls "
"to BeginCOFFSymbolDef!");
CurSymbol = Symbol;
}
void WinCOFFStreamer::EmitCOFFSymbolStorageClass(int StorageClass) {
assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
assert(CurSymbol && "BeginCOFFSymbolDef must be called first!");
assert((StorageClass & ~0xFF) == 0 && "StorageClass must only have data in "
"the first byte!");
@ -182,7 +182,7 @@ void WinCOFFStreamer::EmitCOFFSymbolStorageClass(int StorageClass) {
}
void WinCOFFStreamer::EmitCOFFSymbolType(int Type) {
assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
assert(CurSymbol && "BeginCOFFSymbolDef must be called first!");
assert((Type & ~0xFFFF) == 0 && "Type must only have data in the first 2 "
"bytes");
@ -192,8 +192,8 @@ void WinCOFFStreamer::EmitCOFFSymbolType(int Type) {
}
void WinCOFFStreamer::EndCOFFSymbolDef() {
assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
CurSymbol = NULL;
assert(CurSymbol && "BeginCOFFSymbolDef must be called first!");
CurSymbol = nullptr;
}
void WinCOFFStreamer::EmitCOFFSectionIndex(MCSymbol const *Symbol) {
@ -226,7 +226,7 @@ void WinCOFFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
report_fatal_error(
"The linker won't align common symbols beyond 32 bytes.");
AssignSection(Symbol, NULL);
AssignSection(Symbol, nullptr);
MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
SD.setExternal(true);
@ -284,7 +284,7 @@ void WinCOFFStreamer::EmitWin64EHHandlerData() {
}
void WinCOFFStreamer::FinishImpl() {
EmitFrames(NULL, true);
EmitFrames(nullptr, true);
EmitW64Tables();
MCObjectStreamer::FinishImpl();
}