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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -68,7 +68,7 @@ public:
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override; 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; uint64_t Size = 0, unsigned ByteAlignment = 0) override;
void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol, void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment = 0) override; 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 /// \brief Dump the MCInst as prettily as possible using the additional MC
/// structures, if given. Operators are separated by the \p Separator /// structures, if given. Operators are separated by the \p Separator
/// string. /// string.
void dump_pretty(raw_ostream &OS, const MCAsmInfo *MAI = 0, void dump_pretty(raw_ostream &OS, const MCAsmInfo *MAI = nullptr,
const MCInstPrinter *Printer = 0, const MCInstPrinter *Printer = nullptr,
StringRef Separator = " ") const; StringRef Separator = " ") const;
}; };
inline raw_ostream& operator<<(raw_ostream &OS, const MCOperand &MO) { inline raw_ostream& operator<<(raw_ostream &OS, const MCOperand &MO) {
MO.print(OS, 0); MO.print(OS, nullptr);
return OS; return OS;
} }
inline raw_ostream& operator<<(raw_ostream &OS, const MCInst &MI) { inline raw_ostream& operator<<(raw_ostream &OS, const MCInst &MI) {
MI.print(OS, 0); MI.print(OS, nullptr);
return OS; return OS;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -176,7 +176,8 @@ struct has_ScalarEnumerationTraits
static double test(...); static double test(...);
public: 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(...); static double test(...);
public: 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. // Test if MappingTraits<T>::validate() is defined on type T.
@ -266,7 +267,7 @@ struct has_SequenceMethodTraits
static double test(...); static double test(...);
public: 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]; static char (&f(...))[2];
public: 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(); Symbol = &A->getSymbol();
Data = &Layout.getAssembler().getSymbolData(*Symbol); Data = &Layout.getAssembler().getSymbolData(*Symbol);
} else { } else {
Symbol = 0; Symbol = nullptr;
Data = 0; Data = nullptr;
} }
} }

View File

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

View File

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

View File

