[C++11] Make use of 'nullptr' in the Support library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205697 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2014-04-07 04:17:22 +00:00
parent b81024bc6e
commit 34bc6b6e78
75 changed files with 336 additions and 328 deletions

View File

@ -236,19 +236,19 @@ public:
APInt fill(64, type); APInt fill(64, type);
return getQNaN(Sem, Negative, &fill); return getQNaN(Sem, Negative, &fill);
} else { } else {
return getQNaN(Sem, Negative, 0); return getQNaN(Sem, Negative, nullptr);
} }
} }
/// Factory for QNaN values. /// Factory for QNaN values.
static APFloat getQNaN(const fltSemantics &Sem, bool Negative = false, static APFloat getQNaN(const fltSemantics &Sem, bool Negative = false,
const APInt *payload = 0) { const APInt *payload = nullptr) {
return makeNaN(Sem, false, Negative, payload); return makeNaN(Sem, false, Negative, payload);
} }
/// Factory for SNaN values. /// Factory for SNaN values.
static APFloat getSNaN(const fltSemantics &Sem, bool Negative = false, static APFloat getSNaN(const fltSemantics &Sem, bool Negative = false,
const APInt *payload = 0) { const APInt *payload = nullptr) {
return makeNaN(Sem, true, Negative, payload); return makeNaN(Sem, true, Negative, payload);
} }
@ -500,7 +500,8 @@ private:
void makeLargest(bool Neg = false); void makeLargest(bool Neg = false);
void makeSmallest(bool Neg = false); void makeSmallest(bool Neg = false);
void makeNaN(bool SNaN = false, bool Neg = false, const APInt *fill = 0); void makeNaN(bool SNaN = false, bool Neg = false,
const APInt *fill = nullptr);
static APFloat makeNaN(const fltSemantics &Sem, bool SNaN, bool Negative, static APFloat makeNaN(const fltSemantics &Sem, bool SNaN, bool Negative,
const APInt *fill); const APInt *fill);
void makeInf(bool Neg = false); void makeInf(bool Neg = false);

View File

