/// 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
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);
// Check for sentinel.
if (!Prev->getNext())
- return 0;
+ return nullptr;
return Prev;
}
// Check for sentinel.
if (!Next->getNext())
- return 0;
+ return nullptr;
return Next;
}
/// 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 *
/// @}
protected:
- MCFragment(FragmentType _Kind, MCSectionData *_Parent = 0);
+ MCFragment(FragmentType _Kind, MCSectionData *_Parent = nullptr);
public:
// Only for sentinel.
uint8_t BundlePadding;
public:
- MCEncodedFragment(MCFragment::FragmentType FType, MCSectionData *SD = 0)
+ MCEncodedFragment(MCFragment::FragmentType FType, MCSectionData *SD = nullptr)
: MCFragment(FType, SD), BundlePadding(0)
{
}
public:
MCEncodedFragmentWithFixups(MCFragment::FragmentType FType,
- MCSectionData *SD = 0)
+ MCSectionData *SD = nullptr)
: MCEncodedFragment(FType, SD)
{
}
/// 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)
{
SmallVector<char, 4> Contents;
public:
- MCCompactEncodedInstFragment(MCSectionData *SD = 0)
+ MCCompactEncodedInstFragment(MCSectionData *SD = nullptr)
: MCEncodedFragment(FT_CompactEncodedInst, SD), AlignToBundleEnd(false)
{
}
public:
MCRelaxableFragment(const MCInst &_Inst,
const MCSubtargetInfo &_STI,
- MCSectionData *SD = 0)
+ MCSectionData *SD = nullptr)
: MCEncodedFragmentWithFixups(FT_Relaxable, SD), Inst(_Inst), STI(_STI) {
}
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) {}
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) &&
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) {}
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); }
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); }
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); }
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; }
// Only for use as sentinel.
MCSymbolData();
MCSymbolData(const MCSymbol &_Symbol, MCFragment *_Fragment, uint64_t _Offset,
- MCAssembler *A = 0);
+ MCAssembler *A = nullptr);
/// @name Accessors
/// @{
}
MCSectionData &getOrCreateSectionData(const MCSection &Section,
- bool *Created = 0) {
+ bool *Created = nullptr) {
MCSectionData *&Entry = SectionMap[&Section];
if (Created) *Created = !Entry;
}
bool hasSymbolData(const MCSymbol &Symbol) const {
- return SymbolMap.lookup(&Symbol) != 0;
+ return SymbolMap.lookup(&Symbol) != nullptr;
}
MCSymbolData &getSymbolData(const MCSymbol &Symbol) const {
}
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;
}
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; }
SectionKind Kind,
StringRef COMDATSymName,
int Selection,
- const MCSectionCOFF *Assoc = 0);
+ const MCSectionCOFF *Assoc = nullptr);
const MCSectionCOFF *getCOFFSection(StringRef Section,
unsigned Characteristics,
/// Constructor - Performs initial setup for the disassembler.
MCDisassembler(const MCSubtargetInfo &STI)
- : STI(STI), Symbolizer(), CommentStream(0) {}
+ : STI(STI), Symbolizer(), CommentStream(nullptr) {}
virtual ~MCDisassembler();
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;
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;
/// \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;
}
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();
/// \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;
/// \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;
/// \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)))
/// 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)
/// 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.
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
void operator++() {
// The end of the list is encoded as a 0 differential.
if (!advance())
- List = 0;
+ List = nullptr;
}
};
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;
}
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();
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;
/// @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;
/// 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;
/// @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.
///
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;
///
/// 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
/// setUndefined - Mark the symbol as undefined.
void setUndefined() {
- Section = 0;
+ Section = nullptr;
}
/// setAbsolute - Mark the symbol as absolute.
/// isVariable - Check if this is a variable symbol.
bool isVariable() const {
- return Value != 0;
+ return Value != nullptr;
}
/// getVariableValue() - Get the value for variable symbols.
/// 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!");
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;
}
};
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;
/// @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);
}
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) {}
/// \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.
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;
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 {
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 {
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?
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);
}
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)
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);
}
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!");
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;
}
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.
}
// 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("");
const ObjectFile *OwningObject;
public:
- DiceRef() : OwningObject(NULL) { }
+ DiceRef() : OwningObject(nullptr) { }
DiceRef(DataRefImpl DiceP, const ObjectFile *Owner);
const ObjectFile *OwningObject;
public:
- RelocationRef() : OwningObject(NULL) { }
+ RelocationRef() : OwningObject(nullptr) { }
RelocationRef(DataRefImpl RelocationP, const ObjectFile *Owner);
const ObjectFile *OwningObject;
public:
- SectionRef() : OwningObject(NULL) { }
+ SectionRef() : OwningObject(nullptr) { }
SectionRef(DataRefImpl SectionP, const ObjectFile *Owner);
const ObjectFile *OwningObject;
public:
- LibraryRef() : OwningObject(NULL) { }
+ LibraryRef() : OwningObject(nullptr) { }
LibraryRef(DataRefImpl LibraryP, const ObjectFile *Owner);
// (e.g. section symbols)
};
- BasicSymbolRef() : OwningObject(NULL) { }
+ BasicSymbolRef() : OwningObject(nullptr) { }
BasicSymbolRef(DataRefImpl SymbolP, const SymbolicFile *Owner);
bool operator==(const BasicSymbolRef &Other) const;
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);
}
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 {
static double test(...);
public:
- static bool const value = (sizeof(test<ScalarEnumerationTraits<T> >(0)) == 1);
+ static bool const value =
+ (sizeof(test<ScalarEnumerationTraits<T> >(nullptr)) == 1);
};
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.
static double test(...);
public:
- static bool const value = (sizeof(test<SequenceTraits<T> >(0)) == 1);
+ static bool const value = (sizeof(test<SequenceTraits<T> >(nullptr)) == 1);
};
static char (&f(...))[2];
public:
- static bool const value = sizeof(f<Derived>(0)) == 2;
+ static bool const value = sizeof(f<Derived>(nullptr)) == 2;
};
Symbol = &A->getSymbol();
Data = &Layout.getAssembler().getSymbolData(*Symbol);
} else {
- Symbol = 0;
- Data = 0;
+ Symbol = nullptr;
+ Data = nullptr;
}
}
UsesELFSectionDirectiveForBSS = false;
AlignmentIsInBytes = true;
TextAlignFillValue = 0;
- GPRel64Directive = 0;
- GPRel32Directive = 0;
+ GPRel64Directive = nullptr;
+ GPRel32Directive = nullptr;
GlobalDirective = "\t.globl\t";
HasSetDirective = true;
HasAggressiveSymbolFolding = true;
HasSingleParameterDotFile = true;
HasIdentDirective = false;
HasNoDeadStrip = false;
- WeakRefDirective = 0;
+ WeakRefDirective = nullptr;
HasWeakDefDirective = false;
HasWeakDefCanBeHiddenDirective = false;
HasLinkOnceDirective = false;
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,
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) {
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) {
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);
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;
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;
}
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();
}
MCSymbolData *&Entry = SymbolMap[Symbol];
if (!Entry)
- Entry = new MCSymbolData(*Symbol, 0, 0, 0);
+ Entry = new MCSymbolData(*Symbol, nullptr, 0, nullptr);
return *Entry;
}
}
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);
/* *** */
-MCSectionData::MCSectionData() : Section(0) {}
+MCSectionData::MCSectionData() : Section(nullptr) {}
MCSectionData::MCSectionData(const MCSection &_Section, MCAssembler *A)
: Section(&_Section),
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;
/* *** */
-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)
// 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();
// 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) {
CompilationDir.clear();
SecureLogFile = getenv("AS_SECURE_LOG_FILE");
- SecureLog = 0;
+ SecureLog = nullptr;
SecureLogUsed = false;
if (SrcMgr && SrcMgr->getNumBuffers() > 0)
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;
EntrySize = MCSectionELF::DetermineEntrySize(Kind);
}
- MCSymbol *GroupSym = NULL;
+ MCSymbol *GroupSym = nullptr;
if (!Group.empty())
GroupSym = GetOrCreateSymbol(Group);
const MCSectionELF *MCContext::CreateELFGroupSection() {
MCSectionELF *Result =
new (*this) MCSectionELF(".group", ELF::SHT_GROUP, 0,
- SectionKind::getReadOnly(), 4, NULL);
+ SectionKind::getReadOnly(), 4, nullptr);
return Result;
}
// 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);
SectionGroupPair P(Section, "");
auto Iter = COFFUniquingMap.find(P);
if (Iter == COFFUniquingMap.end())
- return 0;
+ return nullptr;
return Iter->second;
}
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(),
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();
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,
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; }
if (!IsSimple) {
const std::vector<MCCFIInstruction> &Instructions =
MAI->getInitialFrameState();
- EmitCFIInstructions(streamer, Instructions, NULL);
+ EmitCFIInstructions(streamer, Instructions, nullptr);
}
// Padding
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_) :
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];
// Emit the label from the previous iteration
if (FDEEnd) {
Streamer.EmitLabel(FDEEnd);
- FDEEnd = NULL;
+ FDEEnd = nullptr;
}
if (!NeedsEHFrameSection && Frame.CompactUnwindEncoding !=
}
void MCELFStreamer::FinishImpl() {
- EmitFrames(NULL, true);
+ EmitFrames(nullptr, true);
Flush();
/* *** */
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,
}
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,
// Clear the symbol expr pointers to indicate we have folded these
// operands.
- A = B = 0;
+ A = B = nullptr;
return;
}
// 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.
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,
}
}
- Res = MCValue::get(SRE, 0, 0);
+ Res = MCValue::get(SRE, nullptr, 0);
return true;
}
if (Sym.isDefined())
return &Sym.getSection();
- return 0;
+ return nullptr;
}
case Unary:
return false;
}
- const MCExpr *Add = NULL;
+ const MCExpr *Add = nullptr;
if (SymbolicOp.AddSymbol.Present) {
if (SymbolicOp.AddSymbol.Name) {
StringRef Name(SymbolicOp.AddSymbol.Name);
}
}
- const MCExpr *Sub = NULL;
+ const MCExpr *Sub = nullptr;
if (SymbolicOp.SubtractSymbol.Present) {
if (SymbolicOp.SubtractSymbol.Name) {
StringRef Name(SymbolicOp.SubtractSymbol.Name);
}
}
- const MCExpr *Off = NULL;
+ const MCExpr *Off = nullptr;
if (SymbolicOp.Value != 0)
Off = MCConstantExpr::Create(SymbolicOp.Value, Ctx);
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);
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),
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 {
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void MCOperand::dump() const {
- print(dbgs(), 0);
+ print(dbgs(), nullptr);
dbgs() << "\n";
}
#endif
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void MCInst::dump() const {
- print(dbgs(), 0);
+ print(dbgs(), nullptr);
dbgs() << "\n";
}
#endif
}
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;
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);
}
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);
// 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);
// 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))
Addr, AtomComp);
if (I != atom_end() && (*I)->getBeginAddr() <= Addr)
return *I;
- return 0;
+ return nullptr;
}
MCAtom *MCModule::findAtomContaining(uint64_t Addr) {
Addr, AtomCompInv);
if (I != atom_end())
return *I;
- return 0;
+ return nullptr;
}
MCAtom *MCModule::findFirstAtomAfter(uint64_t Addr) {
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 {}
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()) {
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) {
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)
BBInfoSetTy Preds;
MCObjectDisassembler::AddressSetTy SuccAddrs;
- BBInfo() : Atom(0), BB(0) {}
+ BBInfo() : Atom(nullptr), BB(nullptr) {}
void addSucc(BBInfo &Succ) {
Succs.insert(&Succ);
SectionKind::getDataRel());
// BSSSection might not be expected initialized on msvc.
- BSSSection = 0;
+ BSSSection = nullptr;
TLSDataSection // .tdata
= Ctx->getMachOSection("__DATA", "__thread_data",
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)) {
ELF::SHF_ALLOC,
SectionKind::getReadOnly());
- COFFDebugSymbolsSection = 0;
+ COFFDebugSymbolsSection = nullptr;
// Debug Info Sections.
DwarfAbbrevSection =
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();
: 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();
void MCObjectStreamer::reset() {
if (Assembler)
Assembler->reset();
- CurSectionData = 0;
+ CurSectionData = nullptr;
CurInsertionPoint = MCSectionData::iterator();
MCStreamer::reset();
}
if (CurInsertionPoint != getCurrentSectionData()->getFragmentList().begin())
return std::prev(CurInsertionPoint);
- return 0;
+ return nullptr;
}
MCDataFragment *MCObjectStreamer::getOrCreateDataFragment() const {
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;
}
AddrToRelocMap::const_iterator RI = AddrToReloc.find(Addr);
if (RI == AddrToReloc.end())
- return 0;
+ return nullptr;
return &RI->second;
}
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;
}
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;
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
{ "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
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,
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>());
}
W64UnwindInfos.clear();
EmitEHFrame = true;
EmitDebugFrame = false;
- CurrentW64UnwindInfo = 0;
- LastSymbol = 0;
+ CurrentW64UnwindInfo = nullptr;
+ LastSymbol = nullptr;
SectionStack.clear();
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
}
MCDwarfFrameInfo *MCStreamer::getCurrentFrameInfo() {
if (FrameInfos.empty())
- return 0;
+ return nullptr;
return &FrameInfos.back();
}
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) {
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void MCValue::dump() const {
- print(dbgs(), 0);
+ print(dbgs(), nullptr);
}
#endif
// - 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();
// 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;
}
COFF::relocation Data;
COFFSymbol *Symb;
- COFFRelocation() : Symb(NULL) {}
+ COFFRelocation() : Symb(nullptr) {}
static size_t size() { return COFF::RelocationSize; }
};
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));
}
/// 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
COFFSection::COFFSection(StringRef name)
: Name(name)
- , MCData(NULL)
- , Symbol(NULL) {
+ , MCData(nullptr)
+ , Symbol(nullptr) {
memset(&Header, 0, sizeof(Header));
}
// 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;
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()];
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();
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)
// 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!");
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
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!");
}
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");
}
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) {
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);
}
void WinCOFFStreamer::FinishImpl() {
- EmitFrames(NULL, true);
+ EmitFrames(nullptr, true);
EmitW64Tables();
MCObjectStreamer::FinishImpl();
}