@ -212,7 +212,7 @@ MCFragment::~MCFragment() {
} }
MCFragment::MCFragment(FragmentType _Kind, MCSectionData *_Parent) 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) if (Parent)
Parent->getFragmentList().push_back(this); 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) MCSectionData::MCSectionData(const MCSection &_Section, MCAssembler *A)
: Section(&_Section), : Section(&_Section),
@ -250,7 +250,7 @@ MCSectionData::getSubsectionInsertionPoint(unsigned Subsection) {
SmallVectorImpl<std::pair<unsigned, MCFragment *> >::iterator MI = SmallVectorImpl<std::pair<unsigned, MCFragment *> >::iterator MI =
std::lower_bound(SubsectionFragmentMap.begin(), SubsectionFragmentMap.end(), std::lower_bound(SubsectionFragmentMap.begin(), SubsectionFragmentMap.end(),
std::make_pair(Subsection, (MCFragment *)0)); std::make_pair(Subsection, (MCFragment *)nullptr));
bool ExactMatch = false; bool ExactMatch = false;
if (MI != SubsectionFragmentMap.end()) { if (MI != SubsectionFragmentMap.end()) {
ExactMatch = MI->first == Subsection; 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, MCSymbolData::MCSymbolData(const MCSymbol &_Symbol, MCFragment *_Fragment,
uint64_t _Offset, MCAssembler *A) uint64_t _Offset, MCAssembler *A)
: Symbol(&_Symbol), Fragment(_Fragment), Offset(_Offset), : Symbol(&_Symbol), Fragment(_Fragment), Offset(_Offset),
IsExternal(false), IsPrivateExtern(false), IsExternal(false), IsPrivateExtern(false),
CommonSize(0), SymbolSize(0), CommonAlign(0), CommonSize(0), SymbolSize(nullptr), CommonAlign(0),
Flags(0), Index(0) Flags(0), Index(0)
{ {
if (A) if (A)
@ -342,13 +342,13 @@ const MCSymbolData *MCAssembler::getAtom(const MCSymbolData *SD) const {
// Absolute and undefined symbols have no defining atom. // Absolute and undefined symbols have no defining atom.
if (!SD->getFragment()) if (!SD->getFragment())
return 0; return nullptr;
// Non-linker visible symbols in sections which can't be atomized have no // Non-linker visible symbols in sections which can't be atomized have no
// defining atom. // defining atom.
if (!getBackend().isSectionAtomizable( if (!getBackend().isSectionAtomizable(
SD->getFragment()->getParent()->getSection())) SD->getFragment()->getParent()->getSection()))
return 0; return nullptr;
// Otherwise, return the atom for the containing fragment. // Otherwise, return the atom for the containing fragment.
return SD->getFragment()->getAtom(); return SD->getFragment()->getAtom();
@ -948,7 +948,7 @@ bool MCAssembler::layoutSectionOnce(MCAsmLayout &Layout, MCSectionData &SD) {
// remain NULL if none were relaxed. // remain NULL if none were relaxed.
// When a fragment is relaxed, all the fragments following it should get // When a fragment is relaxed, all the fragments following it should get
// invalidated because their offset is going to change. // invalidated because their offset is going to change.
MCFragment *FirstRelaxedFragment = NULL; MCFragment *FirstRelaxedFragment = nullptr;
// Attempt to relax all the fragments in the section. // Attempt to relax all the fragments in the section.
for (MCSectionData::iterator I = SD.begin(), IE = SD.end(); I != IE; ++I) { 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(); CompilationDir.clear();
SecureLogFile = getenv("AS_SECURE_LOG_FILE"); SecureLogFile = getenv("AS_SECURE_LOG_FILE");
SecureLog = 0; SecureLog = nullptr;
SecureLogUsed = false; SecureLogUsed = false;
if (SrcMgr && SrcMgr->getNumBuffers() > 0) if (SrcMgr && SrcMgr->getNumBuffers() > 0)
@ -250,7 +250,7 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
SectionKind Kind, unsigned EntrySize, StringRef Group) { SectionKind Kind, unsigned EntrySize, StringRef Group) {
// Do the lookup, if we have a hit, return it. // Do the lookup, if we have a hit, return it.
auto IterBool = ELFUniquingMap.insert( auto IterBool = ELFUniquingMap.insert(
std::make_pair(SectionGroupPair(Section, Group), (MCSectionELF *)0)); std::make_pair(SectionGroupPair(Section, Group), nullptr));
auto &Entry = *IterBool.first; auto &Entry = *IterBool.first;
if (!IterBool.second) return Entry.second; if (!IterBool.second) return Entry.second;
@ -259,7 +259,7 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
EntrySize = MCSectionELF::DetermineEntrySize(Kind); EntrySize = MCSectionELF::DetermineEntrySize(Kind);
} }
MCSymbol *GroupSym = NULL; MCSymbol *GroupSym = nullptr;
if (!Group.empty()) if (!Group.empty())
GroupSym = GetOrCreateSymbol(Group); GroupSym = GetOrCreateSymbol(Group);
@ -273,7 +273,7 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
const MCSectionELF *MCContext::CreateELFGroupSection() { const MCSectionELF *MCContext::CreateELFGroupSection() {
MCSectionELF *Result = MCSectionELF *Result =
new (*this) MCSectionELF(".group", ELF::SHT_GROUP, 0, new (*this) MCSectionELF(".group", ELF::SHT_GROUP, 0,
SectionKind::getReadOnly(), 4, NULL); SectionKind::getReadOnly(), 4, nullptr);
return Result; return Result;
} }
@ -284,12 +284,12 @@ MCContext::getCOFFSection(StringRef Section, unsigned Characteristics,
// Do the lookup, if we have a hit, return it. // Do the lookup, if we have a hit, return it.
SectionGroupPair P(Section, COMDATSymName); 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; auto Iter = IterBool.first;
if (!IterBool.second) if (!IterBool.second)
return Iter->second; return Iter->second;
const MCSymbol *COMDATSymbol = NULL; const MCSymbol *COMDATSymbol = nullptr;
if (!COMDATSymName.empty()) if (!COMDATSymName.empty())
COMDATSymbol = GetOrCreateSymbol(COMDATSymName); COMDATSymbol = GetOrCreateSymbol(COMDATSymName);
@ -311,7 +311,7 @@ const MCSectionCOFF *MCContext::getCOFFSection(StringRef Section) {
SectionGroupPair P(Section, ""); SectionGroupPair P(Section, "");
auto Iter = COFFUniquingMap.find(P); auto Iter = COFFUniquingMap.find(P);
if (Iter == COFFUniquingMap.end()) if (Iter == COFFUniquingMap.end())
return 0; return nullptr;
return Iter->second; 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 Flags = DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT : 0;
unsigned Isa = 0; unsigned Isa = 0;
unsigned Discriminator = 0; unsigned Discriminator = 0;
MCSymbol *LastLabel = NULL; MCSymbol *LastLabel = nullptr;
// Loop through each MCLineEntry and encode the dwarf line number table. // Loop through each MCLineEntry and encode the dwarf line number table.
for (auto it = LineEntries.begin(), for (auto it = LineEntries.begin(),
@ -779,8 +779,8 @@ void MCGenDwarfInfo::Emit(MCStreamer *MCOS) {
MCSymbol *LineSectionSymbol = nullptr; MCSymbol *LineSectionSymbol = nullptr;
if (CreateDwarfSectionSymbols) if (CreateDwarfSectionSymbols)
LineSectionSymbol = MCOS->getDwarfLineTableSymbol(0); LineSectionSymbol = MCOS->getDwarfLineTableSymbol(0);
MCSymbol *AbbrevSectionSymbol = NULL; MCSymbol *AbbrevSectionSymbol = nullptr;
MCSymbol *InfoSectionSymbol = NULL; MCSymbol *InfoSectionSymbol = nullptr;
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfInfoSection()); MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfInfoSection());
if (CreateDwarfSectionSymbols) { if (CreateDwarfSectionSymbols) {
InfoSectionSymbol = context.CreateTempSymbol(); InfoSectionSymbol = context.CreateTempSymbol();
@ -882,7 +882,7 @@ static unsigned getSizeForEncoding(MCStreamer &streamer,
static void EmitFDESymbol(MCStreamer &streamer, const MCSymbol &symbol, static void EmitFDESymbol(MCStreamer &streamer, const MCSymbol &symbol,
unsigned symbolEncoding, bool isEH, unsigned symbolEncoding, bool isEH,
const char *comment = 0) { const char *comment = nullptr) {
MCContext &context = streamer.getContext(); MCContext &context = streamer.getContext();
const MCAsmInfo *asmInfo = context.getAsmInfo(); const MCAsmInfo *asmInfo = context.getAsmInfo();
const MCExpr *v = asmInfo->getExprForFDESymbol(&symbol, const MCExpr *v = asmInfo->getExprForFDESymbol(&symbol,
@ -917,7 +917,7 @@ namespace {
public: public:
FrameEmitterImpl(bool usingCFI, bool isEH) FrameEmitterImpl(bool usingCFI, bool isEH)
: CFAOffset(0), CIENum(0), UsingCFI(usingCFI), IsEH(isEH), : CFAOffset(0), CIENum(0), UsingCFI(usingCFI), IsEH(isEH),
SectionStart(0) {} SectionStart(nullptr) {}
void setSectionStart(const MCSymbol *Label) { SectionStart = Label; } void setSectionStart(const MCSymbol *Label) { SectionStart = Label; }
@ -1344,7 +1344,7 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(MCStreamer &streamer,
if (!IsSimple) { if (!IsSimple) {
const std::vector<MCCFIInstruction> &Instructions = const std::vector<MCCFIInstruction> &Instructions =
MAI->getInitialFrameState(); MAI->getInitialFrameState();
EmitCFIInstructions(streamer, Instructions, NULL); EmitCFIInstructions(streamer, Instructions, nullptr);
} }
// Padding // Padding
@ -1431,8 +1431,12 @@ MCSymbol *FrameEmitterImpl::EmitFDE(MCStreamer &streamer,
namespace { namespace {
struct CIEKey { struct CIEKey {
static const CIEKey getEmptyKey() { return CIEKey(0, 0, -1, false, false); } static const CIEKey getEmptyKey() {
static const CIEKey getTombstoneKey() { return CIEKey(0, -1, 0, false, false); } return CIEKey(nullptr, 0, -1, false, false);
}
static const CIEKey getTombstoneKey() {
return CIEKey(nullptr, -1, 0, false, false);
}
CIEKey(const MCSymbol* Personality_, unsigned PersonalityEncoding_, CIEKey(const MCSymbol* Personality_, unsigned PersonalityEncoding_,
unsigned LsdaEncoding_, bool IsSignalFrame_, bool IsSimple_) : unsigned LsdaEncoding_, bool IsSignalFrame_, bool IsSimple_) :
@ -1514,10 +1518,10 @@ void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer, MCAsmBackend *MAB,
Streamer.EmitLabel(SectionStart); Streamer.EmitLabel(SectionStart);
Emitter.setSectionStart(SectionStart); Emitter.setSectionStart(SectionStart);
MCSymbol *FDEEnd = NULL; MCSymbol *FDEEnd = nullptr;
DenseMap<CIEKey, const MCSymbol*> CIEStarts; DenseMap<CIEKey, const MCSymbol*> CIEStarts;
const MCSymbol *DummyDebugKey = NULL; const MCSymbol *DummyDebugKey = nullptr;
NeedsEHFrameSection = !MOFI->getSupportsCompactUnwindWithoutEHFrame(); NeedsEHFrameSection = !MOFI->getSupportsCompactUnwindWithoutEHFrame();
for (unsigned i = 0, n = FrameArray.size(); i < n; ++i) { for (unsigned i = 0, n = FrameArray.size(); i < n; ++i) {
const MCDwarfFrameInfo &Frame = FrameArray[i]; const MCDwarfFrameInfo &Frame = FrameArray[i];
@ -1525,7 +1529,7 @@ void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer, MCAsmBackend *MAB,
// Emit the label from the previous iteration // Emit the label from the previous iteration
if (FDEEnd) { if (FDEEnd) {
Streamer.EmitLabel(FDEEnd); Streamer.EmitLabel(FDEEnd);
FDEEnd = NULL; FDEEnd = nullptr;
} }
if (!NeedsEHFrameSection && Frame.CompactUnwindEncoding != if (!NeedsEHFrameSection && Frame.CompactUnwindEncoding !=

View File

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

View File

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

View File

@ -83,7 +83,7 @@ bool MCExternalSymbolizer::tryAddingSymbolicOperand(MCInst &MI,
return false; return false;
} }
const MCExpr *Add = NULL; const MCExpr *Add = nullptr;
if (SymbolicOp.AddSymbol.Present) { if (SymbolicOp.AddSymbol.Present) {
if (SymbolicOp.AddSymbol.Name) { if (SymbolicOp.AddSymbol.Name) {
StringRef Name(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.Present) {
if (SymbolicOp.SubtractSymbol.Name) { if (SymbolicOp.SubtractSymbol.Name) {
StringRef Name(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) if (SymbolicOp.Value != 0)
Off = MCConstantExpr::Create(SymbolicOp.Value, Ctx); Off = MCConstantExpr::Create(SymbolicOp.Value, Ctx);
@ -116,17 +116,17 @@ bool MCExternalSymbolizer::tryAddingSymbolicOperand(MCInst &MI,
LHS = MCBinaryExpr::CreateSub(Add, Sub, Ctx); LHS = MCBinaryExpr::CreateSub(Add, Sub, Ctx);
else else
LHS = MCUnaryExpr::CreateMinus(Sub, Ctx); LHS = MCUnaryExpr::CreateMinus(Sub, Ctx);
if (Off != 0) if (Off)
Expr = MCBinaryExpr::CreateAdd(LHS, Off, Ctx); Expr = MCBinaryExpr::CreateAdd(LHS, Off, Ctx);
else else
Expr = LHS; Expr = LHS;
} else if (Add) { } else if (Add) {
if (Off != 0) if (Off)
Expr = MCBinaryExpr::CreateAdd(Add, Off, Ctx); Expr = MCBinaryExpr::CreateAdd(Add, Off, Ctx);
else else
Expr = Add; Expr = Add;
} else { } else {
if (Off != 0) if (Off)
Expr = Off; Expr = Off;
else else
Expr = MCConstantExpr::Create(0, Ctx); Expr = MCConstantExpr::Create(0, Ctx);
@ -189,7 +189,7 @@ MCSymbolizer *createMCSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo,
void *DisInfo, void *DisInfo,
MCContext *Ctx, MCContext *Ctx,
MCRelocationInfo *RelInfo) { MCRelocationInfo *RelInfo) {
assert(Ctx != 0 && "No MCContext given for symbolic disassembly"); assert(Ctx && "No MCContext given for symbolic disassembly");
return new MCExternalSymbolizer(*Ctx, return new MCExternalSymbolizer(*Ctx,
std::unique_ptr<MCRelocationInfo>(RelInfo), 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) for (const_iterator I = begin(), E = end(); I != E; ++I)
if ((*I)->getInsts()->getBeginAddr() == StartAddr) if ((*I)->getInsts()->getBeginAddr() == StartAddr)
return *I; return *I;
return 0; return nullptr;
} }
const MCBasicBlock *MCFunction::find(uint64_t StartAddr) const { 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) #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void MCOperand::dump() const { void MCOperand::dump() const {
print(dbgs(), 0); print(dbgs(), nullptr);
dbgs() << "\n"; dbgs() << "\n";
} }
#endif #endif
@ -66,7 +66,7 @@ void MCInst::dump_pretty(raw_ostream &OS, const MCAsmInfo *MAI,
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void MCInst::dump() const { void MCInst::dump() const {
print(dbgs(), 0); print(dbgs(), nullptr);
dbgs() << "\n"; dbgs() << "\n";
} }
#endif #endif

View File

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

View File

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

View File

@ -64,7 +64,7 @@ namespace {
unsigned ByteAlignment) override {} unsigned ByteAlignment) override {}
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override {} 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 {} uint64_t Size = 0, unsigned ByteAlignment = 0) override {}
void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol, void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) override {} uint64_t Size, unsigned ByteAlignment) override {}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -669,7 +669,7 @@ IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
// - addr(atom(B)) - offset(B) // - addr(atom(B)) - offset(B)
// and the offsets are not relocatable, so the fixup is fully resolved when // and the offsets are not relocatable, so the fixup is fully resolved when
// addr(atom(A)) - addr(atom(B)) == 0. // 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 MCSymbol &SA = DataA.getSymbol().AliasedSymbol();
const MCSection &SecA = SA.getSection(); const MCSection &SecA = SA.getSection();

View File

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

View File

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

View File

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