@ -52,7 +52,7 @@ namespace llvm {
/*implicit*/ ArrayRef() : Data(0), Length(0) {} /*implicit*/ ArrayRef() : Data(0), Length(0) {}
/// Construct an empty ArrayRef from None. /// Construct an empty ArrayRef from None.
/*implicit*/ ArrayRef(NoneType) : Data(0), Length(0) {} /*implicit*/ ArrayRef(NoneType) : Data(nullptr), Length(0) {}
/// Construct an ArrayRef from a single element. /// Construct an ArrayRef from a single element.
/*implicit*/ ArrayRef(const T &OneElt) /*implicit*/ ArrayRef(const T &OneElt)

View File

@ -461,12 +461,12 @@ private:
const unsigned NumBuckets = getNumBuckets(); const unsigned NumBuckets = getNumBuckets();
if (NumBuckets == 0) { if (NumBuckets == 0) {
FoundBucket = 0; FoundBucket = nullptr;
return false; return false;
} }
// FoundTombstone - Keep track of whether we find a tombstone while probing. // FoundTombstone - Keep track of whether we find a tombstone while probing.
const BucketT *FoundTombstone = 0; const BucketT *FoundTombstone = nullptr;
const KeyT EmptyKey = getEmptyKey(); const KeyT EmptyKey = getEmptyKey();
const KeyT TombstoneKey = getTombstoneKey(); const KeyT TombstoneKey = getTombstoneKey();
assert(!KeyInfoT::isEqual(Val, EmptyKey) && assert(!KeyInfoT::isEqual(Val, EmptyKey) &&
@ -665,7 +665,7 @@ private:
bool allocateBuckets(unsigned Num) { bool allocateBuckets(unsigned Num) {
NumBuckets = Num; NumBuckets = Num;
if (NumBuckets == 0) { if (NumBuckets == 0) {
Buckets = 0; Buckets = nullptr;
return false; return false;
} }

View File

@ -137,7 +137,7 @@ public:
public: public:
Node() : NextInFoldingSetBucket(0) {} Node() : NextInFoldingSetBucket(nullptr) {}
// Accessors // Accessors
void *getNextInBucket() const { return NextInFoldingSetBucket; } void *getNextInBucket() const { return NextInFoldingSetBucket; }
@ -269,7 +269,7 @@ class FoldingSetNodeIDRef {
const unsigned *Data; const unsigned *Data;
size_t Size; size_t Size;
public: public:
FoldingSetNodeIDRef() : Data(0), Size(0) {} FoldingSetNodeIDRef() : Data(nullptr), Size(0) {}
FoldingSetNodeIDRef(const unsigned *D, size_t S) : Data(D), Size(S) {} FoldingSetNodeIDRef(const unsigned *D, size_t S) : Data(D), Size(S) {}
/// ComputeHash - Compute a strong hash value for this FoldingSetNodeIDRef, /// ComputeHash - Compute a strong hash value for this FoldingSetNodeIDRef,

View File

@ -139,7 +139,7 @@ public:
public: public:
typedef T element_type; typedef T element_type;
explicit IntrusiveRefCntPtr() : Obj(0) {} explicit IntrusiveRefCntPtr() : Obj(nullptr) {}
IntrusiveRefCntPtr(T* obj) : Obj(obj) { IntrusiveRefCntPtr(T* obj) : Obj(obj) {
retain(); retain();
@ -150,7 +150,7 @@ public:
} }
IntrusiveRefCntPtr(IntrusiveRefCntPtr&& S) : Obj(S.Obj) { IntrusiveRefCntPtr(IntrusiveRefCntPtr&& S) : Obj(S.Obj) {
S.Obj = 0; S.Obj = nullptr;
} }
template <class X> template <class X>
@ -179,7 +179,7 @@ public:
typedef T* (IntrusiveRefCntPtr::*unspecified_bool_type) () const; typedef T* (IntrusiveRefCntPtr::*unspecified_bool_type) () const;
operator unspecified_bool_type() const { operator unspecified_bool_type() const {
return Obj == 0 ? 0 : &IntrusiveRefCntPtr::getPtr; return Obj == nullptr ? nullptr : &IntrusiveRefCntPtr::getPtr;
} }
void swap(IntrusiveRefCntPtr& other) { void swap(IntrusiveRefCntPtr& other) {
@ -190,7 +190,7 @@ public:
void reset() { void reset() {
release(); release();
Obj = 0; Obj = nullptr;
} }
void resetWithoutRelease() { void resetWithoutRelease() {

View File

@ -50,7 +50,7 @@ protected:
protected: protected:
explicit StringMapImpl(unsigned itemSize) : ItemSize(itemSize) { explicit StringMapImpl(unsigned itemSize) : ItemSize(itemSize) {
// Initialize the map with zero buckets to allocation. // Initialize the map with zero buckets to allocation.
TheTable = 0; TheTable = nullptr;
NumBuckets = 0; NumBuckets = 0;
NumItems = 0; NumItems = 0;
NumTombstones = 0; NumTombstones = 0;
@ -330,7 +330,7 @@ public:
if (Bucket && Bucket != getTombstoneVal()) { if (Bucket && Bucket != getTombstoneVal()) {
static_cast<MapEntryTy*>(Bucket)->Destroy(Allocator); static_cast<MapEntryTy*>(Bucket)->Destroy(Allocator);
} }
Bucket = 0; Bucket = nullptr;
} }
NumItems = 0; NumItems = 0;
@ -410,7 +410,7 @@ protected:
public: public:
typedef StringMapEntry<ValueTy> value_type; typedef StringMapEntry<ValueTy> value_type;
StringMapConstIterator() : Ptr(0) { } StringMapConstIterator() : Ptr(nullptr) { }
explicit StringMapConstIterator(StringMapEntryBase **Bucket, explicit StringMapConstIterator(StringMapEntryBase **Bucket,
bool NoAdvance = false) bool NoAdvance = false)
@ -443,7 +443,7 @@ public:
private: private:
void AdvancePastEmptyBuckets() { void AdvancePastEmptyBuckets() {
while (*Ptr == 0 || *Ptr == StringMapImpl::getTombstoneVal()) while (*Ptr == nullptr || *Ptr == StringMapImpl::getTombstoneVal())
++Ptr; ++Ptr;
} }
}; };

View File

@ -70,7 +70,7 @@ namespace llvm {
/// @{ /// @{
/// Construct an empty string ref. /// Construct an empty string ref.
/*implicit*/ StringRef() : Data(0), Length(0) {} /*implicit*/ StringRef() : Data(nullptr), Length(0) {}
/// Construct a string ref from a cstring. /// Construct a string ref from a cstring.
/*implicit*/ StringRef(const char *Str) /*implicit*/ StringRef(const char *Str)
@ -186,7 +186,7 @@ namespace llvm {
/// str - Get the contents as an std::string. /// str - Get the contents as an std::string.
std::string str() const { std::string str() const {
if (Data == 0) return std::string(); if (Data == nullptr) return std::string();
return std::string(Data, Length); return std::string(Data, Length);
} }

View File

@ -49,7 +49,7 @@ class StringSwitch {
public: public:
explicit StringSwitch(StringRef S) explicit StringSwitch(StringRef S)
: Str(S), Result(0) { } : Str(S), Result(nullptr) { }
template<unsigned N> template<unsigned N>
StringSwitch& Case(const char (&S)[N], const T& Value) { StringSwitch& Case(const char (&S)[N], const T& Value) {

View File

@ -374,7 +374,7 @@ namespace llvm {
static Twine utohexstr(const uint64_t &Val) { static Twine utohexstr(const uint64_t &Val) {
Child LHS, RHS; Child LHS, RHS;
LHS.uHex = &Val; LHS.uHex = &Val;
RHS.twine = 0; RHS.twine = nullptr;
return Twine(LHS, UHexKind, RHS, EmptyKind); return Twine(LHS, UHexKind, RHS, EmptyKind);
} }

View File

@ -175,7 +175,7 @@ public:
ilist_iterator(pointer NP) : NodePtr(NP) {} ilist_iterator(pointer NP) : NodePtr(NP) {}
ilist_iterator(reference NR) : NodePtr(&NR) {} ilist_iterator(reference NR) : NodePtr(&NR) {}
ilist_iterator() : NodePtr(0) {} ilist_iterator() : NodePtr(nullptr) {}
// This is templated so that we can allow constructing a const iterator from // This is templated so that we can allow constructing a const iterator from
// a nonconst iterator... // a nonconst iterator...
@ -383,7 +383,7 @@ public:
// Miscellaneous inspection routines. // Miscellaneous inspection routines.
size_type max_size() const { return size_type(-1); } size_type max_size() const { return size_type(-1); }
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const {
return Head == 0 || Head == getTail(); return Head == nullptr || Head == getTail();
} }
// Front and back accessor functions... // Front and back accessor functions...
@ -451,8 +451,8 @@ public:
// an ilist (and potentially deleted) with iterators still pointing at it. // an ilist (and potentially deleted) with iterators still pointing at it.
// When those iterators are incremented or decremented, they will assert on // When those iterators are incremented or decremented, they will assert on
// the null next/prev pointer instead of "usually working". // the null next/prev pointer instead of "usually working".
this->setNext(Node, 0); this->setNext(Node, nullptr);
this->setPrev(Node, 0); this->setPrev(Node, nullptr);
return Node; return Node;
} }

View File

@ -30,7 +30,7 @@ protected:
NodeTy *getPrev() { return Prev; } NodeTy *getPrev() { return Prev; }
const NodeTy *getPrev() const { return Prev; } const NodeTy *getPrev() const { return Prev; }
void setPrev(NodeTy *P) { Prev = P; } void setPrev(NodeTy *P) { Prev = P; }
ilist_half_node() : Prev(0) {} ilist_half_node() : Prev(nullptr) {}
}; };
template<typename NodeTy> template<typename NodeTy>
@ -48,7 +48,7 @@ class ilist_node : private ilist_half_node<NodeTy> {
const NodeTy *getNext() const { return Next; } const NodeTy *getNext() const { return Next; }
void setNext(NodeTy *N) { Next = N; } void setNext(NodeTy *N) { Next = N; }
protected: protected:
ilist_node() : Next(0) {} ilist_node() : Next(nullptr) {}
public: public:
/// @name Adjacent Node Accessors /// @name Adjacent Node Accessors

View File

@ -106,7 +106,7 @@ protected:
/// Used so that we can compute how much space was wasted. /// Used so that we can compute how much space was wasted.
size_t BytesAllocated; size_t BytesAllocated;
BumpPtrAllocatorBase() : CurSlab(0), BytesAllocated(0) {} BumpPtrAllocatorBase() : CurSlab(nullptr), BytesAllocated(0) {}
}; };
/// \brief Allocate memory in an ever growing pool, as if by bump-pointer. /// \brief Allocate memory in an ever growing pool, as if by bump-pointer.
@ -142,7 +142,7 @@ public:
if (!CurSlab) if (!CurSlab)
return; return;
DeallocateSlabs(CurSlab->NextPtr); DeallocateSlabs(CurSlab->NextPtr);
CurSlab->NextPtr = 0; CurSlab->NextPtr = nullptr;
CurPtr = (char *)(CurSlab + 1); CurPtr = (char *)(CurSlab + 1);
End = ((char *)CurSlab) + CurSlab->Size; End = ((char *)CurSlab) + CurSlab->Size;
BytesAllocated = 0; BytesAllocated = 0;

View File

@ -275,7 +275,7 @@ dyn_cast(Y &Val) {
template <class X, class Y> template <class X, class Y>
LLVM_ATTRIBUTE_UNUSED_RESULT inline typename cast_retty<X, Y *>::ret_type LLVM_ATTRIBUTE_UNUSED_RESULT inline typename cast_retty<X, Y *>::ret_type
dyn_cast(Y *Val) { dyn_cast(Y *Val) {
return isa<X>(Val) ? cast<X>(Val) : 0; return isa<X>(Val) ? cast<X>(Val) : nullptr;
} }
// dyn_cast_or_null<X> - Functionally identical to dyn_cast, except that a null // dyn_cast_or_null<X> - Functionally identical to dyn_cast, except that a null
@ -284,7 +284,7 @@ dyn_cast(Y *Val) {
template <class X, class Y> template <class X, class Y>
LLVM_ATTRIBUTE_UNUSED_RESULT inline typename cast_retty<X, Y *>::ret_type LLVM_ATTRIBUTE_UNUSED_RESULT inline typename cast_retty<X, Y *>::ret_type
dyn_cast_or_null(Y *Val) { dyn_cast_or_null(Y *Val) {
return (Val && isa<X>(Val)) ? cast<X>(Val) : 0; return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr;
} }
} // End llvm namespace } // End llvm namespace

View File

@ -41,14 +41,14 @@ namespace cl {
// ParseCommandLineOptions - Command line option processing entry point. // ParseCommandLineOptions - Command line option processing entry point.
// //
void ParseCommandLineOptions(int argc, const char * const *argv, void ParseCommandLineOptions(int argc, const char * const *argv,
const char *Overview = 0); const char *Overview = nullptr);
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// ParseEnvironmentOptions - Environment variable option processing alternate // ParseEnvironmentOptions - Environment variable option processing alternate
// entry point. // entry point.
// //
void ParseEnvironmentOptions(const char *progName, const char *envvar, void ParseEnvironmentOptions(const char *progName, const char *envvar,
const char *Overview = 0); const char *Overview = nullptr);
///===---------------------------------------------------------------------===// ///===---------------------------------------------------------------------===//
/// SetVersionPrinter - Override the default (LLVM specific) version printer /// SetVersionPrinter - Override the default (LLVM specific) version printer
@ -146,7 +146,7 @@ private:
const char *const Description; const char *const Description;
void registerCategory(); void registerCategory();
public: public:
OptionCategory(const char *const Name, const char *const Description = 0) OptionCategory(const char *const Name, const char *const Description = nullptr)
: Name(Name), Description(Description) { registerCategory(); } : Name(Name), Description(Description) { registerCategory(); }
const char *getName() const { return Name; } const char *getName() const { return Name; }
const char *getDescription() const { return Description; } const char *getDescription() const { return Description; }
@ -238,7 +238,7 @@ protected:
enum OptionHidden Hidden) enum OptionHidden Hidden)
: NumOccurrences(0), Occurrences(OccurrencesFlag), Value(0), : NumOccurrences(0), Occurrences(OccurrencesFlag), Value(0),
HiddenFlag(Hidden), Formatting(NormalFormatting), Misc(0), HiddenFlag(Hidden), Formatting(NormalFormatting), Misc(0),
Position(0), AdditionalVals(0), NextRegistered(0), Position(0), AdditionalVals(0), NextRegistered(nullptr),
ArgStr(""), HelpStr(""), ValueStr(""), Category(&GeneralCategory) { ArgStr(""), HelpStr(""), ValueStr(""), Category(&GeneralCategory) {
} }
@ -763,7 +763,7 @@ public:
} }
// getValueName - Do not print =<value> at all. // getValueName - Do not print =<value> at all.
const char *getValueName() const override { return 0; } const char *getValueName() const override { return nullptr; }
void printOptionDiff(const Option &O, bool V, OptVal Default, void printOptionDiff(const Option &O, bool V, OptVal Default,
size_t GlobalWidth) const; size_t GlobalWidth) const;
@ -787,7 +787,7 @@ public:
} }
// getValueName - Do not print =<value> at all. // getValueName - Do not print =<value> at all.
const char *getValueName() const override { return 0; } const char *getValueName() const override { return nullptr; }
void printOptionDiff(const Option &O, boolOrDefault V, OptVal Default, void printOptionDiff(const Option &O, boolOrDefault V, OptVal Default,
size_t GlobalWidth) const; size_t GlobalWidth) const;
@ -1068,7 +1068,7 @@ class opt_storage {
"or cl::init specified before cl::location()!!"); "or cl::init specified before cl::location()!!");
} }
public: public:
opt_storage() : Location(0) {} opt_storage() : Location(nullptr) {}
bool setLocation(Option &O, DataType &L) { bool setLocation(Option &O, DataType &L) {
if (Location) if (Location)
@ -1469,7 +1469,7 @@ class bits_storage {
} }
public: public:
bits_storage() : Location(0) {} bits_storage() : Location(nullptr) {}
bool setLocation(Option &O, unsigned &L) { bool setLocation(Option &O, unsigned &L) {
if (Location) if (Location)
@ -1664,7 +1664,7 @@ class alias : public Option {
void done() { void done() {
if (!hasArgStr()) if (!hasArgStr())
error("cl::alias must have argument name specified!"); error("cl::alias must have argument name specified!");
if (AliasFor == 0) if (AliasFor == nullptr)
error("cl::alias must have an cl::aliasopt(option) specified!"); error("cl::alias must have an cl::aliasopt(option) specified!");
addArgument(); addArgument();
} }
@ -1677,27 +1677,28 @@ public:
// One option... // One option...
template<class M0t> template<class M0t>
explicit alias(const M0t &M0) : Option(Optional, Hidden), AliasFor(0) { explicit alias(const M0t &M0) : Option(Optional, Hidden), AliasFor(nullptr) {
apply(M0, this); apply(M0, this);
done(); done();
} }
// Two options... // Two options...
template<class M0t, class M1t> template<class M0t, class M1t>
alias(const M0t &M0, const M1t &M1) : Option(Optional, Hidden), AliasFor(0) { alias(const M0t &M0, const M1t &M1)
: Option(Optional, Hidden), AliasFor(nullptr) {
apply(M0, this); apply(M1, this); apply(M0, this); apply(M1, this);
done(); done();
} }
// Three options... // Three options...
template<class M0t, class M1t, class M2t> template<class M0t, class M1t, class M2t>
alias(const M0t &M0, const M1t &M1, const M2t &M2) alias(const M0t &M0, const M1t &M1, const M2t &M2)
: Option(Optional, Hidden), AliasFor(0) { : Option(Optional, Hidden), AliasFor(nullptr) {
apply(M0, this); apply(M1, this); apply(M2, this); apply(M0, this); apply(M1, this); apply(M2, this);
done(); done();
} }
// Four options... // Four options...
template<class M0t, class M1t, class M2t, class M3t> template<class M0t, class M1t, class M2t, class M3t>
alias(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3) alias(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3)
: Option(Optional, Hidden), AliasFor(0) { : Option(Optional, Hidden), AliasFor(nullptr) {
apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this);
done(); done();
} }

View File

@ -58,7 +58,7 @@ class CrashRecoveryContext {
}; };
public: public:
CrashRecoveryContext() : Impl(0), head(0) {} CrashRecoveryContext() : Impl(nullptr), head(nullptr) {}
~CrashRecoveryContext(); ~CrashRecoveryContext();
void registerCleanup(CrashRecoveryContextCleanup *cleanup); void registerCleanup(CrashRecoveryContextCleanup *cleanup);

View File

@ -65,7 +65,7 @@ namespace sys {
/// It is safe to call this function multiple times for the same library. /// It is safe to call this function multiple times for the same library.
/// @brief Open a dynamic library permanently. /// @brief Open a dynamic library permanently.
static DynamicLibrary getPermanentLibrary(const char *filename, static DynamicLibrary getPermanentLibrary(const char *filename,
std::string *errMsg = 0); std::string *errMsg = nullptr);
/// This function permanently loads the dynamic library at the given path. /// This function permanently loads the dynamic library at the given path.
/// Use this instead of getPermanentLibrary() when you won't need to get /// Use this instead of getPermanentLibrary() when you won't need to get
@ -73,7 +73,7 @@ namespace sys {
/// ///
/// It is safe to call this function multiple times for the same library. /// It is safe to call this function multiple times for the same library.
static bool LoadLibraryPermanently(const char *Filename, static bool LoadLibraryPermanently(const char *Filename,
std::string *ErrMsg = 0) { std::string *ErrMsg = nullptr) {
return !getPermanentLibrary(Filename, ErrMsg).isValid(); return !getPermanentLibrary(Filename, ErrMsg).isValid();
} }

View File

@ -47,7 +47,7 @@ namespace llvm {
/// \param user_data - An argument which will be passed to the install error /// \param user_data - An argument which will be passed to the install error
/// handler. /// handler.
void install_fatal_error_handler(fatal_error_handler_t handler, void install_fatal_error_handler(fatal_error_handler_t handler,
void *user_data = 0); void *user_data = nullptr);
/// Restores default error handling behaviour. /// Restores default error handling behaviour.
/// This must not be called between llvm_start_multithreaded() and /// This must not be called between llvm_start_multithreaded() and
@ -59,7 +59,7 @@ namespace llvm {
/// remove_fatal_error_handler in its destructor. /// remove_fatal_error_handler in its destructor.
struct ScopedFatalErrorHandler { struct ScopedFatalErrorHandler {
explicit ScopedFatalErrorHandler(fatal_error_handler_t handler, explicit ScopedFatalErrorHandler(fatal_error_handler_t handler,
void *user_data = 0) { void *user_data = nullptr) {
install_fatal_error_handler(handler, user_data); install_fatal_error_handler(handler, user_data);
} }
@ -86,9 +86,9 @@ namespace llvm {
/// This function calls abort(), and prints the optional message to stderr. /// This function calls abort(), and prints the optional message to stderr.
/// Use the llvm_unreachable macro (that adds location info), instead of /// Use the llvm_unreachable macro (that adds location info), instead of
/// calling this function directly. /// calling this function directly.
LLVM_ATTRIBUTE_NORETURN void llvm_unreachable_internal(const char *msg=0, LLVM_ATTRIBUTE_NORETURN void
const char *file=0, llvm_unreachable_internal(const char *msg=nullptr, const char *file=nullptr,
unsigned line=0); unsigned line=0);
} }
/// Marks that the current location is not supposed to be reachable. /// Marks that the current location is not supposed to be reachable.

View File

@ -814,7 +814,7 @@ public:
} }
/// Construct end iterator. /// Construct end iterator.
directory_iterator() : State(0) {} directory_iterator() : State(nullptr) {}
// No operator++ because we need error_code. // No operator++ because we need error_code.
directory_iterator &increment(error_code &ec) { directory_iterator &increment(error_code &ec) {
@ -828,9 +828,9 @@ public:
bool operator==(const directory_iterator &RHS) const { bool operator==(const directory_iterator &RHS) const {
if (State == RHS.State) if (State == RHS.State)
return true; return true;
if (RHS.State == 0) if (RHS.State == nullptr)
return State->CurrentEntry == directory_entry(); return State->CurrentEntry == directory_entry();
if (State == 0) if (State == nullptr)
return RHS.State->CurrentEntry == directory_entry(); return RHS.State->CurrentEntry == directory_entry();
return State->CurrentEntry == RHS.State->CurrentEntry; return State->CurrentEntry == RHS.State->CurrentEntry;
} }

View File

@ -30,7 +30,7 @@ namespace llvm {
int DiffFilesWithTolerance(StringRef FileA, int DiffFilesWithTolerance(StringRef FileA,
StringRef FileB, StringRef FileB,
double AbsTol, double RelTol, double AbsTol, double RelTol,
std::string *Error = 0); std::string *Error = nullptr);
/// FileRemover - This class is a simple object meant to be stack allocated. /// FileRemover - This class is a simple object meant to be stack allocated.

View File

@ -85,12 +85,12 @@ public:
/// underneath it. /// underneath it.
/// ///
formatted_raw_ostream(raw_ostream &Stream, bool Delete = false) formatted_raw_ostream(raw_ostream &Stream, bool Delete = false)
: raw_ostream(), TheStream(0), DeleteStream(false), Position(0, 0) { : raw_ostream(), TheStream(nullptr), DeleteStream(false), Position(0, 0) {
setStream(Stream, Delete); setStream(Stream, Delete);
} }
explicit formatted_raw_ostream() explicit formatted_raw_ostream()
: raw_ostream(), TheStream(0), DeleteStream(false), Position(0, 0) { : raw_ostream(), TheStream(nullptr), DeleteStream(false), Position(0, 0) {
Scanned = 0; Scanned = nullptr;
} }
~formatted_raw_ostream() { ~formatted_raw_ostream() {
@ -114,7 +114,7 @@ public:
SetUnbuffered(); SetUnbuffered();
TheStream->SetUnbuffered(); TheStream->SetUnbuffered();
Scanned = 0; Scanned = nullptr;
} }
/// PadToColumn - Align the output to some column number. If the current /// PadToColumn - Align the output to some column number. If the current

View File

@ -259,8 +259,8 @@ public:
/// emitSimpleNode - Outputs a simple (non-record) node /// emitSimpleNode - Outputs a simple (non-record) node
void emitSimpleNode(const void *ID, const std::string &Attr, void emitSimpleNode(const void *ID, const std::string &Attr,
const std::string &Label, unsigned NumEdgeSources = 0, const std::string &Label, unsigned NumEdgeSources = 0,
const std::vector<std::string> *EdgeSourceLabels = 0) { const std::vector<std::string> *EdgeSourceLabels = nullptr) {
O << "\tNode" << ID << "[ "; O << "\tNode" << ID << "[ ";
if (!Attr.empty()) if (!Attr.empty())
O << Attr << ","; O << Attr << ",";

View File

@ -77,7 +77,7 @@ inline unsigned encodeULEB128(uint64_t Value, uint8_t *p,
/// Utility function to decode a ULEB128 value. /// Utility function to decode a ULEB128 value.
inline uint64_t decodeULEB128(const uint8_t *p, unsigned *n = 0) { inline uint64_t decodeULEB128(const uint8_t *p, unsigned *n = nullptr) {
const uint8_t *orig_p = p; const uint8_t *orig_p = p;
uint64_t Value = 0; uint64_t Value = 0;
unsigned Shift = 0; unsigned Shift = 0;

View File

@ -37,7 +37,7 @@ class line_iterator
public: public:
/// \brief Default construct an "end" iterator. /// \brief Default construct an "end" iterator.
line_iterator() : Buffer(0) {} line_iterator() : Buffer(nullptr) {}
/// \brief Construct a new iterator around some memory buffer. /// \brief Construct a new iterator around some memory buffer.
explicit line_iterator(const MemoryBuffer &Buffer, char CommentMarker = '\0'); explicit line_iterator(const MemoryBuffer &Buffer, char CommentMarker = '\0');

View File

@ -47,7 +47,7 @@ protected:
void RegisterManagedStatic(void *(*creator)(), void (*deleter)(void*)) const; void RegisterManagedStatic(void *(*creator)(), void (*deleter)(void*)) const;
public: public:
/// isConstructed - Return true if this object has not been created yet. /// isConstructed - Return true if this object has not been created yet.
bool isConstructed() const { return Ptr != 0; } bool isConstructed() const { return Ptr != nullptr; }
void destroy() const; void destroy() const;
}; };

View File

@ -28,7 +28,7 @@ namespace sys {
/// @brief Memory block abstraction. /// @brief Memory block abstraction.
class MemoryBlock { class MemoryBlock {
public: public:
MemoryBlock() : Address(0), Size(0) { } MemoryBlock() : Address(nullptr), Size(0) { }
MemoryBlock(void *addr, size_t size) : Address(addr), Size(size) { } MemoryBlock(void *addr, size_t size) : Address(addr), Size(size) { }
void *base() const { return Address; } void *base() const { return Address; }
size_t size() const { return Size; } size_t size() const { return Size; }
@ -120,7 +120,7 @@ namespace sys {
/// @brief Allocate Read/Write/Execute memory. /// @brief Allocate Read/Write/Execute memory.
static MemoryBlock AllocateRWX(size_t NumBytes, static MemoryBlock AllocateRWX(size_t NumBytes,
const MemoryBlock *NearBlock, const MemoryBlock *NearBlock,
std::string *ErrMsg = 0); std::string *ErrMsg = nullptr);
/// This method releases a block of Read/Write/Execute memory that was /// This method releases a block of Read/Write/Execute memory that was
/// allocated with the AllocateRWX method. It should not be used to /// allocated with the AllocateRWX method. It should not be used to
@ -129,7 +129,7 @@ namespace sys {
/// On success, this returns false, otherwise it returns true and fills /// On success, this returns false, otherwise it returns true and fills
/// in *ErrMsg. /// in *ErrMsg.
/// @brief Release Read/Write/Execute memory. /// @brief Release Read/Write/Execute memory.
static bool ReleaseRWX(MemoryBlock &block, std::string *ErrMsg = 0); static bool ReleaseRWX(MemoryBlock &block, std::string *ErrMsg = nullptr);
/// InvalidateInstructionCache - Before the JIT can run a block of code /// InvalidateInstructionCache - Before the JIT can run a block of code
@ -140,12 +140,12 @@ namespace sys {
/// setExecutable - Before the JIT can run a block of code, it has to be /// setExecutable - Before the JIT can run a block of code, it has to be
/// given read and executable privilege. Return true if it is already r-x /// given read and executable privilege. Return true if it is already r-x
/// or the system is able to change its previlege. /// or the system is able to change its previlege.
static bool setExecutable(MemoryBlock &M, std::string *ErrMsg = 0); static bool setExecutable(MemoryBlock &M, std::string *ErrMsg = nullptr);
/// setWritable - When adding to a block of code, the JIT may need /// setWritable - When adding to a block of code, the JIT may need
/// to mark a block of code as RW since the protections are on page /// to mark a block of code as RW since the protections are on page
/// boundaries, and the JIT internal allocations are not page aligned. /// boundaries, and the JIT internal allocations are not page aligned.
static bool setWritable(MemoryBlock &M, std::string *ErrMsg = 0); static bool setWritable(MemoryBlock &M, std::string *ErrMsg = nullptr);
/// setRangeExecutable - Mark the page containing a range of addresses /// setRangeExecutable - Mark the page containing a range of addresses
/// as executable. /// as executable.

View File

@ -87,11 +87,11 @@ struct ProcessInfo {
const char **args, ///< A vector of strings that are passed to the const char **args, ///< A vector of strings that are passed to the
///< program. The first element should be the name of the program. ///< program. The first element should be the name of the program.
///< The list *must* be terminated by a null char* entry. ///< The list *must* be terminated by a null char* entry.
const char **env = 0, ///< An optional vector of strings to use for const char **env = nullptr, ///< An optional vector of strings to use for
///< the program's environment. If not provided, the current program's ///< the program's environment. If not provided, the current program's
///< environment will be used. ///< environment will be used.
const StringRef **redirects = 0, ///< An optional array of pointers to const StringRef **redirects = nullptr, ///< An optional array of pointers
///< paths. If the array is null, no redirection is done. The array ///< to paths. If the array is null, no redirection is done. The array
///< should have a size of at least three. The inferior process's ///< should have a size of at least three. The inferior process's
///< stdin(0), stdout(1), and stderr(2) will be redirected to the ///< stdin(0), stdout(1), and stderr(2) will be redirected to the
///< corresponding paths. ///< corresponding paths.
@ -107,11 +107,11 @@ struct ProcessInfo {
///< of memory can be allocated by process. If memory usage will be ///< of memory can be allocated by process. If memory usage will be
///< higher limit, the child is killed and this call returns. If zero ///< higher limit, the child is killed and this call returns. If zero
///< - no memory limit. ///< - no memory limit.
std::string *ErrMsg = 0, ///< If non-zero, provides a pointer to a string std::string *ErrMsg = nullptr, ///< If non-zero, provides a pointer to a
///< instance in which error messages will be returned. If the string ///< string instance in which error messages will be returned. If the
///< is non-empty upon return an error occurred while invoking the ///< string is non-empty upon return an error occurred while invoking the
///< program. ///< program.
bool *ExecutionFailed = 0); bool *ExecutionFailed = nullptr);
/// Similar to ExecuteAndWait, but returns immediately. /// Similar to ExecuteAndWait, but returns immediately.
/// @returns The \see ProcessInfo of the newly launced process. /// @returns The \see ProcessInfo of the newly launced process.
@ -119,9 +119,9 @@ struct ProcessInfo {
/// Wait until the process finished execution or win32 CloseHandle() API on /// Wait until the process finished execution or win32 CloseHandle() API on
/// ProcessInfo.ProcessHandle to avoid memory leaks. /// ProcessInfo.ProcessHandle to avoid memory leaks.
ProcessInfo ProcessInfo
ExecuteNoWait(StringRef Program, const char **args, const char **env = 0, ExecuteNoWait(StringRef Program, const char **args, const char **env = nullptr,
const StringRef **redirects = 0, unsigned memoryLimit = 0, const StringRef **redirects = nullptr, unsigned memoryLimit = 0,
std::string *ErrMsg = 0, bool *ExecutionFailed = 0); std::string *ErrMsg = nullptr, bool *ExecutionFailed = nullptr);
/// Return true if the given arguments fit within system-specific /// Return true if the given arguments fit within system-specific
/// argument length limits. /// argument length limits.
@ -142,9 +142,9 @@ struct ProcessInfo {
///< will perform a non-blocking wait on the child process. ///< will perform a non-blocking wait on the child process.
bool WaitUntilTerminates, ///< If true, ignores \p SecondsToWait and waits bool WaitUntilTerminates, ///< If true, ignores \p SecondsToWait and waits
///< until child has terminated. ///< until child has terminated.
std::string *ErrMsg = 0 ///< If non-zero, provides a pointer to a string std::string *ErrMsg = nullptr ///< If non-zero, provides a pointer to a
///< instance in which error messages will be returned. If the string ///< string instance in which error messages will be returned. If the
///< is non-empty upon return an error occurred while invoking the ///< string is non-empty upon return an error occurred while invoking the
///< program. ///< program.
); );
} }

View File

@ -55,7 +55,7 @@ namespace llvm {
Regex(Regex &&regex) { Regex(Regex &&regex) {
preg = regex.preg; preg = regex.preg;
error = regex.error; error = regex.error;
regex.preg = NULL; regex.preg = nullptr;
} }
~Regex(); ~Regex();
@ -75,7 +75,7 @@ namespace llvm {
/// the first group is always the entire pattern. /// the first group is always the entire pattern.
/// ///
/// This returns true on a successful match. /// This returns true on a successful match.
bool match(StringRef String, SmallVectorImpl<StringRef> *Matches = 0); bool match(StringRef String, SmallVectorImpl<StringRef> *Matches = nullptr);
/// sub - Return the result of replacing the first match of the regex in /// sub - Return the result of replacing the first match of the regex in
/// \p String with the \p Repl string. Backreferences like "\0" in the /// \p String with the \p Repl string. Backreferences like "\0" in the
@ -87,7 +87,8 @@ namespace llvm {
/// \param Error If non-null, any errors in the substitution (invalid /// \param Error If non-null, any errors in the substitution (invalid
/// backreferences, trailing backslashes) will be recorded as a non-empty /// backreferences, trailing backslashes) will be recorded as a non-empty
/// string. /// string.
std::string sub(StringRef Repl, StringRef String, std::string *Error = 0); std::string sub(StringRef Repl, StringRef String,
std::string *Error = nullptr);
/// \brief If this function returns true, ^Str$ is an extended regular /// \brief If this function returns true, ^Str$ is an extended regular
/// expression that matches Str and only Str. /// expression that matches Str and only Str.

View File

@ -23,9 +23,9 @@ namespace llvm {
class SMLoc { class SMLoc {
const char *Ptr; const char *Ptr;
public: public:
SMLoc() : Ptr(0) {} SMLoc() : Ptr(nullptr) {}
bool isValid() const { return Ptr != 0; } bool isValid() const { return Ptr != nullptr; }
bool operator==(const SMLoc &RHS) const { return RHS.Ptr == Ptr; } bool operator==(const SMLoc &RHS) const { return RHS.Ptr == Ptr; }
bool operator!=(const SMLoc &RHS) const { return RHS.Ptr != Ptr; } bool operator!=(const SMLoc &RHS) const { return RHS.Ptr != Ptr; }

View File

@ -28,7 +28,7 @@ namespace sys {
/// This function registers signal handlers to ensure that if a signal gets /// This function registers signal handlers to ensure that if a signal gets
/// delivered that the named file is removed. /// delivered that the named file is removed.
/// @brief Remove a file if a fatal signal occurs. /// @brief Remove a file if a fatal signal occurs.
bool RemoveFileOnSignal(StringRef Filename, std::string* ErrMsg = 0); bool RemoveFileOnSignal(StringRef Filename, std::string* ErrMsg = nullptr);
/// This function removes a file from the list of files to be removed on /// This function removes a file from the list of files to be removed on
/// signal delivery. /// signal delivery.

View File

@ -71,7 +71,8 @@ private:
SourceMgr(const SourceMgr&) LLVM_DELETED_FUNCTION; SourceMgr(const SourceMgr&) LLVM_DELETED_FUNCTION;
void operator=(const SourceMgr&) LLVM_DELETED_FUNCTION; void operator=(const SourceMgr&) LLVM_DELETED_FUNCTION;
public: public:
SourceMgr() : LineNoCache(0), DiagHandler(0), DiagContext(0) {} SourceMgr()
: LineNoCache(nullptr), DiagHandler(nullptr), DiagContext(nullptr) {}
~SourceMgr(); ~SourceMgr();
void setIncludeDirs(const std::vector<std::string> &Dirs) { void setIncludeDirs(const std::vector<std::string> &Dirs) {
@ -80,7 +81,7 @@ public:
/// setDiagHandler - Specify a diagnostic handler to be invoked every time /// setDiagHandler - Specify a diagnostic handler to be invoked every time
/// PrintMessage is called. Ctx is passed into the handler when it is invoked. /// PrintMessage is called. Ctx is passed into the handler when it is invoked.
void setDiagHandler(DiagHandlerTy DH, void *Ctx = 0) { void setDiagHandler(DiagHandlerTy DH, void *Ctx = nullptr) {
DiagHandler = DH; DiagHandler = DH;
DiagContext = Ctx; DiagContext = Ctx;
} }
@ -222,10 +223,10 @@ class SMDiagnostic {
public: public:
// Null diagnostic. // Null diagnostic.
SMDiagnostic() SMDiagnostic()
: SM(0), LineNo(0), ColumnNo(0), Kind(SourceMgr::DK_Error) {} : SM(nullptr), LineNo(0), ColumnNo(0), Kind(SourceMgr::DK_Error) {}
// Diagnostic with no location (e.g. file not found, command line arg error). // Diagnostic with no location (e.g. file not found, command line arg error).
SMDiagnostic(StringRef filename, SourceMgr::DiagKind Knd, StringRef Msg) SMDiagnostic(StringRef filename, SourceMgr::DiagKind Knd, StringRef Msg)
: SM(0), Filename(filename), LineNo(-1), ColumnNo(-1), Kind(Knd), : SM(nullptr), Filename(filename), LineNo(-1), ColumnNo(-1), Kind(Knd),
Message(Msg) {} Message(Msg) {}
// Diagnostic with a location. // Diagnostic with a location.

View File

@ -116,7 +116,7 @@ public:
// the memory doesn't go away/get reallocated, but it's // the memory doesn't go away/get reallocated, but it's
// not currently necessary. Users that need the pointer don't stream. // not currently necessary. Users that need the pointer don't stream.
assert(0 && "getPointer in streaming memory objects not allowed"); assert(0 && "getPointer in streaming memory objects not allowed");
return NULL; return nullptr;
} }
bool isValidAddress(uint64_t address) const override; bool isValidAddress(uint64_t address) const override;
bool isObjectEnd(uint64_t address) const override; bool isObjectEnd(uint64_t address) const override;

View File

@ -48,7 +48,7 @@ namespace llvm {
unsigned Refcount; ///< Number of referencing PooledStringPtrs. unsigned Refcount; ///< Number of referencing PooledStringPtrs.
public: public:
PooledString() : Pool(0), Refcount(0) { } PooledString() : Pool(nullptr), Refcount(0) { }
}; };
friend class PooledStringPtr; friend class PooledStringPtr;
@ -81,7 +81,7 @@ namespace llvm {
entry_t *S; entry_t *S;
public: public:
PooledStringPtr() : S(0) {} PooledStringPtr() : S(nullptr) {}
explicit PooledStringPtr(entry_t *E) : S(E) { explicit PooledStringPtr(entry_t *E) : S(E) {
if (S) ++S->getValue().Refcount; if (S) ++S->getValue().Refcount;
@ -107,7 +107,7 @@ namespace llvm {
S->getValue().Pool->InternTable.remove(S); S->getValue().Pool->InternTable.remove(S);
S->Destroy(); S->Destroy();
} }
S = 0; S = nullptr;
} }
~PooledStringPtr() { clear(); } ~PooledStringPtr() { clear(); }
@ -128,7 +128,7 @@ namespace llvm {
} }
inline const char *operator*() const { return begin(); } inline const char *operator*() const { return begin(); }
inline operator bool() const { return S != 0; } inline operator bool() const { return S != nullptr; }
inline bool operator==(const PooledStringPtr &That) { return S == That.S; } inline bool operator==(const PooledStringPtr &That) { return S == That.S; }
inline bool operator!=(const PooledStringPtr &That) { return S != That.S; } inline bool operator!=(const PooledStringPtr &That) { return S != That.S; }

View File

@ -233,8 +233,8 @@ namespace llvm {
public: public:
Target() Target()
: AsmStreamerCtorFn(0), MCRelocationInfoCtorFn(0), : AsmStreamerCtorFn(nullptr), MCRelocationInfoCtorFn(nullptr),
MCSymbolizerCtorFn(0) {} MCSymbolizerCtorFn(nullptr) {}
/// @name Target Information /// @name Target Information
/// @{ /// @{
@ -256,10 +256,10 @@ namespace llvm {
bool hasJIT() const { return HasJIT; } bool hasJIT() const { return HasJIT; }
/// hasTargetMachine - Check if this target supports code generation. /// hasTargetMachine - Check if this target supports code generation.
bool hasTargetMachine() const { return TargetMachineCtorFn != 0; } bool hasTargetMachine() const { return TargetMachineCtorFn != nullptr; }
/// hasMCAsmBackend - Check if this target supports .o generation. /// hasMCAsmBackend - Check if this target supports .o generation.
bool hasMCAsmBackend() const { return MCAsmBackendCtorFn != 0; } bool hasMCAsmBackend() const { return MCAsmBackendCtorFn != nullptr; }
/// @} /// @}
/// @name Feature Constructors /// @name Feature Constructors
@ -275,7 +275,7 @@ namespace llvm {
MCAsmInfo *createMCAsmInfo(const MCRegisterInfo &MRI, MCAsmInfo *createMCAsmInfo(const MCRegisterInfo &MRI,
StringRef Triple) const { StringRef Triple) const {
if (!MCAsmInfoCtorFn) if (!MCAsmInfoCtorFn)
return 0; return nullptr;
return MCAsmInfoCtorFn(MRI, Triple); return MCAsmInfoCtorFn(MRI, Triple);
} }
@ -285,7 +285,7 @@ namespace llvm {
CodeModel::Model CM, CodeModel::Model CM,
CodeGenOpt::Level OL) const { CodeGenOpt::Level OL) const {
if (!MCCodeGenInfoCtorFn) if (!MCCodeGenInfoCtorFn)
return 0; return nullptr;
return MCCodeGenInfoCtorFn(Triple, RM, CM, OL); return MCCodeGenInfoCtorFn(Triple, RM, CM, OL);
} }
@ -293,7 +293,7 @@ namespace llvm {
/// ///
MCInstrInfo *createMCInstrInfo() const { MCInstrInfo *createMCInstrInfo() const {
if (!MCInstrInfoCtorFn) if (!MCInstrInfoCtorFn)
return 0; return nullptr;
return MCInstrInfoCtorFn(); return MCInstrInfoCtorFn();
} }
@ -301,7 +301,7 @@ namespace llvm {
/// ///
MCInstrAnalysis *createMCInstrAnalysis(const MCInstrInfo *Info) const { MCInstrAnalysis *createMCInstrAnalysis(const MCInstrInfo *Info) const {
if (!MCInstrAnalysisCtorFn) if (!MCInstrAnalysisCtorFn)
return 0; return nullptr;
return MCInstrAnalysisCtorFn(Info); return MCInstrAnalysisCtorFn(Info);
} }
@ -309,7 +309,7 @@ namespace llvm {
/// ///
MCRegisterInfo *createMCRegInfo(StringRef Triple) const { MCRegisterInfo *createMCRegInfo(StringRef Triple) const {
if (!MCRegInfoCtorFn) if (!MCRegInfoCtorFn)
return 0; return nullptr;
return MCRegInfoCtorFn(Triple); return MCRegInfoCtorFn(Triple);
} }
@ -325,7 +325,7 @@ namespace llvm {
MCSubtargetInfo *createMCSubtargetInfo(StringRef Triple, StringRef CPU, MCSubtargetInfo *createMCSubtargetInfo(StringRef Triple, StringRef CPU,
StringRef Features) const { StringRef Features) const {
if (!MCSubtargetInfoCtorFn) if (!MCSubtargetInfoCtorFn)
return 0; return nullptr;
return MCSubtargetInfoCtorFn(Triple, CPU, Features); return MCSubtargetInfoCtorFn(Triple, CPU, Features);
} }
@ -342,7 +342,7 @@ namespace llvm {
CodeModel::Model CM = CodeModel::Default, CodeModel::Model CM = CodeModel::Default,
CodeGenOpt::Level OL = CodeGenOpt::Default) const { CodeGenOpt::Level OL = CodeGenOpt::Default) const {
if (!TargetMachineCtorFn) if (!TargetMachineCtorFn)
return 0; return nullptr;
return TargetMachineCtorFn(*this, Triple, CPU, Features, Options, return TargetMachineCtorFn(*this, Triple, CPU, Features, Options,
RM, CM, OL); RM, CM, OL);
} }
@ -353,7 +353,7 @@ namespace llvm {
MCAsmBackend *createMCAsmBackend(const MCRegisterInfo &MRI, MCAsmBackend *createMCAsmBackend(const MCRegisterInfo &MRI,
StringRef Triple, StringRef CPU) const { StringRef Triple, StringRef CPU) const {
if (!MCAsmBackendCtorFn) if (!MCAsmBackendCtorFn)
return 0; return nullptr;
return MCAsmBackendCtorFn(*this, MRI, Triple, CPU); return MCAsmBackendCtorFn(*this, MRI, Triple, CPU);
} }
@ -365,7 +365,7 @@ namespace llvm {
MCAsmParser &Parser, MCAsmParser &Parser,
const MCInstrInfo &MII) const { const MCInstrInfo &MII) const {
if (!MCAsmParserCtorFn) if (!MCAsmParserCtorFn)
return 0; return nullptr;
return MCAsmParserCtorFn(STI, Parser, MII); return MCAsmParserCtorFn(STI, Parser, MII);
} }
@ -373,13 +373,13 @@ namespace llvm {
/// takes ownership of the MCStreamer object. /// takes ownership of the MCStreamer object.
AsmPrinter *createAsmPrinter(TargetMachine &TM, MCStreamer &Streamer) const{ AsmPrinter *createAsmPrinter(TargetMachine &TM, MCStreamer &Streamer) const{
if (!AsmPrinterCtorFn) if (!AsmPrinterCtorFn)
return 0; return nullptr;
return AsmPrinterCtorFn(TM, Streamer); return AsmPrinterCtorFn(TM, Streamer);
} }
MCDisassembler *createMCDisassembler(const MCSubtargetInfo &STI) const { MCDisassembler *createMCDisassembler(const MCSubtargetInfo &STI) const {
if (!MCDisassemblerCtorFn) if (!MCDisassemblerCtorFn)
return 0; return nullptr;
return MCDisassemblerCtorFn(*this, STI); return MCDisassemblerCtorFn(*this, STI);
} }
@ -389,7 +389,7 @@ namespace llvm {
const MCRegisterInfo &MRI, const MCRegisterInfo &MRI,
const MCSubtargetInfo &STI) const { const MCSubtargetInfo &STI) const {
if (!MCInstPrinterCtorFn) if (!MCInstPrinterCtorFn)
return 0; return nullptr;
return MCInstPrinterCtorFn(*this, SyntaxVariant, MAI, MII, MRI, STI); return MCInstPrinterCtorFn(*this, SyntaxVariant, MAI, MII, MRI, STI);
} }
@ -400,7 +400,7 @@ namespace llvm {
const MCSubtargetInfo &STI, const MCSubtargetInfo &STI,
MCContext &Ctx) const { MCContext &Ctx) const {
if (!MCCodeEmitterCtorFn) if (!MCCodeEmitterCtorFn)
return 0; return nullptr;
return MCCodeEmitterCtorFn(II, MRI, STI, Ctx); return MCCodeEmitterCtorFn(II, MRI, STI, Ctx);
} }
@ -421,7 +421,7 @@ namespace llvm {
bool RelaxAll, bool RelaxAll,
bool NoExecStack) const { bool NoExecStack) const {
if (!MCObjectStreamerCtorFn) if (!MCObjectStreamerCtorFn)
return 0; return nullptr;
return MCObjectStreamerCtorFn(*this, TT, Ctx, TAB, _OS, _Emitter, STI, return MCObjectStreamerCtorFn(*this, TT, Ctx, TAB, _OS, _Emitter, STI,
RelaxAll, NoExecStack); RelaxAll, NoExecStack);
} }
@ -486,7 +486,7 @@ namespace llvm {
explicit iterator(Target *T) : Current(T) {} explicit iterator(Target *T) : Current(T) {}
friend struct TargetRegistry; friend struct TargetRegistry;
public: public:
iterator() : Current(0) {} iterator() : Current(nullptr) {}
bool operator==(const iterator &x) const { bool operator==(const iterator &x) const {
return Current == x.Current; return Current == x.Current;

View File

@ -85,9 +85,9 @@ class Timer {
Timer **Prev, *Next; // Doubly linked list of timers in the group. Timer **Prev, *Next; // Doubly linked list of timers in the group.
public: public:
explicit Timer(StringRef N) : TG(0) { init(N); } explicit Timer(StringRef N) : TG(nullptr) { init(N); }
Timer(StringRef N, TimerGroup &tg) : TG(0) { init(N, tg); } Timer(StringRef N, TimerGroup &tg) : TG(nullptr) { init(N, tg); }
Timer(const Timer &RHS) : TG(0) { Timer(const Timer &RHS) : TG(nullptr) {
assert(RHS.TG == 0 && "Can only copy uninitialized timers"); assert(RHS.TG == 0 && "Can only copy uninitialized timers");
} }
const Timer &operator=(const Timer &T) { const Timer &operator=(const Timer &T) {
@ -97,12 +97,12 @@ public:
~Timer(); ~Timer();
// Create an uninitialized timer, client must use 'init'. // Create an uninitialized timer, client must use 'init'.
explicit Timer() : TG(0) {} explicit Timer() : TG(nullptr) {}
void init(StringRef N); void init(StringRef N);
void init(StringRef N, TimerGroup &tg); void init(StringRef N, TimerGroup &tg);
const std::string &getName() const { return Name; } const std::string &getName() const { return Name; }
bool isInitialized() const { return TG != 0; } bool isInitialized() const { return TG != nullptr; }
/// startTimer - Start the timer running. Time between calls to /// startTimer - Start the timer running. Time between calls to
/// startTimer/stopTimer is counted by the Timer class. Note that these calls /// startTimer/stopTimer is counted by the Timer class. Note that these calls

View File

@ -235,7 +235,8 @@ class KeyValueNode : public Node {
void anchor() override; void anchor() override;
public: public:
KeyValueNode(std::unique_ptr<Document> &D) KeyValueNode(std::unique_ptr<Document> &D)
: Node(NK_KeyValue, D, StringRef(), StringRef()), Key(0), Value(0) {} : Node(NK_KeyValue, D, StringRef(), StringRef()), Key(nullptr),
Value(nullptr) {}
/// @brief Parse and return the key. /// @brief Parse and return the key.
/// ///
@ -274,7 +275,7 @@ template <class BaseT, class ValueT>
class basic_collection_iterator class basic_collection_iterator
: public std::iterator<std::forward_iterator_tag, ValueT> { : public std::iterator<std::forward_iterator_tag, ValueT> {
public: public:
basic_collection_iterator() : Base(0) {} basic_collection_iterator() : Base(nullptr) {}
basic_collection_iterator(BaseT *B) : Base(B) {} basic_collection_iterator(BaseT *B) : Base(B) {}
ValueT *operator ->() const { ValueT *operator ->() const {
@ -304,8 +305,8 @@ public:
assert(Base && "Attempted to advance iterator past end!"); assert(Base && "Attempted to advance iterator past end!");
Base->increment(); Base->increment();
// Create an end iterator. // Create an end iterator.
if (Base->CurrentEntry == 0) if (Base->CurrentEntry == nullptr)
Base = 0; Base = nullptr;
return *this; return *this;
} }
@ -352,7 +353,7 @@ public:
MappingNode(std::unique_ptr<Document> &D, StringRef Anchor, StringRef Tag, MappingNode(std::unique_ptr<Document> &D, StringRef Anchor, StringRef Tag,
MappingType MT) MappingType MT)
: Node(NK_Mapping, D, Anchor, Tag), Type(MT), IsAtBeginning(true), : Node(NK_Mapping, D, Anchor, Tag), Type(MT), IsAtBeginning(true),
IsAtEnd(false), CurrentEntry(0) {} IsAtEnd(false), CurrentEntry(nullptr) {}
friend class basic_collection_iterator<MappingNode, KeyValueNode>; friend class basic_collection_iterator<MappingNode, KeyValueNode>;
typedef basic_collection_iterator<MappingNode, KeyValueNode> iterator; typedef basic_collection_iterator<MappingNode, KeyValueNode> iterator;
@ -411,7 +412,7 @@ public:
: Node(NK_Sequence, D, Anchor, Tag), SeqType(ST), IsAtBeginning(true), : Node(NK_Sequence, D, Anchor, Tag), SeqType(ST), IsAtBeginning(true),
IsAtEnd(false), IsAtEnd(false),
WasPreviousTokenFlowEntry(true), // Start with an imaginary ','. WasPreviousTokenFlowEntry(true), // Start with an imaginary ','.
CurrentEntry(0) {} CurrentEntry(nullptr) {}
friend class basic_collection_iterator<SequenceNode, Node>; friend class basic_collection_iterator<SequenceNode, Node>;
typedef basic_collection_iterator<SequenceNode, Node> iterator; typedef basic_collection_iterator<SequenceNode, Node> iterator;
@ -526,7 +527,7 @@ private:
/// @brief Iterator abstraction for Documents over a Stream. /// @brief Iterator abstraction for Documents over a Stream.
class document_iterator { class document_iterator {
public: public:
document_iterator() : Doc(0) {} document_iterator() : Doc(nullptr) {}
document_iterator(std::unique_ptr<Document> &D) : Doc(&D) {} document_iterator(std::unique_ptr<Document> &D) : Doc(&D) {}
bool operator ==(const document_iterator &Other) { bool operator ==(const document_iterator &Other) {
@ -542,7 +543,7 @@ public:
document_iterator operator ++() { document_iterator operator ++() {
assert(Doc != 0 && "incrementing iterator past the end."); assert(Doc != 0 && "incrementing iterator past the end.");
if (!(*Doc)->skip()) { if (!(*Doc)->skip()) {
Doc->reset(0); Doc->reset(nullptr);
} else { } else {
Stream &S = (*Doc)->stream; Stream &S = (*Doc)->stream;
Doc->reset(new Document(S)); Doc->reset(new Document(S));

View File

@ -207,7 +207,8 @@ struct has_ScalarTraits
static double test(...); static double test(...);
public: public:
static bool const value = (sizeof(test<ScalarTraits<T> >(0,0)) == 1); static bool const value =
(sizeof(test<ScalarTraits<T> >(nullptr,nullptr)) == 1);
}; };
@ -340,7 +341,7 @@ struct unvalidatedMappingTraits : public std::integral_constant<bool,
class IO { class IO {
public: public:
IO(void *Ctxt=NULL); IO(void *Ctxt=nullptr);
virtual ~IO(); virtual ~IO();
virtual bool outputting() = 0; virtual bool outputting() = 0;
@ -765,9 +766,9 @@ public:
// user-data. The DiagHandler can be specified to provide // user-data. The DiagHandler can be specified to provide
// alternative error reporting. // alternative error reporting.
Input(StringRef InputContent, Input(StringRef InputContent,
void *Ctxt = NULL, void *Ctxt = nullptr,
SourceMgr::DiagHandlerTy DiagHandler = NULL, SourceMgr::DiagHandlerTy DiagHandler = nullptr,
void *DiagHandlerCtxt = NULL); void *DiagHandlerCtxt = nullptr);
~Input(); ~Input();
// Check if there was an syntax or semantic error during parsing. // Check if there was an syntax or semantic error during parsing.
@ -896,7 +897,7 @@ private:
/// ///
class Output : public IO { class Output : public IO {
public: public:
Output(llvm::raw_ostream &, void *Ctxt=NULL); Output(llvm::raw_ostream &, void *Ctxt=nullptr);
virtual ~Output(); virtual ~Output();
bool outputting() override; bool outputting() override;

View File

@ -109,10 +109,10 @@ namespace llvm
circular_raw_ostream(raw_ostream &Stream, const char *Header, circular_raw_ostream(raw_ostream &Stream, const char *Header,
size_t BuffSize = 0, bool Owns = REFERENCE_ONLY) size_t BuffSize = 0, bool Owns = REFERENCE_ONLY)
: raw_ostream(/*unbuffered*/true), : raw_ostream(/*unbuffered*/true),
TheStream(0), TheStream(nullptr),
OwnsStream(Owns), OwnsStream(Owns),
BufferSize(BuffSize), BufferSize(BuffSize),
BufferArray(0), BufferArray(nullptr),
Filled(false), Filled(false),
Banner(Header) { Banner(Header) {
if (BufferSize != 0) if (BufferSize != 0)
@ -122,9 +122,9 @@ namespace llvm
} }
explicit circular_raw_ostream() explicit circular_raw_ostream()
: raw_ostream(/*unbuffered*/true), : raw_ostream(/*unbuffered*/true),
TheStream(0), TheStream(nullptr),
OwnsStream(REFERENCE_ONLY), OwnsStream(REFERENCE_ONLY),
BufferArray(0), BufferArray(nullptr),
Filled(false), Filled(false),
Banner("") { Banner("") {
Cur = BufferArray; Cur = BufferArray;

View File

@ -76,7 +76,7 @@ public:
explicit raw_ostream(bool unbuffered=false) explicit raw_ostream(bool unbuffered=false)
: BufferMode(unbuffered ? Unbuffered : InternalBuffer) { : BufferMode(unbuffered ? Unbuffered : InternalBuffer) {
// Start out ready to flush. // Start out ready to flush.
OutBufStart = OutBufEnd = OutBufCur = 0; OutBufStart = OutBufEnd = OutBufCur = nullptr;
} }
virtual ~raw_ostream(); virtual ~raw_ostream();
@ -102,7 +102,7 @@ public:
size_t GetBufferSize() const { size_t GetBufferSize() const {
// If we're supposed to be buffered but haven't actually gotten around // If we're supposed to be buffered but haven't actually gotten around
// to allocating the buffer yet, return the value that would be used. // to allocating the buffer yet, return the value that would be used.
if (BufferMode != Unbuffered && OutBufStart == 0) if (BufferMode != Unbuffered && OutBufStart == nullptr)
return preferred_buffer_size(); return preferred_buffer_size();
// Otherwise just return the size of the allocated buffer. // Otherwise just return the size of the allocated buffer.
@ -115,7 +115,7 @@ public:
/// set to unbuffered. /// set to unbuffered.
void SetUnbuffered() { void SetUnbuffered() {
flush(); flush();
SetBufferAndMode(0, 0, Unbuffered); SetBufferAndMode(nullptr, 0, Unbuffered);
} }
size_t GetNumBytesInBuffer() const { size_t GetNumBytesInBuffer() const {

View File

@ -706,7 +706,7 @@ public:
static void unspecified_bool_true() {} static void unspecified_bool_true() {}
operator unspecified_bool_type() const { // true if error operator unspecified_bool_type() const { // true if error
return _val_ == 0 ? 0 : unspecified_bool_true; return _val_ == 0 ? nullptr : unspecified_bool_true;
} }
}; };
@ -771,7 +771,7 @@ public:
static void unspecified_bool_true() {} static void unspecified_bool_true() {}
operator unspecified_bool_type() const { // true if error operator unspecified_bool_type() const { // true if error
return _val_ == 0 ? 0 : unspecified_bool_true; return _val_ == 0 ? nullptr : unspecified_bool_true;
} }
}; };

View File

@ -1679,7 +1679,7 @@ APFloat::multiply(const APFloat &rhs, roundingMode rounding_mode)
fs = multiplySpecials(rhs); fs = multiplySpecials(rhs);
if (isFiniteNonZero()) { if (isFiniteNonZero()) {
lostFraction lost_fraction = multiplySignificand(rhs, 0); lostFraction lost_fraction = multiplySignificand(rhs, nullptr);
fs = normalize(rounding_mode, lost_fraction); fs = normalize(rounding_mode, lost_fraction);
if (lost_fraction != lfExactlyZero) if (lost_fraction != lfExactlyZero)
fs = (opStatus) (fs | opInexact); fs = (opStatus) (fs | opInexact);
@ -2439,7 +2439,7 @@ APFloat::roundSignificandWithExponent(const integerPart *decSigParts,
if (exp >= 0) { if (exp >= 0) {
/* multiplySignificand leaves the precision-th bit set to 1. */ /* multiplySignificand leaves the precision-th bit set to 1. */
calcLostFraction = decSig.multiplySignificand(pow5, NULL); calcLostFraction = decSig.multiplySignificand(pow5, nullptr);
powHUerr = powStatus != opOK; powHUerr = powStatus != opOK;
} else { } else {
calcLostFraction = decSig.divideSignificand(pow5); calcLostFraction = decSig.divideSignificand(pow5);
@ -3795,7 +3795,7 @@ APFloat::opStatus APFloat::next(bool nextDown) {
if (isSignaling()) { if (isSignaling()) {
result = opInvalidOp; result = opInvalidOp;
// For consistency, propagate the sign of the sNaN to the qNaN. // For consistency, propagate the sign of the sNaN to the qNaN.
makeNaN(false, isNegative(), 0); makeNaN(false, isNegative(), nullptr);
} }
break; break;
case fcZero: case fcZero:

View File

@ -1683,10 +1683,10 @@ void APInt::divide(const APInt LHS, unsigned lhsWords,
// Allocate space for the temporary values we need either on the stack, if // Allocate space for the temporary values we need either on the stack, if
// it will fit, or on the heap if it won't. // it will fit, or on the heap if it won't.
unsigned SPACE[128]; unsigned SPACE[128];
unsigned *U = 0; unsigned *U = nullptr;
unsigned *V = 0; unsigned *V = nullptr;
unsigned *Q = 0; unsigned *Q = nullptr;
unsigned *R = 0; unsigned *R = nullptr;
if ((Remainder?4:3)*n+2*m+1 <= 128) { if ((Remainder?4:3)*n+2*m+1 <= 128) {
U = &SPACE[0]; U = &SPACE[0];
V = &SPACE[m+n+1]; V = &SPACE[m+n+1];
@ -1872,7 +1872,7 @@ APInt APInt::udiv(const APInt& RHS) const {
// We have to compute it the hard way. Invoke the Knuth divide algorithm. // We have to compute it the hard way. Invoke the Knuth divide algorithm.
APInt Quotient(1,0); // to hold result. APInt Quotient(1,0); // to hold result.
divide(*this, lhsWords, RHS, rhsWords, &Quotient, 0); divide(*this, lhsWords, RHS, rhsWords, &Quotient, nullptr);
return Quotient; return Quotient;
} }
@ -1920,7 +1920,7 @@ APInt APInt::urem(const APInt& RHS) const {
// We have to compute it the hard way. Invoke the Knuth divide algorithm. // We have to compute it the hard way. Invoke the Knuth divide algorithm.
APInt Remainder(1,0); APInt Remainder(1,0);
divide(*this, lhsWords, RHS, rhsWords, 0, &Remainder); divide(*this, lhsWords, RHS, rhsWords, nullptr, &Remainder);
return Remainder; return Remainder;
} }

View File

@ -28,7 +28,7 @@ MallocSlabAllocator::~MallocSlabAllocator() { }
MemSlab *MallocSlabAllocator::Allocate(size_t Size) { MemSlab *MallocSlabAllocator::Allocate(size_t Size) {
MemSlab *Slab = (MemSlab*)Allocator.Allocate(Size, 0); MemSlab *Slab = (MemSlab*)Allocator.Allocate(Size, 0);
Slab->Size = Size; Slab->Size = Size;
Slab->NextPtr = 0; Slab->NextPtr = nullptr;
return Slab; return Slab;
} }
@ -39,7 +39,7 @@ void MallocSlabAllocator::Deallocate(MemSlab *Slab) {
void BumpPtrAllocatorBase::PrintStats() const { void BumpPtrAllocatorBase::PrintStats() const {
unsigned NumSlabs = 0; unsigned NumSlabs = 0;
size_t TotalMemory = 0; size_t TotalMemory = 0;
for (MemSlab *Slab = CurSlab; Slab != 0; Slab = Slab->NextPtr) { for (MemSlab *Slab = CurSlab; Slab != nullptr; Slab = Slab->NextPtr) {
TotalMemory += Slab->Size; TotalMemory += Slab->Size;
++NumSlabs; ++NumSlabs;
} }
@ -53,7 +53,7 @@ void BumpPtrAllocatorBase::PrintStats() const {
size_t BumpPtrAllocatorBase::getTotalMemory() const { size_t BumpPtrAllocatorBase::getTotalMemory() const {
size_t TotalMemory = 0; size_t TotalMemory = 0;
for (MemSlab *Slab = CurSlab; Slab != 0; Slab = Slab->NextPtr) { for (MemSlab *Slab = CurSlab; Slab != nullptr; Slab = Slab->NextPtr) {
TotalMemory += Slab->Size; TotalMemory += Slab->Size;
} }
return TotalMemory; return TotalMemory;

View File

@ -81,7 +81,7 @@ void StringSaver::anchor() {}
// Globals for name and overview of program. Program name is not a string to // Globals for name and overview of program. Program name is not a string to
// avoid static ctor/dtor issues. // avoid static ctor/dtor issues.
static char ProgramName[80] = "<premain>"; static char ProgramName[80] = "<premain>";
static const char *ProgramOverview = 0; static const char *ProgramOverview = nullptr;
// This collects additional help to be printed. // This collects additional help to be printed.
static ManagedStatic<std::vector<const char*> > MoreHelp; static ManagedStatic<std::vector<const char*> > MoreHelp;
@ -100,7 +100,7 @@ void cl::MarkOptionsChanged() {
/// RegisteredOptionList - This is the list of the command line options that /// RegisteredOptionList - This is the list of the command line options that
/// have statically constructed themselves. /// have statically constructed themselves.
static Option *RegisteredOptionList = 0; static Option *RegisteredOptionList = nullptr;
void Option::addArgument() { void Option::addArgument() {
assert(NextRegistered == 0 && "argument multiply registered!"); assert(NextRegistered == 0 && "argument multiply registered!");
@ -144,7 +144,7 @@ static void GetOptionInfo(SmallVectorImpl<Option*> &PositionalOpts,
SmallVectorImpl<Option*> &SinkOpts, SmallVectorImpl<Option*> &SinkOpts,
StringMap<Option*> &OptionsMap) { StringMap<Option*> &OptionsMap) {
SmallVector<const char*, 16> OptionNames; SmallVector<const char*, 16> OptionNames;
Option *CAOpt = 0; // The ConsumeAfter option if it exists. Option *CAOpt = nullptr; // The ConsumeAfter option if it exists.
for (Option *O = RegisteredOptionList; O; O = O->getNextRegisteredOption()) { for (Option *O = RegisteredOptionList; O; O = O->getNextRegisteredOption()) {
// If this option wants to handle multiple option names, get the full set. // If this option wants to handle multiple option names, get the full set.
// This handles enum options like "-O1 -O2" etc. // This handles enum options like "-O1 -O2" etc.
@ -189,7 +189,7 @@ static void GetOptionInfo(SmallVectorImpl<Option*> &PositionalOpts,
static Option *LookupOption(StringRef &Arg, StringRef &Value, static Option *LookupOption(StringRef &Arg, StringRef &Value,
const StringMap<Option*> &OptionsMap) { const StringMap<Option*> &OptionsMap) {
// Reject all dashes. // Reject all dashes.
if (Arg.empty()) return 0; if (Arg.empty()) return nullptr;
size_t EqualPos = Arg.find('='); size_t EqualPos = Arg.find('=');
@ -197,14 +197,14 @@ static Option *LookupOption(StringRef &Arg, StringRef &Value,
if (EqualPos == StringRef::npos) { if (EqualPos == StringRef::npos) {
// Look up the option. // Look up the option.
StringMap<Option*>::const_iterator I = OptionsMap.find(Arg); StringMap<Option*>::const_iterator I = OptionsMap.find(Arg);
return I != OptionsMap.end() ? I->second : 0; return I != OptionsMap.end() ? I->second : nullptr;
} }
// If the argument before the = is a valid option name, we match. If not, // If the argument before the = is a valid option name, we match. If not,
// return Arg unmolested. // return Arg unmolested.
StringMap<Option*>::const_iterator I = StringMap<Option*>::const_iterator I =
OptionsMap.find(Arg.substr(0, EqualPos)); OptionsMap.find(Arg.substr(0, EqualPos));
if (I == OptionsMap.end()) return 0; if (I == OptionsMap.end()) return nullptr;
Value = Arg.substr(EqualPos+1); Value = Arg.substr(EqualPos+1);
Arg = Arg.substr(0, EqualPos); Arg = Arg.substr(0, EqualPos);
@ -219,7 +219,7 @@ static Option *LookupNearestOption(StringRef Arg,
const StringMap<Option*> &OptionsMap, const StringMap<Option*> &OptionsMap,
std::string &NearestString) { std::string &NearestString) {
// Reject all dashes. // Reject all dashes.
if (Arg.empty()) return 0; if (Arg.empty()) return nullptr;
// Split on any equal sign. // Split on any equal sign.
std::pair<StringRef, StringRef> SplitArg = Arg.split('='); std::pair<StringRef, StringRef> SplitArg = Arg.split('=');
@ -227,7 +227,7 @@ static Option *LookupNearestOption(StringRef Arg,
StringRef &RHS = SplitArg.second; StringRef &RHS = SplitArg.second;
// Find the closest match. // Find the closest match.
Option *Best = 0; Option *Best = nullptr;
unsigned BestDistance = 0; unsigned BestDistance = 0;
for (StringMap<Option*>::const_iterator it = OptionsMap.begin(), for (StringMap<Option*>::const_iterator it = OptionsMap.begin(),
ie = OptionsMap.end(); it != ie; ++it) { ie = OptionsMap.end(); it != ie; ++it) {
@ -300,7 +300,7 @@ static inline bool ProvideOption(Option *Handler, StringRef ArgName,
// Enforce value requirements // Enforce value requirements
switch (Handler->getValueExpectedFlag()) { switch (Handler->getValueExpectedFlag()) {
case ValueRequired: case ValueRequired:
if (Value.data() == 0) { // No value specified? if (Value.data() == nullptr) { // No value specified?
if (i+1 >= argc) if (i+1 >= argc)
return Handler->error("requires a value!"); return Handler->error("requires a value!");
// Steal the next argument, like for '-o filename' // Steal the next argument, like for '-o filename'
@ -349,7 +349,7 @@ static inline bool ProvideOption(Option *Handler, StringRef ArgName,
static bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i) { static bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i) {
int Dummy = i; int Dummy = i;
return ProvideOption(Handler, Handler->ArgStr, Arg, 0, 0, Dummy); return ProvideOption(Handler, Handler->ArgStr, Arg, 0, nullptr, Dummy);
} }
@ -385,7 +385,7 @@ static Option *getOptionPred(StringRef Name, size_t &Length,
Length = Name.size(); Length = Name.size();
return OMI->second; // Found one! return OMI->second; // Found one!
} }
return 0; // No option found! return nullptr; // No option found!
} }
/// HandlePrefixedOrGroupedOption - The specified argument string (which started /// HandlePrefixedOrGroupedOption - The specified argument string (which started
@ -395,12 +395,12 @@ static Option *getOptionPred(StringRef Name, size_t &Length,
static Option *HandlePrefixedOrGroupedOption(StringRef &Arg, StringRef &Value, static Option *HandlePrefixedOrGroupedOption(StringRef &Arg, StringRef &Value,
bool &ErrorParsing, bool &ErrorParsing,
const StringMap<Option*> &OptionsMap) { const StringMap<Option*> &OptionsMap) {
if (Arg.size() == 1) return 0; if (Arg.size() == 1) return nullptr;
// Do the lookup! // Do the lookup!
size_t Length = 0; size_t Length = 0;
Option *PGOpt = getOptionPred(Arg, Length, isPrefixedOrGrouping, OptionsMap); Option *PGOpt = getOptionPred(Arg, Length, isPrefixedOrGrouping, OptionsMap);
if (PGOpt == 0) return 0; if (PGOpt == nullptr) return nullptr;
// If the option is a prefixed option, then the value is simply the // If the option is a prefixed option, then the value is simply the
// rest of the name... so fall through to later processing, by // rest of the name... so fall through to later processing, by
@ -427,7 +427,7 @@ static Option *HandlePrefixedOrGroupedOption(StringRef &Arg, StringRef &Value,
"Option can not be cl::Grouping AND cl::ValueRequired!"); "Option can not be cl::Grouping AND cl::ValueRequired!");
int Dummy = 0; int Dummy = 0;
ErrorParsing |= ProvideOption(PGOpt, OneArgName, ErrorParsing |= ProvideOption(PGOpt, OneArgName,
StringRef(), 0, 0, Dummy); StringRef(), 0, nullptr, Dummy);
// Get the next grouping option. // Get the next grouping option.
PGOpt = getOptionPred(Arg, Length, isGrouping, OptionsMap); PGOpt = getOptionPred(Arg, Length, isGrouping, OptionsMap);
@ -760,7 +760,7 @@ void cl::ParseCommandLineOptions(int argc, const char * const *argv,
// Determine whether or not there are an unlimited number of positionals // Determine whether or not there are an unlimited number of positionals
bool HasUnlimitedPositionals = false; bool HasUnlimitedPositionals = false;
Option *ConsumeAfterOpt = 0; Option *ConsumeAfterOpt = nullptr;
if (!PositionalOpts.empty()) { if (!PositionalOpts.empty()) {
if (PositionalOpts[0]->getNumOccurrencesFlag() == cl::ConsumeAfter) { if (PositionalOpts[0]->getNumOccurrencesFlag() == cl::ConsumeAfter) {
assert(PositionalOpts.size() > 1 && assert(PositionalOpts.size() > 1 &&
@ -770,7 +770,7 @@ void cl::ParseCommandLineOptions(int argc, const char * const *argv,
// Calculate how many positional values are _required_. // Calculate how many positional values are _required_.
bool UnboundedFound = false; bool UnboundedFound = false;
for (size_t i = ConsumeAfterOpt != 0, e = PositionalOpts.size(); for (size_t i = ConsumeAfterOpt != nullptr, e = PositionalOpts.size();
i != e; ++i) { i != e; ++i) {
Option *Opt = PositionalOpts[i]; Option *Opt = PositionalOpts[i];
if (RequiresValue(Opt)) if (RequiresValue(Opt))
@ -806,13 +806,13 @@ void cl::ParseCommandLineOptions(int argc, const char * const *argv,
// If the program has named positional arguments, and the name has been run // If the program has named positional arguments, and the name has been run
// across, keep track of which positional argument was named. Otherwise put // across, keep track of which positional argument was named. Otherwise put
// the positional args into the PositionalVals list... // the positional args into the PositionalVals list...
Option *ActivePositionalArg = 0; Option *ActivePositionalArg = nullptr;
// Loop over all of the arguments... processing them. // Loop over all of the arguments... processing them.
bool DashDashFound = false; // Have we read '--'? bool DashDashFound = false; // Have we read '--'?
for (int i = 1; i < argc; ++i) { for (int i = 1; i < argc; ++i) {
Option *Handler = 0; Option *Handler = nullptr;
Option *NearestHandler = 0; Option *NearestHandler = nullptr;
std::string NearestHandlerString; std::string NearestHandlerString;
StringRef Value; StringRef Value;
StringRef ArgName = ""; StringRef ArgName = "";
@ -846,7 +846,7 @@ void cl::ParseCommandLineOptions(int argc, const char * const *argv,
// the consume after option... if it's specified... // the consume after option... if it's specified...
// //
if (PositionalVals.size() >= NumPositionalRequired && if (PositionalVals.size() >= NumPositionalRequired &&
ConsumeAfterOpt != 0) { ConsumeAfterOpt != nullptr) {
for (++i; i < argc; ++i) for (++i; i < argc; ++i)
PositionalVals.push_back(std::make_pair(argv[i],i)); PositionalVals.push_back(std::make_pair(argv[i],i));
break; // Handle outside of the argument processing loop... break; // Handle outside of the argument processing loop...
@ -884,18 +884,18 @@ void cl::ParseCommandLineOptions(int argc, const char * const *argv,
Handler = LookupOption(ArgName, Value, Opts); Handler = LookupOption(ArgName, Value, Opts);
// Check to see if this "option" is really a prefixed or grouped argument. // Check to see if this "option" is really a prefixed or grouped argument.
if (Handler == 0) if (Handler == nullptr)
Handler = HandlePrefixedOrGroupedOption(ArgName, Value, Handler = HandlePrefixedOrGroupedOption(ArgName, Value,
ErrorParsing, Opts); ErrorParsing, Opts);
// Otherwise, look for the closest available option to report to the user // Otherwise, look for the closest available option to report to the user
// in the upcoming error. // in the upcoming error.
if (Handler == 0 && SinkOpts.empty()) if (Handler == nullptr && SinkOpts.empty())
NearestHandler = LookupNearestOption(ArgName, Opts, NearestHandler = LookupNearestOption(ArgName, Opts,
NearestHandlerString); NearestHandlerString);
} }
if (Handler == 0) { if (Handler == nullptr) {
if (SinkOpts.empty()) { if (SinkOpts.empty()) {
errs() << ProgramName << ": Unknown command line argument '" errs() << ProgramName << ": Unknown command line argument '"
<< argv[i] << "'. Try: '" << argv[0] << " -help'\n"; << argv[i] << "'. Try: '" << argv[0] << " -help'\n";
@ -939,7 +939,7 @@ void cl::ParseCommandLineOptions(int argc, const char * const *argv,
<< " positional arguments: See: " << argv[0] << " -help\n"; << " positional arguments: See: " << argv[0] << " -help\n";
ErrorParsing = true; ErrorParsing = true;
} else if (ConsumeAfterOpt == 0) { } else if (ConsumeAfterOpt == nullptr) {
// Positional args have already been handled if ConsumeAfter is specified. // Positional args have already been handled if ConsumeAfter is specified.
unsigned ValNo = 0, NumVals = static_cast<unsigned>(PositionalVals.size()); unsigned ValNo = 0, NumVals = static_cast<unsigned>(PositionalVals.size());
for (size_t i = 0, e = PositionalOpts.size(); i != e; ++i) { for (size_t i = 0, e = PositionalOpts.size(); i != e; ++i) {
@ -1044,7 +1044,7 @@ void cl::ParseCommandLineOptions(int argc, const char * const *argv,
// //
bool Option::error(const Twine &Message, StringRef ArgName) { bool Option::error(const Twine &Message, StringRef ArgName) {
if (ArgName.data() == 0) ArgName = ArgStr; if (ArgName.data() == nullptr) ArgName = ArgStr;
if (ArgName.empty()) if (ArgName.empty())
errs() << HelpStr; // Be nice for positional arguments errs() << HelpStr; // Be nice for positional arguments
else else
@ -1455,12 +1455,12 @@ public:
outs() << "USAGE: " << ProgramName << " [options]"; outs() << "USAGE: " << ProgramName << " [options]";
// Print out the positional options. // Print out the positional options.
Option *CAOpt = 0; // The cl::ConsumeAfter option, if it exists... Option *CAOpt = nullptr; // The cl::ConsumeAfter option, if it exists...
if (!PositionalOpts.empty() && if (!PositionalOpts.empty() &&
PositionalOpts[0]->getNumOccurrencesFlag() == ConsumeAfter) PositionalOpts[0]->getNumOccurrencesFlag() == ConsumeAfter)
CAOpt = PositionalOpts[0]; CAOpt = PositionalOpts[0];
for (size_t i = CAOpt != 0, e = PositionalOpts.size(); i != e; ++i) { for (size_t i = CAOpt != nullptr, e = PositionalOpts.size(); i != e; ++i) {
if (PositionalOpts[i]->ArgStr[0]) if (PositionalOpts[i]->ArgStr[0])
outs() << " --" << PositionalOpts[i]->ArgStr; outs() << " --" << PositionalOpts[i]->ArgStr;
outs() << " " << PositionalOpts[i]->HelpStr; outs() << " " << PositionalOpts[i]->HelpStr;
@ -1555,7 +1555,7 @@ protected:
outs() << (*Category)->getName() << ":\n"; outs() << (*Category)->getName() << ":\n";
// Check if description is set. // Check if description is set.
if ((*Category)->getDescription() != 0) if ((*Category)->getDescription() != nullptr)
outs() << (*Category)->getDescription() << "\n\n"; outs() << (*Category)->getDescription() << "\n\n";
else else
outs() << "\n"; outs() << "\n";
@ -1686,9 +1686,9 @@ void cl::PrintOptionValues() {
Opts[i].second->printOptionValue(MaxArgLen, PrintAllOptions); Opts[i].second->printOptionValue(MaxArgLen, PrintAllOptions);
} }
static void (*OverrideVersionPrinter)() = 0; static void (*OverrideVersionPrinter)() = nullptr;
static std::vector<void (*)()>* ExtraVersionPrinters = 0; static std::vector<void (*)()>* ExtraVersionPrinters = nullptr;
namespace { namespace {
class VersionPrinter { class VersionPrinter {
@ -1721,7 +1721,7 @@ public:
void operator=(bool OptionWasSpecified) { void operator=(bool OptionWasSpecified) {
if (!OptionWasSpecified) return; if (!OptionWasSpecified) return;
if (OverrideVersionPrinter != 0) { if (OverrideVersionPrinter != nullptr) {
(*OverrideVersionPrinter)(); (*OverrideVersionPrinter)();
exit(0); exit(0);
} }
@ -1729,7 +1729,7 @@ public:
// Iterate over any registered extra printers and call them to add further // Iterate over any registered extra printers and call them to add further
// information. // information.
if (ExtraVersionPrinters != 0) { if (ExtraVersionPrinters != nullptr) {
outs() << '\n'; outs() << '\n';
for (std::vector<void (*)()>::iterator I = ExtraVersionPrinters->begin(), for (std::vector<void (*)()>::iterator I = ExtraVersionPrinters->begin(),
E = ExtraVersionPrinters->end(); E = ExtraVersionPrinters->end();
@ -1779,7 +1779,7 @@ void cl::SetVersionPrinter(void (*func)()) {
} }
void cl::AddExtraVersionPrinter(void (*func)()) { void cl::AddExtraVersionPrinter(void (*func)()) {
if (ExtraVersionPrinters == 0) if (ExtraVersionPrinters == nullptr)
ExtraVersionPrinters = new std::vector<void (*)()>; ExtraVersionPrinters = new std::vector<void (*)()>;
ExtraVersionPrinters->push_back(func); ExtraVersionPrinters->push_back(func);

View File

@ -89,16 +89,16 @@ CrashRecoveryContext::~CrashRecoveryContext() {
} }
bool CrashRecoveryContext::isRecoveringFromCrash() { bool CrashRecoveryContext::isRecoveringFromCrash() {
return tlIsRecoveringFromCrash->get() != 0; return tlIsRecoveringFromCrash->get() != nullptr;
} }
CrashRecoveryContext *CrashRecoveryContext::GetCurrent() { CrashRecoveryContext *CrashRecoveryContext::GetCurrent() {
if (!gCrashRecoveryEnabled) if (!gCrashRecoveryEnabled)
return 0; return nullptr;
const CrashRecoveryContextImpl *CRCI = CurrentContext->get(); const CrashRecoveryContextImpl *CRCI = CurrentContext->get();
if (!CRCI) if (!CRCI)
return 0; return nullptr;
return CRCI->CRC; return CRCI->CRC;
} }
@ -120,7 +120,7 @@ CrashRecoveryContext::unregisterCleanup(CrashRecoveryContextCleanup *cleanup) {
if (cleanup == head) { if (cleanup == head) {
head = cleanup->next; head = cleanup->next;
if (head) if (head)
head->prev = 0; head->prev = nullptr;
} }
else { else {
cleanup->prev->next = cleanup->next; cleanup->prev->next = cleanup->next;
@ -261,7 +261,7 @@ static void CrashRecoverySignalHandler(int Signal) {
sigset_t SigMask; sigset_t SigMask;
sigemptyset(&SigMask); sigemptyset(&SigMask);
sigaddset(&SigMask, Signal); sigaddset(&SigMask, Signal);
sigprocmask(SIG_UNBLOCK, &SigMask, 0); sigprocmask(SIG_UNBLOCK, &SigMask, nullptr);
if (CRCI) if (CRCI)
const_cast<CrashRecoveryContextImpl*>(CRCI)->HandleCrash(); const_cast<CrashRecoveryContextImpl*>(CRCI)->HandleCrash();
@ -296,7 +296,7 @@ void CrashRecoveryContext::Disable() {
// Restore the previous signal handlers. // Restore the previous signal handlers.
for (unsigned i = 0; i != NumSignals; ++i) for (unsigned i = 0; i != NumSignals; ++i)
sigaction(Signals[i], &PrevActions[i], 0); sigaction(Signals[i], &PrevActions[i], nullptr);
} }
#endif #endif

View File

@ -44,7 +44,7 @@ static T *getUs(uint32_t *offset_ptr, T *dst, uint32_t count,
// success // success
return dst; return dst;
} }
return NULL; return nullptr;
} }
uint8_t DataExtractor::getU8(uint32_t *offset_ptr) const { uint8_t DataExtractor::getU8(uint32_t *offset_ptr) const {
@ -125,7 +125,7 @@ const char *DataExtractor::getCStr(uint32_t *offset_ptr) const {
*offset_ptr = pos + 1; *offset_ptr = pos + 1;
return Data.data() + offset; return Data.data() + offset;
} }
return NULL; return nullptr;
} }
uint64_t DataExtractor::getULEB128(uint32_t *offset_ptr) const { uint64_t DataExtractor::getULEB128(uint32_t *offset_ptr) const {

View File

@ -83,7 +83,7 @@ DataStreamer *getDataFileStreamer(const std::string &Filename,
if (error_code e = s->OpenFile(Filename)) { if (error_code e = s->OpenFile(Filename)) {
*StrError = std::string("Could not open ") + Filename + ": " + *StrError = std::string("Could not open ") + Filename + ": " +
e.message() + "\n"; e.message() + "\n";
return NULL; return nullptr;
} }
return s; return s;
} }

View File

@ -100,7 +100,7 @@ const char *llvm::dwarf::TagString(unsigned Tag) {
return "DW_TAG_GNU_formal_parameter_pack"; return "DW_TAG_GNU_formal_parameter_pack";
case DW_TAG_APPLE_property: return "DW_TAG_APPLE_property"; case DW_TAG_APPLE_property: return "DW_TAG_APPLE_property";
} }
return 0; return nullptr;
} }
/// ChildrenString - Return the string for the specified children flag. /// ChildrenString - Return the string for the specified children flag.
@ -110,7 +110,7 @@ const char *llvm::dwarf::ChildrenString(unsigned Children) {
case DW_CHILDREN_no: return "DW_CHILDREN_no"; case DW_CHILDREN_no: return "DW_CHILDREN_no";
case DW_CHILDREN_yes: return "DW_CHILDREN_yes"; case DW_CHILDREN_yes: return "DW_CHILDREN_yes";
} }
return 0; return nullptr;
} }
/// AttributeString - Return the string for the specified attribute. /// AttributeString - Return the string for the specified attribute.
@ -271,7 +271,7 @@ const char *llvm::dwarf::AttributeString(unsigned Attribute) {
case DW_AT_GNU_pubnames: return "DW_AT_GNU_pubnames"; case DW_AT_GNU_pubnames: return "DW_AT_GNU_pubnames";
case DW_AT_GNU_pubtypes: return "DW_AT_GNU_pubtypes"; case DW_AT_GNU_pubtypes: return "DW_AT_GNU_pubtypes";
} }
return 0; return nullptr;
} }
/// FormEncodingString - Return the string for the specified form encoding. /// FormEncodingString - Return the string for the specified form encoding.
@ -308,7 +308,7 @@ const char *llvm::dwarf::FormEncodingString(unsigned Encoding) {
case DW_FORM_GNU_addr_index: return "DW_FORM_GNU_addr_index"; case DW_FORM_GNU_addr_index: return "DW_FORM_GNU_addr_index";
case DW_FORM_GNU_str_index: return "DW_FORM_GNU_str_index"; case DW_FORM_GNU_str_index: return "DW_FORM_GNU_str_index";
} }
return 0; return nullptr;
} }
/// OperationEncodingString - Return the string for the specified operation /// OperationEncodingString - Return the string for the specified operation
@ -477,7 +477,7 @@ const char *llvm::dwarf::OperationEncodingString(unsigned Encoding) {
case DW_OP_GNU_addr_index: return "DW_OP_GNU_addr_index"; case DW_OP_GNU_addr_index: return "DW_OP_GNU_addr_index";
case DW_OP_GNU_const_index: return "DW_OP_GNU_const_index"; case DW_OP_GNU_const_index: return "DW_OP_GNU_const_index";
} }
return 0; return nullptr;
} }
/// AttributeEncodingString - Return the string for the specified attribute /// AttributeEncodingString - Return the string for the specified attribute
@ -503,7 +503,7 @@ const char *llvm::dwarf::AttributeEncodingString(unsigned Encoding) {
case DW_ATE_lo_user: return "DW_ATE_lo_user"; case DW_ATE_lo_user: return "DW_ATE_lo_user";
case DW_ATE_hi_user: return "DW_ATE_hi_user"; case DW_ATE_hi_user: return "DW_ATE_hi_user";
} }
return 0; return nullptr;
} }
/// DecimalSignString - Return the string for the specified decimal sign /// DecimalSignString - Return the string for the specified decimal sign
@ -516,7 +516,7 @@ const char *llvm::dwarf::DecimalSignString(unsigned Sign) {
case DW_DS_leading_separate: return "DW_DS_leading_separate"; case DW_DS_leading_separate: return "DW_DS_leading_separate";
case DW_DS_trailing_separate: return "DW_DS_trailing_separate"; case DW_DS_trailing_separate: return "DW_DS_trailing_separate";
} }
return 0; return nullptr;
} }
/// EndianityString - Return the string for the specified endianity. /// EndianityString - Return the string for the specified endianity.
@ -529,7 +529,7 @@ const char *llvm::dwarf::EndianityString(unsigned Endian) {
case DW_END_lo_user: return "DW_END_lo_user"; case DW_END_lo_user: return "DW_END_lo_user";
case DW_END_hi_user: return "DW_END_hi_user"; case DW_END_hi_user: return "DW_END_hi_user";
} }
return 0; return nullptr;
} }
/// AccessibilityString - Return the string for the specified accessibility. /// AccessibilityString - Return the string for the specified accessibility.
@ -541,7 +541,7 @@ const char *llvm::dwarf::AccessibilityString(unsigned Access) {
case DW_ACCESS_protected: return "DW_ACCESS_protected"; case DW_ACCESS_protected: return "DW_ACCESS_protected";
case DW_ACCESS_private: return "DW_ACCESS_private"; case DW_ACCESS_private: return "DW_ACCESS_private";
} }
return 0; return nullptr;
} }
/// VisibilityString - Return the string for the specified visibility. /// VisibilityString - Return the string for the specified visibility.
@ -552,7 +552,7 @@ const char *llvm::dwarf::VisibilityString(unsigned Visibility) {
case DW_VIS_exported: return "DW_VIS_exported"; case DW_VIS_exported: return "DW_VIS_exported";
case DW_VIS_qualified: return "DW_VIS_qualified"; case DW_VIS_qualified: return "DW_VIS_qualified";
} }
return 0; return nullptr;
} }
/// VirtualityString - Return the string for the specified virtuality. /// VirtualityString - Return the string for the specified virtuality.
@ -563,7 +563,7 @@ const char *llvm::dwarf::VirtualityString(unsigned Virtuality) {
case DW_VIRTUALITY_virtual: return "DW_VIRTUALITY_virtual"; case DW_VIRTUALITY_virtual: return "DW_VIRTUALITY_virtual";
case DW_VIRTUALITY_pure_virtual: return "DW_VIRTUALITY_pure_virtual"; case DW_VIRTUALITY_pure_virtual: return "DW_VIRTUALITY_pure_virtual";
} }
return 0; return nullptr;
} }
/// LanguageString - Return the string for the specified language. /// LanguageString - Return the string for the specified language.
@ -600,7 +600,7 @@ const char *llvm::dwarf::LanguageString(unsigned Language) {
case DW_LANG_lo_user: return "DW_LANG_lo_user"; case DW_LANG_lo_user: return "DW_LANG_lo_user";
case DW_LANG_hi_user: return "DW_LANG_hi_user"; case DW_LANG_hi_user: return "DW_LANG_hi_user";
} }
return 0; return nullptr;
} }
/// CaseString - Return the string for the specified identifier case. /// CaseString - Return the string for the specified identifier case.
@ -612,7 +612,7 @@ const char *llvm::dwarf::CaseString(unsigned Case) {
case DW_ID_down_case: return "DW_ID_down_case"; case DW_ID_down_case: return "DW_ID_down_case";
case DW_ID_case_insensitive: return "DW_ID_case_insensitive"; case DW_ID_case_insensitive: return "DW_ID_case_insensitive";
} }
return 0; return nullptr;
} }
/// ConventionString - Return the string for the specified calling convention. /// ConventionString - Return the string for the specified calling convention.
@ -625,7 +625,7 @@ const char *llvm::dwarf::ConventionString(unsigned Convention) {
case DW_CC_lo_user: return "DW_CC_lo_user"; case DW_CC_lo_user: return "DW_CC_lo_user";
case DW_CC_hi_user: return "DW_CC_hi_user"; case DW_CC_hi_user: return "DW_CC_hi_user";
} }
return 0; return nullptr;
} }
/// InlineCodeString - Return the string for the specified inline code. /// InlineCodeString - Return the string for the specified inline code.
@ -637,7 +637,7 @@ const char *llvm::dwarf::InlineCodeString(unsigned Code) {
case DW_INL_declared_not_inlined: return "DW_INL_declared_not_inlined"; case DW_INL_declared_not_inlined: return "DW_INL_declared_not_inlined";
case DW_INL_declared_inlined: return "DW_INL_declared_inlined"; case DW_INL_declared_inlined: return "DW_INL_declared_inlined";
} }
return 0; return nullptr;
} }
/// ArrayOrderString - Return the string for the specified array order. /// ArrayOrderString - Return the string for the specified array order.
@ -647,7 +647,7 @@ const char *llvm::dwarf::ArrayOrderString(unsigned Order) {
case DW_ORD_row_major: return "DW_ORD_row_major"; case DW_ORD_row_major: return "DW_ORD_row_major";
case DW_ORD_col_major: return "DW_ORD_col_major"; case DW_ORD_col_major: return "DW_ORD_col_major";
} }
return 0; return nullptr;
} }
/// DiscriminantString - Return the string for the specified discriminant /// DiscriminantString - Return the string for the specified discriminant
@ -657,7 +657,7 @@ const char *llvm::dwarf::DiscriminantString(unsigned Discriminant) {
case DW_DSC_label: return "DW_DSC_label"; case DW_DSC_label: return "DW_DSC_label";
case DW_DSC_range: return "DW_DSC_range"; case DW_DSC_range: return "DW_DSC_range";
} }
return 0; return nullptr;
} }
/// LNStandardString - Return the string for the specified line number standard. /// LNStandardString - Return the string for the specified line number standard.
@ -677,7 +677,7 @@ const char *llvm::dwarf::LNStandardString(unsigned Standard) {
case DW_LNS_set_epilogue_begin: return "DW_LNS_set_epilogue_begin"; case DW_LNS_set_epilogue_begin: return "DW_LNS_set_epilogue_begin";
case DW_LNS_set_isa: return "DW_LNS_set_isa"; case DW_LNS_set_isa: return "DW_LNS_set_isa";
} }
return 0; return nullptr;
} }
/// LNExtendedString - Return the string for the specified line number extended /// LNExtendedString - Return the string for the specified line number extended
@ -692,7 +692,7 @@ const char *llvm::dwarf::LNExtendedString(unsigned Encoding) {
case DW_LNE_lo_user: return "DW_LNE_lo_user"; case DW_LNE_lo_user: return "DW_LNE_lo_user";
case DW_LNE_hi_user: return "DW_LNE_hi_user"; case DW_LNE_hi_user: return "DW_LNE_hi_user";
} }
return 0; return nullptr;
} }
/// MacinfoString - Return the string for the specified macinfo type encodings. /// MacinfoString - Return the string for the specified macinfo type encodings.
@ -706,7 +706,7 @@ const char *llvm::dwarf::MacinfoString(unsigned Encoding) {
case DW_MACINFO_end_file: return "DW_MACINFO_end_file"; case DW_MACINFO_end_file: return "DW_MACINFO_end_file";
case DW_MACINFO_vendor_ext: return "DW_MACINFO_vendor_ext"; case DW_MACINFO_vendor_ext: return "DW_MACINFO_vendor_ext";
} }
return 0; return nullptr;
} }
/// CallFrameString - Return the string for the specified call frame instruction /// CallFrameString - Return the string for the specified call frame instruction
@ -745,7 +745,7 @@ const char *llvm::dwarf::CallFrameString(unsigned Encoding) {
case DW_CFA_lo_user: return "DW_CFA_lo_user"; case DW_CFA_lo_user: return "DW_CFA_lo_user";
case DW_CFA_hi_user: return "DW_CFA_hi_user"; case DW_CFA_hi_user: return "DW_CFA_hi_user";
} }
return 0; return nullptr;
} }
const char *llvm::dwarf::AtomTypeString(unsigned AT) { const char *llvm::dwarf::AtomTypeString(unsigned AT) {
@ -761,7 +761,7 @@ const char *llvm::dwarf::AtomTypeString(unsigned AT) {
case DW_ATOM_type_flags: case DW_ATOM_type_flags:
return "DW_ATOM_type_flags"; return "DW_ATOM_type_flags";
} }
return 0; return nullptr;
} }
const char *llvm::dwarf::GDBIndexEntryKindString(GDBIndexEntryKind Kind) { const char *llvm::dwarf::GDBIndexEntryKindString(GDBIndexEntryKind Kind) {

View File

@ -51,14 +51,14 @@ using namespace llvm::sys;
//=== independent code. //=== independent code.
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
static DenseSet<void *> *OpenedHandles = 0; static DenseSet<void *> *OpenedHandles = nullptr;
DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *filename, DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *filename,
std::string *errMsg) { std::string *errMsg) {
SmartScopedLock<true> lock(*SymbolsMutex); SmartScopedLock<true> lock(*SymbolsMutex);
void *handle = dlopen(filename, RTLD_LAZY|RTLD_GLOBAL); void *handle = dlopen(filename, RTLD_LAZY|RTLD_GLOBAL);
if (handle == 0) { if (handle == nullptr) {
if (errMsg) *errMsg = dlerror(); if (errMsg) *errMsg = dlerror();
return DynamicLibrary(); return DynamicLibrary();
} }
@ -70,7 +70,7 @@ DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *filename,
handle = RTLD_DEFAULT; handle = RTLD_DEFAULT;
#endif #endif
if (OpenedHandles == 0) if (OpenedHandles == nullptr)
OpenedHandles = new DenseSet<void *>(); OpenedHandles = new DenseSet<void *>();
// If we've already loaded this library, dlclose() the handle in order to // If we've already loaded this library, dlclose() the handle in order to
@ -83,7 +83,7 @@ DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *filename,
void *DynamicLibrary::getAddressOfSymbol(const char *symbolName) { void *DynamicLibrary::getAddressOfSymbol(const char *symbolName) {
if (!isValid()) if (!isValid())
return NULL; return nullptr;
return dlsym(Data, symbolName); return dlsym(Data, symbolName);
} }
@ -166,7 +166,7 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) {
#endif #endif
#undef EXPLICIT_SYMBOL #undef EXPLICIT_SYMBOL
return 0; return nullptr;
} }
#endif // LLVM_ON_WIN32 #endif // LLVM_ON_WIN32

View File

@ -34,8 +34,8 @@
using namespace llvm; using namespace llvm;
static fatal_error_handler_t ErrorHandler = 0; static fatal_error_handler_t ErrorHandler = nullptr;
static void *ErrorHandlerUserData = 0; static void *ErrorHandlerUserData = nullptr;
void llvm::install_fatal_error_handler(fatal_error_handler_t handler, void llvm::install_fatal_error_handler(fatal_error_handler_t handler,
void *user_data) { void *user_data) {
@ -47,7 +47,7 @@ void llvm::install_fatal_error_handler(fatal_error_handler_t handler,
} }
void llvm::remove_fatal_error_handler() { void llvm::remove_fatal_error_handler() {
ErrorHandler = 0; ErrorHandler = nullptr;
} }
void llvm::report_fatal_error(const char *Reason, bool GenCrashDiag) { void llvm::report_fatal_error(const char *Reason, bool GenCrashDiag) {

View File

@ -97,7 +97,7 @@ error_code FileOutputBuffer::create(StringRef FilePath,
error_code FileOutputBuffer::commit(int64_t NewSmallerSize) { error_code FileOutputBuffer::commit(int64_t NewSmallerSize) {
// Unmap buffer, letting OS flush dirty pages to file on disk. // Unmap buffer, letting OS flush dirty pages to file on disk.
Region.reset(0); Region.reset(nullptr);
// If requested, resize file as part of commit. // If requested, resize file as part of commit.
if ( NewSmallerSize != -1 ) { if ( NewSmallerSize != -1 ) {

View File

@ -190,7 +190,7 @@ FoldingSetNodeID::Intern(BumpPtrAllocator &Allocator) const {
static FoldingSetImpl::Node *GetNextPtr(void *NextInBucketPtr) { static FoldingSetImpl::Node *GetNextPtr(void *NextInBucketPtr) {
// The low bit is set if this is the pointer back to the bucket. // The low bit is set if this is the pointer back to the bucket.
if (reinterpret_cast<intptr_t>(NextInBucketPtr) & 1) if (reinterpret_cast<intptr_t>(NextInBucketPtr) & 1)
return 0; return nullptr;
return static_cast<FoldingSetImpl::Node*>(NextInBucketPtr); return static_cast<FoldingSetImpl::Node*>(NextInBucketPtr);
} }
@ -262,7 +262,7 @@ void FoldingSetImpl::GrowHashTable() {
while (Node *NodeInBucket = GetNextPtr(Probe)) { while (Node *NodeInBucket = GetNextPtr(Probe)) {
// Figure out the next link, remove NodeInBucket from the old link. // Figure out the next link, remove NodeInBucket from the old link.
Probe = NodeInBucket->getNextInBucket(); Probe = NodeInBucket->getNextInBucket();
NodeInBucket->SetNextInBucket(0); NodeInBucket->SetNextInBucket(nullptr);
// Insert the node into the new bucket, after recomputing the hash. // Insert the node into the new bucket, after recomputing the hash.
InsertNode(NodeInBucket, InsertNode(NodeInBucket,
@ -285,7 +285,7 @@ FoldingSetImpl::Node
void **Bucket = GetBucketFor(IDHash, Buckets, NumBuckets); void **Bucket = GetBucketFor(IDHash, Buckets, NumBuckets);
void *Probe = *Bucket; void *Probe = *Bucket;
InsertPos = 0; InsertPos = nullptr;
FoldingSetNodeID TempID; FoldingSetNodeID TempID;
while (Node *NodeInBucket = GetNextPtr(Probe)) { while (Node *NodeInBucket = GetNextPtr(Probe)) {
@ -298,7 +298,7 @@ FoldingSetImpl::Node
// Didn't find the node, return null with the bucket as the InsertPos. // Didn't find the node, return null with the bucket as the InsertPos.
InsertPos = Bucket; InsertPos = Bucket;
return 0; return nullptr;
} }
/// InsertNode - Insert the specified node into the folding set, knowing that it /// InsertNode - Insert the specified node into the folding set, knowing that it
@ -323,7 +323,7 @@ void FoldingSetImpl::InsertNode(Node *N, void *InsertPos) {
// If this is the first insertion into this bucket, its next pointer will be // If this is the first insertion into this bucket, its next pointer will be
// null. Pretend as if it pointed to itself, setting the low bit to indicate // null. Pretend as if it pointed to itself, setting the low bit to indicate
// that it is a pointer to the bucket. // that it is a pointer to the bucket.
if (Next == 0) if (Next == nullptr)
Next = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(Bucket)|1); Next = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(Bucket)|1);
// Set the node's next pointer, and make the bucket point to the node. // Set the node's next pointer, and make the bucket point to the node.
@ -337,10 +337,10 @@ bool FoldingSetImpl::RemoveNode(Node *N) {
// Because each bucket is a circular list, we don't need to compute N's hash // Because each bucket is a circular list, we don't need to compute N's hash
// to remove it. // to remove it.
void *Ptr = N->getNextInBucket(); void *Ptr = N->getNextInBucket();
if (Ptr == 0) return false; // Not in folding set. if (Ptr == nullptr) return false; // Not in folding set.
--NumNodes; --NumNodes;
N->SetNextInBucket(0); N->SetNextInBucket(nullptr);
// Remember what N originally pointed to, either a bucket or another node. // Remember what N originally pointed to, either a bucket or another node.
void *NodeNextPtr = Ptr; void *NodeNextPtr = Ptr;
@ -390,7 +390,7 @@ FoldingSetImpl::Node *FoldingSetImpl::GetOrInsertNode(FoldingSetImpl::Node *N) {
FoldingSetIteratorImpl::FoldingSetIteratorImpl(void **Bucket) { FoldingSetIteratorImpl::FoldingSetIteratorImpl(void **Bucket) {
// Skip to the first non-null non-self-cycle bucket. // Skip to the first non-null non-self-cycle bucket.
while (*Bucket != reinterpret_cast<void*>(-1) && while (*Bucket != reinterpret_cast<void*>(-1) &&
(*Bucket == 0 || GetNextPtr(*Bucket) == 0)) (*Bucket == nullptr || GetNextPtr(*Bucket) == nullptr))
++Bucket; ++Bucket;
NodePtr = static_cast<FoldingSetNode*>(*Bucket); NodePtr = static_cast<FoldingSetNode*>(*Bucket);
@ -410,7 +410,7 @@ void FoldingSetIteratorImpl::advance() {
do { do {
++Bucket; ++Bucket;
} while (*Bucket != reinterpret_cast<void*>(-1) && } while (*Bucket != reinterpret_cast<void*>(-1) &&
(*Bucket == 0 || GetNextPtr(*Bucket) == 0)); (*Bucket == nullptr || GetNextPtr(*Bucket) == nullptr));
NodePtr = static_cast<FoldingSetNode*>(*Bucket); NodePtr = static_cast<FoldingSetNode*>(*Bucket);
} }
@ -420,5 +420,6 @@ void FoldingSetIteratorImpl::advance() {
// FoldingSetBucketIteratorImpl Implementation // FoldingSetBucketIteratorImpl Implementation
FoldingSetBucketIteratorImpl::FoldingSetBucketIteratorImpl(void **Bucket) { FoldingSetBucketIteratorImpl::FoldingSetBucketIteratorImpl(void **Bucket) {
Ptr = (*Bucket == 0 || GetNextPtr(*Bucket) == 0) ? (void*) Bucket : *Bucket; Ptr = (*Bucket == nullptr || GetNextPtr(*Bucket) == nullptr) ? (void*) Bucket
: *Bucket;
} }

View File

@ -81,7 +81,7 @@ void formatted_raw_ostream::write_impl(const char *Ptr, size_t Size) {
TheStream->write(Ptr, Size); TheStream->write(Ptr, Size);
// Reset the scanning pointer. // Reset the scanning pointer.
Scanned = 0; Scanned = nullptr;
} }
/// fouts() - This returns a reference to a formatted_raw_ostream for /// fouts() - This returns a reference to a formatted_raw_ostream for

View File

@ -83,7 +83,7 @@ static bool LLVM_ATTRIBUTE_UNUSED
ExecGraphViewer(StringRef ExecPath, std::vector<const char*> &args, ExecGraphViewer(StringRef ExecPath, std::vector<const char*> &args,
StringRef Filename, bool wait, std::string &ErrMsg) { StringRef Filename, bool wait, std::string &ErrMsg) {
if (wait) { if (wait) {
if (sys::ExecuteAndWait(ExecPath, &args[0],0,0,0,0,&ErrMsg)) { if (sys::ExecuteAndWait(ExecPath, &args[0],nullptr,nullptr,0,0,&ErrMsg)) {
errs() << "Error: " << ErrMsg << "\n"; errs() << "Error: " << ErrMsg << "\n";
return false; return false;
} }
@ -91,7 +91,7 @@ ExecGraphViewer(StringRef ExecPath, std::vector<const char*> &args,
errs() << " done. \n"; errs() << " done. \n";
} }
else { else {
sys::ExecuteNoWait(ExecPath, &args[0],0,0,0,&ErrMsg); sys::ExecuteNoWait(ExecPath, &args[0],nullptr,nullptr,0,&ErrMsg);
errs() << "Remember to erase graph file: " << Filename.str() << "\n"; errs() << "Remember to erase graph file: " << Filename.str() << "\n";
} }
return true; return true;
@ -108,7 +108,7 @@ void llvm::DisplayGraph(StringRef FilenameRef, bool wait,
std::vector<const char*> args; std::vector<const char*> args;
args.push_back(Graphviz.c_str()); args.push_back(Graphviz.c_str());
args.push_back(Filename.c_str()); args.push_back(Filename.c_str());
args.push_back(0); args.push_back(nullptr);
errs() << "Running 'Graphviz' program... "; errs() << "Running 'Graphviz' program... ";
if (!ExecGraphViewer(Graphviz, args, Filename, wait, ErrMsg)) if (!ExecGraphViewer(Graphviz, args, Filename, wait, ErrMsg))

View File

@ -58,7 +58,7 @@ void Path::moveLeft(unsigned Level) {
} }
} else if (height() < Level) } else if (height() < Level)
// end() may have created a height=0 path. // end() may have created a height=0 path.
path.resize(Level + 1, Entry(0, 0, 0)); path.resize(Level + 1, Entry(nullptr, 0, 0));
// NR is the subtree containing our left sibling. // NR is the subtree containing our left sibling.
--path[l].offset; --path[l].offset;

View File

@ -13,9 +13,10 @@
using namespace llvm; using namespace llvm;
line_iterator::line_iterator(const MemoryBuffer &Buffer, char CommentMarker) line_iterator::line_iterator(const MemoryBuffer &Buffer, char CommentMarker)
: Buffer(Buffer.getBufferSize() ? &Buffer : 0), : Buffer(Buffer.getBufferSize() ? &Buffer : nullptr),
CommentMarker(CommentMarker), LineNumber(1), CommentMarker(CommentMarker), LineNumber(1),
CurrentLine(Buffer.getBufferSize() ? Buffer.getBufferStart() : 0, 0) { CurrentLine(Buffer.getBufferSize() ? Buffer.getBufferStart() : nullptr,
0) {
// Ensure that if we are constructed on a non-empty memory buffer that it is // Ensure that if we are constructed on a non-empty memory buffer that it is
// a null terminated buffer. // a null terminated buffer.
if (Buffer.getBufferSize()) { if (Buffer.getBufferSize()) {
@ -53,7 +54,7 @@ void line_iterator::advance() {
if (*Pos == '\0') { if (*Pos == '\0') {
// We've hit the end of the buffer, reset ourselves to the end state. // We've hit the end of the buffer, reset ourselves to the end state.
Buffer = 0; Buffer = nullptr;
CurrentLine = StringRef(); CurrentLine = StringRef();
return; return;
} }

View File

@ -196,7 +196,7 @@ LockFileManager::WaitForUnlockResult LockFileManager::waitForUnlock() {
#if LLVM_ON_WIN32 #if LLVM_ON_WIN32
Sleep(Interval); Sleep(Interval);
#else #else
nanosleep(&Interval, NULL); nanosleep(&Interval, nullptr);
#endif #endif
bool LockFileJustDisappeared = false; bool LockFileJustDisappeared = false;

View File

@ -17,15 +17,15 @@
#include <cassert> #include <cassert>
using namespace llvm; using namespace llvm;
static const ManagedStaticBase *StaticList = 0; static const ManagedStaticBase *StaticList = nullptr;
void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(), void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(),
void (*Deleter)(void*)) const { void (*Deleter)(void*)) const {
if (llvm_is_multithreaded()) { if (llvm_is_multithreaded()) {
llvm_acquire_global_lock(); llvm_acquire_global_lock();
if (Ptr == 0) { if (Ptr == nullptr) {
void* tmp = Creator ? Creator() : 0; void* tmp = Creator ? Creator() : nullptr;
TsanHappensBefore(this); TsanHappensBefore(this);
sys::MemoryFence(); sys::MemoryFence();
@ -47,7 +47,7 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(),
} else { } else {
assert(Ptr == 0 && DeleterFn == 0 && Next == 0 && assert(Ptr == 0 && DeleterFn == 0 && Next == 0 &&
"Partially initialized ManagedStatic!?"); "Partially initialized ManagedStatic!?");
Ptr = Creator ? Creator() : 0; Ptr = Creator ? Creator() : nullptr;
DeleterFn = Deleter; DeleterFn = Deleter;
// Add to list of managed statics. // Add to list of managed statics.
@ -62,14 +62,14 @@ void ManagedStaticBase::destroy() const {
"Not destroyed in reverse order of construction?"); "Not destroyed in reverse order of construction?");
// Unlink from list. // Unlink from list.
StaticList = Next; StaticList = Next;
Next = 0; Next = nullptr;
// Destroy memory. // Destroy memory.
DeleterFn(Ptr); DeleterFn(Ptr);
// Cleanup. // Cleanup.
Ptr = 0; Ptr = nullptr;
DeleterFn = 0; DeleterFn = nullptr;
} }
/// llvm_shutdown - Deallocate and destroy all ManagedStatic variables. /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables.

View File

@ -117,7 +117,7 @@ MemoryBuffer *MemoryBuffer::getMemBuffer(StringRef InputData,
MemoryBuffer *MemoryBuffer::getMemBufferCopy(StringRef InputData, MemoryBuffer *MemoryBuffer::getMemBufferCopy(StringRef InputData,
StringRef BufferName) { StringRef BufferName) {
MemoryBuffer *Buf = getNewUninitMemBuffer(InputData.size(), BufferName); MemoryBuffer *Buf = getNewUninitMemBuffer(InputData.size(), BufferName);
if (!Buf) return 0; if (!Buf) return nullptr;
memcpy(const_cast<char*>(Buf->getBufferStart()), InputData.data(), memcpy(const_cast<char*>(Buf->getBufferStart()), InputData.data(),
InputData.size()); InputData.size());
return Buf; return Buf;
@ -137,7 +137,7 @@ MemoryBuffer *MemoryBuffer::getNewUninitMemBuffer(size_t Size,
RoundUpToAlignment(sizeof(MemoryBufferMem) + BufferName.size() + 1, 16); RoundUpToAlignment(sizeof(MemoryBufferMem) + BufferName.size() + 1, 16);
size_t RealLen = AlignedStringLen + Size + 1; size_t RealLen = AlignedStringLen + Size + 1;
char *Mem = static_cast<char*>(operator new(RealLen, std::nothrow)); char *Mem = static_cast<char*>(operator new(RealLen, std::nothrow));
if (!Mem) return 0; if (!Mem) return nullptr;
// The name is stored after the class itself. // The name is stored after the class itself.
CopyStringRef(Mem + sizeof(MemoryBufferMem), BufferName); CopyStringRef(Mem + sizeof(MemoryBufferMem), BufferName);
@ -155,7 +155,7 @@ MemoryBuffer *MemoryBuffer::getNewUninitMemBuffer(size_t Size,
/// the MemoryBuffer object. /// the MemoryBuffer object.
MemoryBuffer *MemoryBuffer::getNewMemBuffer(size_t Size, StringRef BufferName) { MemoryBuffer *MemoryBuffer::getNewMemBuffer(size_t Size, StringRef BufferName) {
MemoryBuffer *SB = getNewUninitMemBuffer(Size, BufferName); MemoryBuffer *SB = getNewUninitMemBuffer(Size, BufferName);
if (!SB) return 0; if (!SB) return nullptr;
memset(const_cast<char*>(SB->getBufferStart()), 0, Size); memset(const_cast<char*>(SB->getBufferStart()), 0, Size);
return SB; return SB;
} }

View File

@ -42,7 +42,7 @@ using namespace sys;
// Construct a Mutex using pthread calls // Construct a Mutex using pthread calls
MutexImpl::MutexImpl( bool recursive) MutexImpl::MutexImpl( bool recursive)
: data_(0) : data_(nullptr)
{ {
// Declare the pthread_mutex data structures // Declare the pthread_mutex data structures
pthread_mutex_t* mutex = pthread_mutex_t* mutex =

View File

@ -577,7 +577,7 @@ void system_temp_directory(bool erasedOnReboot, SmallVectorImpl<char> &result) {
// macros defined in <unistd.h> on darwin >= 9 // macros defined in <unistd.h> on darwin >= 9
int ConfName = erasedOnReboot? _CS_DARWIN_USER_TEMP_DIR int ConfName = erasedOnReboot? _CS_DARWIN_USER_TEMP_DIR
: _CS_DARWIN_USER_CACHE_DIR; : _CS_DARWIN_USER_CACHE_DIR;
size_t ConfLen = confstr(ConfName, 0, 0); size_t ConfLen = confstr(ConfName, nullptr, 0);
if (ConfLen > 0) { if (ConfLen > 0) {
do { do {
result.resize(ConfLen); result.resize(ConfLen);

View File

@ -46,7 +46,7 @@ static unsigned PrintStack(const PrettyStackTraceEntry *Entry, raw_ostream &OS){
/// PrintCurStackTrace - Print the current stack trace to the specified stream. /// PrintCurStackTrace - Print the current stack trace to the specified stream.
static void PrintCurStackTrace(raw_ostream &OS) { static void PrintCurStackTrace(raw_ostream &OS) {
// Don't print an empty trace. // Don't print an empty trace.
if (PrettyStackTraceHead->get() == 0) return; if (PrettyStackTraceHead->get() == nullptr) return;
// If there are pretty stack frames registered, walk and emit them. // If there are pretty stack frames registered, walk and emit them.
OS << "Stack dump:\n"; OS << "Stack dump:\n";
@ -136,7 +136,7 @@ void PrettyStackTraceProgram::print(raw_ostream &OS) const {
} }
static bool RegisterCrashPrinter() { static bool RegisterCrashPrinter() {
sys::AddSignalHandler(CrashHandler, 0); sys::AddSignalHandler(CrashHandler, nullptr);
return false; return false;
} }

View File

@ -44,7 +44,7 @@ using namespace sys;
// Construct a RWMutex using pthread calls // Construct a RWMutex using pthread calls
RWMutexImpl::RWMutexImpl() RWMutexImpl::RWMutexImpl()
: data_(0) : data_(nullptr)
{ {
// Declare the pthread_rwlock data structures // Declare the pthread_rwlock data structures
pthread_rwlock_t* rwlock = pthread_rwlock_t* rwlock =
@ -56,7 +56,7 @@ RWMutexImpl::RWMutexImpl()
#endif #endif
// Initialize the rwlock // Initialize the rwlock
int errorcode = pthread_rwlock_init(rwlock, NULL); int errorcode = pthread_rwlock_init(rwlock, nullptr);
(void)errorcode; (void)errorcode;
assert(errorcode == 0); assert(errorcode == 0);

View File

@ -43,7 +43,7 @@ bool Regex::isValid(std::string &Error) {
if (!error) if (!error)
return true; return true;
size_t len = llvm_regerror(error, preg, NULL, 0); size_t len = llvm_regerror(error, preg, nullptr, 0);
Error.resize(len - 1); Error.resize(len - 1);
llvm_regerror(error, preg, &Error[0], len); llvm_regerror(error, preg, &Error[0], len);

View File

@ -48,7 +48,7 @@ static void *DoSearch(const char* symbolName) {
#endif #endif
#undef EXPLICIT_SYMBOL #undef EXPLICIT_SYMBOL
return 0; return nullptr;
} }
namespace llvm { namespace llvm {

View File

@ -103,7 +103,7 @@ const void * const *SmallPtrSetImplBase::FindBucketFor(const void *Ptr) const {
unsigned ArraySize = CurArraySize; unsigned ArraySize = CurArraySize;
unsigned ProbeAmt = 1; unsigned ProbeAmt = 1;
const void *const *Array = CurArray; const void *const *Array = CurArray;
const void *const *Tombstone = 0; const void *const *Tombstone = nullptr;
while (1) { while (1) {
// Found Ptr's bucket? // Found Ptr's bucket?
if (Array[Bucket] == Ptr) if (Array[Bucket] == Ptr)

View File

@ -114,7 +114,7 @@ SourceMgr::getLineAndColumn(SMLoc Loc, int BufferID) const {
if (*Ptr == '\n') ++LineNo; if (*Ptr == '\n') ++LineNo;
// Allocate the line number cache if it doesn't exist. // Allocate the line number cache if it doesn't exist.
if (LineNoCache == 0) if (LineNoCache == nullptr)
LineNoCache = new LineNoCacheTy(); LineNoCache = new LineNoCacheTy();
// Update the line # cache. // Update the line # cache.
@ -228,7 +228,7 @@ void SourceMgr::PrintMessage(raw_ostream &OS, SMLoc Loc,
PrintIncludeStack(getBufferInfo(CurBuf).IncludeLoc, OS); PrintIncludeStack(getBufferInfo(CurBuf).IncludeLoc, OS);
} }
Diagnostic.print(0, OS, ShowColors); Diagnostic.print(nullptr, OS, ShowColors);
} }
void SourceMgr::PrintMessage(SMLoc Loc, SourceMgr::DiagKind Kind, void SourceMgr::PrintMessage(SMLoc Loc, SourceMgr::DiagKind Kind,

View File

@ -27,7 +27,7 @@ StringMapImpl::StringMapImpl(unsigned InitSize, unsigned itemSize) {
} }
// Otherwise, initialize it with zero buckets to avoid the allocation. // Otherwise, initialize it with zero buckets to avoid the allocation.
TheTable = 0; TheTable = nullptr;
NumBuckets = 0; NumBuckets = 0;
NumItems = 0; NumItems = 0;
NumTombstones = 0; NumTombstones = 0;
@ -70,7 +70,7 @@ unsigned StringMapImpl::LookupBucketFor(StringRef Name) {
while (1) { while (1) {
StringMapEntryBase *BucketItem = TheTable[BucketNo]; StringMapEntryBase *BucketItem = TheTable[BucketNo];
// If we found an empty bucket, this key isn't in the table yet, return it. // If we found an empty bucket, this key isn't in the table yet, return it.
if (LLVM_LIKELY(BucketItem == 0)) { if (LLVM_LIKELY(BucketItem == nullptr)) {
// If we found a tombstone, we want to reuse the tombstone instead of an // If we found a tombstone, we want to reuse the tombstone instead of an
// empty bucket. This reduces probing. // empty bucket. This reduces probing.
if (FirstTombstone != -1) { if (FirstTombstone != -1) {
@ -124,7 +124,7 @@ int StringMapImpl::FindKey(StringRef Key) const {
while (1) { while (1) {
StringMapEntryBase *BucketItem = TheTable[BucketNo]; StringMapEntryBase *BucketItem = TheTable[BucketNo];
// If we found an empty bucket, this key isn't in the table yet, return. // If we found an empty bucket, this key isn't in the table yet, return.
if (LLVM_LIKELY(BucketItem == 0)) if (LLVM_LIKELY(BucketItem == nullptr))
return -1; return -1;
if (BucketItem == getTombstoneVal()) { if (BucketItem == getTombstoneVal()) {
@ -166,7 +166,7 @@ void StringMapImpl::RemoveKey(StringMapEntryBase *V) {
/// table, returning it. If the key is not in the table, this returns null. /// table, returning it. If the key is not in the table, this returns null.
StringMapEntryBase *StringMapImpl::RemoveKey(StringRef Key) { StringMapEntryBase *StringMapImpl::RemoveKey(StringRef Key) {
int Bucket = FindKey(Key); int Bucket = FindKey(Key);
if (Bucket == -1) return 0; if (Bucket == -1) return nullptr;
StringMapEntryBase *Result = TheTable[Bucket]; StringMapEntryBase *Result = TheTable[Bucket];
TheTable[Bucket] = getTombstoneVal(); TheTable[Bucket] = getTombstoneVal();
@ -212,7 +212,7 @@ void StringMapImpl::RehashTable() {
// Fast case, bucket available. // Fast case, bucket available.
unsigned FullHash = HashTable[I]; unsigned FullHash = HashTable[I];
unsigned NewBucket = FullHash & (NewSize-1); unsigned NewBucket = FullHash & (NewSize-1);
if (NewTableArray[NewBucket] == 0) { if (NewTableArray[NewBucket] == nullptr) {
NewTableArray[FullHash & (NewSize-1)] = Bucket; NewTableArray[FullHash & (NewSize-1)] = Bucket;
NewHashArray[FullHash & (NewSize-1)] = FullHash; NewHashArray[FullHash & (NewSize-1)] = FullHash;
continue; continue;

View File

@ -281,7 +281,7 @@ void StringRef::split(SmallVectorImpl<StringRef> &A,
// rest.data() is used to distinguish cases like "a," that splits into // rest.data() is used to distinguish cases like "a," that splits into
// "a" + "" and "a" that splits into "a" + 0. // "a" + "" and "a" that splits into "a" + 0.
for (int splits = 0; for (int splits = 0;
rest.data() != NULL && (MaxSplit < 0 || splits < MaxSplit); rest.data() != nullptr && (MaxSplit < 0 || splits < MaxSplit);
++splits) { ++splits) {
std::pair<StringRef, StringRef> p = rest.split(Separators); std::pair<StringRef, StringRef> p = rest.split(Separators);
@ -290,7 +290,7 @@ void StringRef::split(SmallVectorImpl<StringRef> &A,
rest = p.second; rest = p.second;
} }
// If we have a tail left, add it. // If we have a tail left, add it.
if (rest.data() != NULL && (rest.size() != 0 || KeepEmpty)) if (rest.data() != nullptr && (rest.size() != 0 || KeepEmpty))
A.push_back(rest); A.push_back(rest);
} }

View File

@ -17,7 +17,7 @@
using namespace llvm; using namespace llvm;
// Clients are responsible for avoid race conditions in registration. // Clients are responsible for avoid race conditions in registration.
static Target *FirstTarget = 0; static Target *FirstTarget = nullptr;
TargetRegistry::iterator TargetRegistry::begin() { TargetRegistry::iterator TargetRegistry::begin() {
return iterator(FirstTarget); return iterator(FirstTarget);
@ -29,7 +29,7 @@ const Target *TargetRegistry::lookupTarget(const std::string &ArchName,
// Allocate target machine. First, check whether the user has explicitly // Allocate target machine. First, check whether the user has explicitly
// specified an architecture to compile for. If so we have to look it up by // specified an architecture to compile for. If so we have to look it up by
// name, because it might be a backend that has no mapping to a target triple. // name, because it might be a backend that has no mapping to a target triple.
const Target *TheTarget = 0; const Target *TheTarget = nullptr;
if (!ArchName.empty()) { if (!ArchName.empty()) {
for (TargetRegistry::iterator it = TargetRegistry::begin(), for (TargetRegistry::iterator it = TargetRegistry::begin(),
ie = TargetRegistry::end(); it != ie; ++it) { ie = TargetRegistry::end(); it != ie; ++it) {
@ -41,7 +41,7 @@ const Target *TargetRegistry::lookupTarget(const std::string &ArchName,
if (!TheTarget) { if (!TheTarget) {
Error = "error: invalid target '" + ArchName + "'.\n"; Error = "error: invalid target '" + ArchName + "'.\n";
return 0; return nullptr;
} }
// Adjust the triple to match (if known), otherwise stick with the // Adjust the triple to match (if known), otherwise stick with the
@ -53,11 +53,11 @@ const Target *TargetRegistry::lookupTarget(const std::string &ArchName,
// Get the target specific parser. // Get the target specific parser.
std::string TempError; std::string TempError;
TheTarget = TargetRegistry::lookupTarget(TheTriple.getTriple(), TempError); TheTarget = TargetRegistry::lookupTarget(TheTriple.getTriple(), TempError);
if (TheTarget == 0) { if (TheTarget == nullptr) {
Error = ": error: unable to get target for '" Error = ": error: unable to get target for '"
+ TheTriple.getTriple() + TheTriple.getTriple()
+ "', see --version and --triple.\n"; + "', see --version and --triple.\n";
return 0; return nullptr;
} }
} }
@ -69,16 +69,16 @@ const Target *TargetRegistry::lookupTarget(const std::string &TT,
// Provide special warning when no targets are initialized. // Provide special warning when no targets are initialized.
if (begin() == end()) { if (begin() == end()) {
Error = "Unable to find target for this triple (no targets are registered)"; Error = "Unable to find target for this triple (no targets are registered)";
return 0; return nullptr;
} }
const Target *Matching = 0; const Target *Matching = nullptr;
Triple::ArchType Arch = Triple(TT).getArch(); Triple::ArchType Arch = Triple(TT).getArch();
for (iterator it = begin(), ie = end(); it != ie; ++it) { for (iterator it = begin(), ie = end(); it != ie; ++it) {
if (it->ArchMatchFn(Arch)) { if (it->ArchMatchFn(Arch)) {
if (Matching) { if (Matching) {
Error = std::string("Cannot choose between targets \"") + Error = std::string("Cannot choose between targets \"") +
Matching->Name + "\" and \"" + it->Name + "\""; Matching->Name + "\" and \"" + it->Name + "\"";
return 0; return nullptr;
} }
Matching = &*it; Matching = &*it;
} }
@ -87,7 +87,7 @@ const Target *TargetRegistry::lookupTarget(const std::string &TT,
if (!Matching) { if (!Matching) {
Error = "No available targets are compatible with this triple, " Error = "No available targets are compatible with this triple, "
"see -version for the available targets."; "see -version for the available targets.";
return 0; return nullptr;
} }
return Matching; return Matching;
@ -121,7 +121,7 @@ const Target *TargetRegistry::getClosestTargetForJIT(std::string &Error) {
if (TheTarget && !TheTarget->hasJIT()) { if (TheTarget && !TheTarget->hasJIT()) {
Error = "No JIT compatible target available for this host"; Error = "No JIT compatible target available for this host";
return 0; return nullptr;
} }
return TheTarget; return TheTarget;

View File

@ -53,7 +53,7 @@ using namespace sys;
ThreadLocalImpl::ThreadLocalImpl() : data() { ThreadLocalImpl::ThreadLocalImpl() : data() {
static_assert(sizeof(pthread_key_t) <= sizeof(data), "size too big"); static_assert(sizeof(pthread_key_t) <= sizeof(data), "size too big");
pthread_key_t* key = reinterpret_cast<pthread_key_t*>(&data); pthread_key_t* key = reinterpret_cast<pthread_key_t*>(&data);
int errorcode = pthread_key_create(key, NULL); int errorcode = pthread_key_create(key, nullptr);
assert(errorcode == 0); assert(errorcode == 0);
(void) errorcode; (void) errorcode;
} }
@ -78,7 +78,7 @@ const void* ThreadLocalImpl::getInstance() {
} }
void ThreadLocalImpl::removeInstance() { void ThreadLocalImpl::removeInstance() {
setInstance(0); setInstance(nullptr);
} }
} }

View File

@ -21,7 +21,7 @@ using namespace llvm;
static bool multithreaded_mode = false; static bool multithreaded_mode = false;
static sys::Mutex* global_lock = 0; static sys::Mutex* global_lock = nullptr;
bool llvm::llvm_start_multithreaded() { bool llvm::llvm_start_multithreaded() {
#if LLVM_ENABLE_THREADS != 0 #if LLVM_ENABLE_THREADS != 0
@ -73,7 +73,7 @@ struct ThreadInfo {
static void *ExecuteOnThread_Dispatch(void *Arg) { static void *ExecuteOnThread_Dispatch(void *Arg) {
ThreadInfo *TI = reinterpret_cast<ThreadInfo*>(Arg); ThreadInfo *TI = reinterpret_cast<ThreadInfo*>(Arg);
TI->UserFn(TI->UserData); TI->UserFn(TI->UserData);
return 0; return nullptr;
} }
void llvm::llvm_execute_on_thread(void (*Fn)(void*), void *UserData, void llvm::llvm_execute_on_thread(void (*Fn)(void*), void *UserData,
@ -97,7 +97,7 @@ void llvm::llvm_execute_on_thread(void (*Fn)(void*), void *UserData,
goto error; goto error;
// Wait for the thread and clean up. // Wait for the thread and clean up.
::pthread_join(Thread, 0); ::pthread_join(Thread, nullptr);
error: error:
::pthread_attr_destroy(&Attr); ::pthread_attr_destroy(&Attr);

View File

@ -77,7 +77,7 @@ raw_ostream *llvm::CreateInfoOutputFile() {
} }
static TimerGroup *DefaultTimerGroup = 0; static TimerGroup *DefaultTimerGroup = nullptr;
static TimerGroup *getDefaultTimerGroup() { static TimerGroup *getDefaultTimerGroup() {
TimerGroup *tmp = DefaultTimerGroup; TimerGroup *tmp = DefaultTimerGroup;
sys::MemoryFence(); sys::MemoryFence();
@ -235,11 +235,11 @@ static Timer &getNamedRegionTimer(StringRef Name) {
NamedRegionTimer::NamedRegionTimer(StringRef Name, NamedRegionTimer::NamedRegionTimer(StringRef Name,
bool Enabled) bool Enabled)
: TimeRegion(!Enabled ? 0 : &getNamedRegionTimer(Name)) {} : TimeRegion(!Enabled ? nullptr : &getNamedRegionTimer(Name)) {}
NamedRegionTimer::NamedRegionTimer(StringRef Name, StringRef GroupName, NamedRegionTimer::NamedRegionTimer(StringRef Name, StringRef GroupName,
bool Enabled) bool Enabled)
: TimeRegion(!Enabled ? 0 : &NamedGroupedTimers->get(Name, GroupName)) {} : TimeRegion(!Enabled ? nullptr : &NamedGroupedTimers->get(Name, GroupName)){}
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// TimerGroup Implementation // TimerGroup Implementation
@ -247,10 +247,10 @@ NamedRegionTimer::NamedRegionTimer(StringRef Name, StringRef GroupName,
/// TimerGroupList - This is the global list of TimerGroups, maintained by the /// TimerGroupList - This is the global list of TimerGroups, maintained by the
/// TimerGroup ctor/dtor and is protected by the TimerLock lock. /// TimerGroup ctor/dtor and is protected by the TimerLock lock.
static TimerGroup *TimerGroupList = 0; static TimerGroup *TimerGroupList = nullptr;
TimerGroup::TimerGroup(StringRef name) TimerGroup::TimerGroup(StringRef name)
: Name(name.begin(), name.end()), FirstTimer(0) { : Name(name.begin(), name.end()), FirstTimer(nullptr) {
// Add the group to TimerGroupList. // Add the group to TimerGroupList.
sys::SmartScopedLock<true> L(*TimerLock); sys::SmartScopedLock<true> L(*TimerLock);
@ -264,7 +264,7 @@ TimerGroup::TimerGroup(StringRef name)
TimerGroup::~TimerGroup() { TimerGroup::~TimerGroup() {
// If the timer group is destroyed before the timers it owns, accumulate and // If the timer group is destroyed before the timers it owns, accumulate and
// print the timing data. // print the timing data.
while (FirstTimer != 0) while (FirstTimer != nullptr)
removeTimer(*FirstTimer); removeTimer(*FirstTimer);
// Remove the group from the TimerGroupList. // Remove the group from the TimerGroupList.
@ -282,7 +282,7 @@ void TimerGroup::removeTimer(Timer &T) {
if (T.Started) if (T.Started)
TimersToPrint.push_back(std::make_pair(T.Time, T.Name)); TimersToPrint.push_back(std::make_pair(T.Time, T.Name));
T.TG = 0; T.TG = nullptr;
// Unlink the timer from our list. // Unlink the timer from our list.
*T.Prev = T.Next; *T.Prev = T.Next;
@ -291,7 +291,7 @@ void TimerGroup::removeTimer(Timer &T) {
// Print the report when all timers in this group are destroyed if some of // Print the report when all timers in this group are destroyed if some of
// them were started. // them were started.
if (FirstTimer != 0 || TimersToPrint.empty()) if (FirstTimer != nullptr || TimersToPrint.empty())
return; return;
raw_ostream *OutStream = CreateInfoOutputFile(); raw_ostream *OutStream = CreateInfoOutputFile();

View File

@ -57,7 +57,7 @@ const char *Triple::getArchTypeName(ArchType Kind) {
const char *Triple::getArchTypePrefix(ArchType Kind) { const char *Triple::getArchTypePrefix(ArchType Kind) {
switch (Kind) { switch (Kind) {
default: default:
return 0; return nullptr;
case aarch64: case aarch64:
case aarch64_be: return "aarch64"; case aarch64_be: return "aarch64";
@ -210,7 +210,7 @@ Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) {
// Returns architecture name that is understood by the target assembler. // Returns architecture name that is understood by the target assembler.
const char *Triple::getArchNameForAssembler() { const char *Triple::getArchNameForAssembler() {
if (!isOSDarwin() && getVendor() != Triple::Apple) if (!isOSDarwin() && getVendor() != Triple::Apple)
return NULL; return nullptr;
return StringSwitch<const char*>(getArchName()) return StringSwitch<const char*>(getArchName())
.Case("i386", "i386") .Case("i386", "i386")
@ -232,7 +232,7 @@ const char *Triple::getArchNameForAssembler() {
.Case("amdil", "amdil") .Case("amdil", "amdil")
.Case("spir", "spir") .Case("spir", "spir")
.Case("spir64", "spir64") .Case("spir64", "spir64")
.Default(NULL); .Default(nullptr);
} }
static Triple::ArchType parseArch(StringRef ArchName) { static Triple::ArchType parseArch(StringRef ArchName) {

View File

@ -1876,14 +1876,14 @@ Node *KeyValueNode::getValue() {
void MappingNode::increment() { void MappingNode::increment() {
if (failed()) { if (failed()) {
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
return; return;
} }
if (CurrentEntry) { if (CurrentEntry) {
CurrentEntry->skip(); CurrentEntry->skip();
if (Type == MT_Inline) { if (Type == MT_Inline) {
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
return; return;
} }
} }
@ -1896,13 +1896,13 @@ void MappingNode::increment() {
case Token::TK_BlockEnd: case Token::TK_BlockEnd:
getNext(); getNext();
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
break; break;
default: default:
setError("Unexpected token. Expected Key or Block End", T); setError("Unexpected token. Expected Key or Block End", T);
case Token::TK_Error: case Token::TK_Error:
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
} }
} else { } else {
switch (T.Kind) { switch (T.Kind) {
@ -1915,14 +1915,14 @@ void MappingNode::increment() {
case Token::TK_Error: case Token::TK_Error:
// Set this to end iterator. // Set this to end iterator.
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
break; break;
default: default:
setError( "Unexpected token. Expected Key, Flow Entry, or Flow " setError( "Unexpected token. Expected Key, Flow Entry, or Flow "
"Mapping End." "Mapping End."
, T); , T);
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
} }
} }
} }
@ -1930,7 +1930,7 @@ void MappingNode::increment() {
void SequenceNode::increment() { void SequenceNode::increment() {
if (failed()) { if (failed()) {
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
return; return;
} }
if (CurrentEntry) if (CurrentEntry)
@ -1941,37 +1941,37 @@ void SequenceNode::increment() {
case Token::TK_BlockEntry: case Token::TK_BlockEntry:
getNext(); getNext();
CurrentEntry = parseBlockNode(); CurrentEntry = parseBlockNode();
if (CurrentEntry == 0) { // An error occurred. if (CurrentEntry == nullptr) { // An error occurred.
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
} }
break; break;
case Token::TK_BlockEnd: case Token::TK_BlockEnd:
getNext(); getNext();
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
break; break;
default: default:
setError( "Unexpected token. Expected Block Entry or Block End." setError( "Unexpected token. Expected Block Entry or Block End."
, T); , T);
case Token::TK_Error: case Token::TK_Error:
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
} }
} else if (SeqType == ST_Indentless) { } else if (SeqType == ST_Indentless) {
switch (T.Kind) { switch (T.Kind) {
case Token::TK_BlockEntry: case Token::TK_BlockEntry:
getNext(); getNext();
CurrentEntry = parseBlockNode(); CurrentEntry = parseBlockNode();
if (CurrentEntry == 0) { // An error occurred. if (CurrentEntry == nullptr) { // An error occurred.
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
} }
break; break;
default: default:
case Token::TK_Error: case Token::TK_Error:
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
} }
} else if (SeqType == ST_Flow) { } else if (SeqType == ST_Flow) {
switch (T.Kind) { switch (T.Kind) {
@ -1985,7 +1985,7 @@ void SequenceNode::increment() {
case Token::TK_Error: case Token::TK_Error:
// Set this to end iterator. // Set this to end iterator.
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
break; break;
case Token::TK_StreamEnd: case Token::TK_StreamEnd:
case Token::TK_DocumentEnd: case Token::TK_DocumentEnd:
@ -1993,13 +1993,13 @@ void SequenceNode::increment() {
setError("Could not find closing ]!", T); setError("Could not find closing ]!", T);
// Set this to end iterator. // Set this to end iterator.
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
break; break;
default: default:
if (!WasPreviousTokenFlowEntry) { if (!WasPreviousTokenFlowEntry) {
setError("Expected , between entries!", T); setError("Expected , between entries!", T);
IsAtEnd = true; IsAtEnd = true;
CurrentEntry = 0; CurrentEntry = nullptr;
break; break;
} }
// Otherwise it must be a flow entry. // Otherwise it must be a flow entry.
@ -2013,7 +2013,7 @@ void SequenceNode::increment() {
} }
} }
Document::Document(Stream &S) : stream(S), Root(0) { Document::Document(Stream &S) : stream(S), Root(nullptr) {
// Tag maps starts with two default mappings. // Tag maps starts with two default mappings.
TagMap["!"] = "!"; TagMap["!"] = "!";
TagMap["!!"] = "tag:yaml.org,2002:"; TagMap["!!"] = "tag:yaml.org,2002:";
@ -2070,7 +2070,7 @@ parse_property:
case Token::TK_Anchor: case Token::TK_Anchor:
if (AnchorInfo.Kind == Token::TK_Anchor) { if (AnchorInfo.Kind == Token::TK_Anchor) {
setError("Already encountered an anchor for this node!", T); setError("Already encountered an anchor for this node!", T);
return 0; return nullptr;
} }
AnchorInfo = getNext(); // Consume TK_Anchor. AnchorInfo = getNext(); // Consume TK_Anchor.
T = peekNext(); T = peekNext();
@ -2078,7 +2078,7 @@ parse_property:
case Token::TK_Tag: case Token::TK_Tag:
if (TagInfo.Kind == Token::TK_Tag) { if (TagInfo.Kind == Token::TK_Tag) {
setError("Already encountered a tag for this node!", T); setError("Already encountered a tag for this node!", T);
return 0; return nullptr;
} }
TagInfo = getNext(); // Consume TK_Tag. TagInfo = getNext(); // Consume TK_Tag.
T = peekNext(); T = peekNext();
@ -2146,10 +2146,10 @@ parse_property:
// !!null null. // !!null null.
return new (NodeAllocator) NullNode(stream.CurrentDoc); return new (NodeAllocator) NullNode(stream.CurrentDoc);
case Token::TK_Error: case Token::TK_Error:
return 0; return nullptr;
} }
llvm_unreachable("Control flow shouldn't reach here."); llvm_unreachable("Control flow shouldn't reach here.");
return 0; return nullptr;
} }
bool Document::parseDirectives() { bool Document::parseDirectives() {

View File

@ -47,7 +47,7 @@ Input::Input(StringRef InputContent,
void *DiagHandlerCtxt) void *DiagHandlerCtxt)
: IO(Ctxt), : IO(Ctxt),
Strm(new Stream(InputContent, SrcMgr)), Strm(new Stream(InputContent, SrcMgr)),
CurrentNode(NULL) { CurrentNode(nullptr) {
if (DiagHandler) if (DiagHandler)
SrcMgr.setDiagHandler(DiagHandler, DiagHandlerCtxt); SrcMgr.setDiagHandler(DiagHandler, DiagHandlerCtxt);
DocIterator = Strm->begin(); DocIterator = Strm->begin();
@ -351,7 +351,7 @@ Input::HNode *Input::createHNodes(Node *N) {
return new EmptyHNode(N); return new EmptyHNode(N);
} else { } else {
setError(N, "unknown node kind"); setError(N, "unknown node kind");
return NULL; return nullptr;
} }
} }