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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205831 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2014-04-09 06:08:46 +00:00
parent 8a0d1c8f06
commit ec0f0bc6af
80 changed files with 763 additions and 735 deletions

View File

@ -49,7 +49,7 @@ namespace llvm {
/// @{
/// Construct an empty ArrayRef.
/*implicit*/ ArrayRef() : Data(0), Length(0) {}
/*implicit*/ ArrayRef() : Data(nullptr), Length(0) {}
/// Construct an empty ArrayRef from None.
/*implicit*/ ArrayRef(NoneType) : Data(nullptr), Length(0) {}

View File

@ -985,7 +985,7 @@ public:
private:
pointer Ptr, End;
public:
DenseMapIterator() : Ptr(0), End(0) {}
DenseMapIterator() : Ptr(nullptr), End(nullptr) {}
DenseMapIterator(pointer Pos, pointer E, bool NoAdvance = false)
: Ptr(Pos), End(E) {

View File

@ -494,9 +494,9 @@ private:
// Note: we have to be careful about the case when we move the first node
// in the list. This node is the list sentinel node and we can't move it.
NodeTy *ThisSentinel = getTail();
setTail(0);
setTail(nullptr);
NodeTy *L2Sentinel = L2.getTail();
L2.setTail(0);
L2.setTail(nullptr);
// Remove [first, last) from its old position.
NodeTy *First = &*first, *Prev = this->getPrev(First);
@ -537,7 +537,7 @@ public:
//
size_type LLVM_ATTRIBUTE_UNUSED_RESULT size() const {
if (Head == 0) return 0; // Don't require construction of sentinel if empty.
if (!Head) return 0; // Don't require construction of sentinel if empty.
return std::distance(begin(), end());
}

View File

@ -38,13 +38,13 @@ namespace llvm {
/// same width as the vector element, and the bit is set only if it is true
/// for all of the elements in the vector.
void ComputeMaskedBits(Value *V, APInt &KnownZero, APInt &KnownOne,
const DataLayout *TD = 0, unsigned Depth = 0);
const DataLayout *TD = nullptr, unsigned Depth = 0);
void computeMaskedBitsLoad(const MDNode &Ranges, APInt &KnownZero);
/// ComputeSignBit - Determine whether the sign bit is known to be zero or
/// one. Convenience wrapper around ComputeMaskedBits.
void ComputeSignBit(Value *V, bool &KnownZero, bool &KnownOne,
const DataLayout *TD = 0, unsigned Depth = 0);
const DataLayout *TD = nullptr, unsigned Depth = 0);
/// isKnownToBeAPowerOfTwo - Return true if the given value is known to have
/// exactly one bit set when defined. For vectors return true if every
@ -57,7 +57,8 @@ namespace llvm {
/// when defined. For vectors return true if every element is known to be
/// non-zero when defined. Supports values with integer or pointer type and
/// vectors of integers.
bool isKnownNonZero(Value *V, const DataLayout *TD = 0, unsigned Depth = 0);
bool isKnownNonZero(Value *V, const DataLayout *TD = nullptr,
unsigned Depth = 0);
/// MaskedValueIsZero - Return true if 'V & Mask' is known to be zero. We use
/// this predicate to simplify operations downstream. Mask is known to be
@ -69,7 +70,7 @@ namespace llvm {
/// same width as the vector element, and the bit is set only if it is true
/// for all of the elements in the vector.
bool MaskedValueIsZero(Value *V, const APInt &Mask,
const DataLayout *TD = 0, unsigned Depth = 0);
const DataLayout *TD = nullptr, unsigned Depth = 0);
/// ComputeNumSignBits - Return the number of times the sign bit of the
@ -80,7 +81,7 @@ namespace llvm {
///
/// 'Op' must have a scalar integer type.
///
unsigned ComputeNumSignBits(Value *Op, const DataLayout *TD = 0,
unsigned ComputeNumSignBits(Value *Op, const DataLayout *TD = nullptr,
unsigned Depth = 0);
/// ComputeMultiple - This function computes the integer multiple of Base that
@ -112,7 +113,7 @@ namespace llvm {
/// insertvalues when a part of a nested struct is extracted.
Value *FindInsertedValue(Value *V,
ArrayRef<unsigned> idx_range,
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
/// GetPointerBaseWithConstantOffset - Analyze the specified pointer to see if
/// it can be expressed as a base pointer plus a constant offset. Return the
@ -143,10 +144,10 @@ namespace llvm {
/// being addressed. Note that the returned value has pointer type if the
/// specified value does. If the MaxLookup value is non-zero, it limits the
/// number of instructions to be stripped off.
Value *GetUnderlyingObject(Value *V, const DataLayout *TD = 0,
Value *GetUnderlyingObject(Value *V, const DataLayout *TD = nullptr,
unsigned MaxLookup = 6);
static inline const Value *
GetUnderlyingObject(const Value *V, const DataLayout *TD = 0,
GetUnderlyingObject(const Value *V, const DataLayout *TD = nullptr,
unsigned MaxLookup = 6) {
return GetUnderlyingObject(const_cast<Value *>(V), TD, MaxLookup);
}
@ -156,7 +157,7 @@ namespace llvm {
/// multiple objects.
void GetUnderlyingObjects(Value *V,
SmallVectorImpl<Value *> &Objects,
const DataLayout *TD = 0,
const DataLayout *TD = nullptr,
unsigned MaxLookup = 6);
/// onlyUsedByLifetimeMarkers - Return true if the only users of this pointer
@ -182,12 +183,12 @@ namespace llvm {
/// However, this method can return true for instructions that read memory;
/// for such instructions, moving them may change the resulting value.
bool isSafeToSpeculativelyExecute(const Value *V,
const DataLayout *TD = 0);
const DataLayout *TD = nullptr);
/// isKnownNonNull - Return true if this pointer couldn't possibly be null by
/// its definition. This returns true for allocas, non-extern-weak globals
/// and byval arguments.
bool isKnownNonNull(const Value *V, const TargetLibraryInfo *TLI = 0);
bool isKnownNonNull(const Value *V, const TargetLibraryInfo *TLI = nullptr);
} // end namespace llvm

View File

@ -39,7 +39,7 @@ namespace llvm {
Module *getStreamedBitcodeModule(const std::string &name,
DataStreamer *streamer,
LLVMContext &Context,
std::string *ErrMsg = 0);
std::string *ErrMsg = nullptr);
/// getBitcodeTargetTriple - Read the header of the specified bitcode
/// buffer and extract just the triple information. If successful,
@ -48,7 +48,7 @@ namespace llvm {
/// if ErrMsg is non-null.
std::string getBitcodeTargetTriple(MemoryBuffer *Buffer,
LLVMContext &Context,
std::string *ErrMsg = 0);
std::string *ErrMsg = nullptr);
/// Read the specified bitcode file, returning the module.
/// This method *never* takes ownership of Buffer.

View File

@ -35,9 +35,9 @@ namespace llvm {
public:
EVT() : V((MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE)),
LLVMTy(0) {}
EVT(MVT::SimpleValueType SVT) : V(SVT), LLVMTy(0) { }
EVT(MVT S) : V(S), LLVMTy(0) {}
LLVMTy(nullptr) {}
EVT(MVT::SimpleValueType SVT) : V(SVT), LLVMTy(nullptr) { }
EVT(MVT S) : V(S), LLVMTy(nullptr) {}
bool operator==(EVT VT) const {
return !(*this != VT);

View File

@ -44,7 +44,7 @@ public:
///
/// If \p F is specified, the argument is inserted at the end of the argument
/// list for \p F.
explicit Argument(Type *Ty, const Twine &Name = "", Function *F = 0);
explicit Argument(Type *Ty, const Twine &Name = "", Function *F = nullptr);
inline const Function *getParent() const { return Parent; }
inline Function *getParent() { return Parent; }

View File

@ -116,7 +116,7 @@ private:
AttributeImpl *pImpl;
Attribute(AttributeImpl *A) : pImpl(A) {}
public:
Attribute() : pImpl(0) {}
Attribute() : pImpl(nullptr) {}
//===--------------------------------------------------------------------===//
// Attribute Construction
@ -232,7 +232,7 @@ private:
explicit AttributeSet(AttributeSetImpl *LI) : pImpl(LI) {}
public:
AttributeSet() : pImpl(0) {}
AttributeSet() : pImpl(nullptr) {}
//===--------------------------------------------------------------------===//
// AttributeSet Construction and Mutation

View File

@ -90,7 +90,8 @@ private:
/// inserted at either the end of the function (if InsertBefore is null), or
/// before the specified basic block.
explicit BasicBlock(LLVMContext &C, const Twine &Name = "",
Function *Parent = 0, BasicBlock *InsertBefore = 0);
Function *Parent = nullptr,
BasicBlock *InsertBefore = nullptr);
public:
/// \brief Get the context in which this basic block lives.
LLVMContext &getContext() const;
@ -107,7 +108,8 @@ public:
/// inserted at either the end of the function (if InsertBefore is 0), or
/// before the specified basic block.
static BasicBlock *Create(LLVMContext &Context, const Twine &Name = "",
Function *Parent = 0,BasicBlock *InsertBefore = 0) {
Function *Parent = nullptr,
BasicBlock *InsertBefore = nullptr) {
return new BasicBlock(Context, Name, Parent, InsertBefore);
}
~BasicBlock();

View File

@ -47,7 +47,7 @@ class CallSiteBase {
protected:
PointerIntPair<InstrTy*, 1, bool> I;
public:
CallSiteBase() : I(0, false) {}
CallSiteBase() : I(nullptr, false) {}
CallSiteBase(CallTy *CI) : I(CI, true) { assert(CI); }
CallSiteBase(InvokeTy *II) : I(II, false) { assert(II); }
CallSiteBase(ValTy *II) { *this = get(II); }

View File

@ -114,12 +114,12 @@ public:
const APInt *getSingleElement() const {
if (Upper == Lower + 1)
return &Lower;
return 0;
return nullptr;
}
/// isSingleElement - Return true if this set contains exactly one member.
///
bool isSingleElement() const { return getSingleElement() != 0; }
bool isSingleElement() const { return getSingleElement() != nullptr; }
/// getSetSize - Return the number of elements in this set.
///

View File

@ -299,7 +299,7 @@ class ConstantAggregateZero : public Constant {
ConstantAggregateZero(const ConstantAggregateZero &) LLVM_DELETED_FUNCTION;
protected:
explicit ConstantAggregateZero(Type *ty)
: Constant(ty, ConstantAggregateZeroVal, 0, 0) {}
: Constant(ty, ConstantAggregateZeroVal, nullptr, 0) {}
protected:
// allocate space for exactly zero operands
void *operator new(size_t s) {
@ -486,7 +486,7 @@ class ConstantPointerNull : public Constant {
protected:
explicit ConstantPointerNull(PointerType *T)
: Constant(T,
Value::ConstantPointerNullVal, 0, 0) {}
Value::ConstantPointerNullVal, nullptr, 0) {}
protected:
// allocate space for exactly zero operands
@ -536,7 +536,7 @@ class ConstantDataSequential : public Constant {
ConstantDataSequential(const ConstantDataSequential &) LLVM_DELETED_FUNCTION;
protected:
explicit ConstantDataSequential(Type *ty, ValueTy VT, const char *Data)
: Constant(ty, VT, 0, 0), DataElements(Data), Next(0) {}
: Constant(ty, VT, nullptr, 0), DataElements(Data), Next(nullptr) {}
~ConstantDataSequential() { delete Next; }
static Constant *getImpl(StringRef Bytes, Type *Ty);
@ -1136,7 +1136,7 @@ class UndefValue : public Constant {
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
UndefValue(const UndefValue &) LLVM_DELETED_FUNCTION;
protected:
explicit UndefValue(Type *T) : Constant(T, UndefValueVal, 0, 0) {}
explicit UndefValue(Type *T) : Constant(T, UndefValueVal, nullptr, 0) {}
protected:
// allocate space for exactly zero operands
void *operator new(size_t s) {

View File

@ -78,7 +78,7 @@ namespace llvm {
DITemplateValueParameter
createTemplateValueParameter(unsigned Tag, DIDescriptor Scope,
StringRef Name, DIType Ty, Value *Val,
MDNode *File = 0, unsigned LineNo = 0,
MDNode *File = nullptr, unsigned LineNo = 0,
unsigned ColumnNo = 0);
DIBuilder(const DIBuilder &) LLVM_DELETED_FUNCTION;
@ -293,7 +293,7 @@ namespace llvm {
uint64_t OffsetInBits, unsigned Flags,
DIType DerivedFrom, DIArray Elements,
DIType VTableHolder = DIType(),
MDNode *TemplateParms = 0,
MDNode *TemplateParms = nullptr,
StringRef UniqueIdentifier = StringRef());
/// createStructType - Create debugging information entry for a struct.
@ -342,7 +342,7 @@ namespace llvm {
/// @param ColumnNo Column Number.
DITemplateTypeParameter
createTemplateTypeParameter(DIDescriptor Scope, StringRef Name, DIType Ty,
MDNode *File = 0, unsigned LineNo = 0,
MDNode *File = nullptr, unsigned LineNo = 0,
unsigned ColumnNo = 0);
/// createTemplateValueParameter - Create debugging information for template
@ -356,7 +356,7 @@ namespace llvm {
/// @param ColumnNo Column Number.
DITemplateValueParameter
createTemplateValueParameter(DIDescriptor Scope, StringRef Name,
DIType Ty, Value *Val, MDNode *File = 0,
DIType Ty, Value *Val, MDNode *File = nullptr,
unsigned LineNo = 0, unsigned ColumnNo = 0);
/// \brief Create debugging information for a template template parameter.
@ -369,8 +369,9 @@ namespace llvm {
/// @param ColumnNo Column Number.
DITemplateValueParameter
createTemplateTemplateParameter(DIDescriptor Scope, StringRef Name,
DIType Ty, StringRef Val, MDNode *File = 0,
unsigned LineNo = 0, unsigned ColumnNo = 0);
DIType Ty, StringRef Val,
MDNode *File = nullptr, unsigned LineNo = 0,
unsigned ColumnNo = 0);
/// \brief Create debugging information for a template parameter pack.
/// @param Scope Scope in which this type is defined.
@ -382,7 +383,7 @@ namespace llvm {
/// @param ColumnNo Column Number.
DITemplateValueParameter
createTemplateParameterPack(DIDescriptor Scope, StringRef Name,
DIType Ty, DIArray Val, MDNode *File = 0,
DIType Ty, DIArray Val, MDNode *File = nullptr,
unsigned LineNo = 0, unsigned ColumnNo = 0);
/// createArrayType - Create debugging information entry for an array.
@ -498,7 +499,7 @@ namespace llvm {
createStaticVariable(DIDescriptor Context, StringRef Name,
StringRef LinkageName, DIFile File, unsigned LineNo,
DITypeRef Ty, bool isLocalToUnit, llvm::Value *Val,
MDNode *Decl = NULL);
MDNode *Decl = nullptr);
/// createLocalVariable - Create a new descriptor for the specified
@ -564,9 +565,9 @@ namespace llvm {
unsigned ScopeLine,
unsigned Flags = 0,
bool isOptimized = false,
Function *Fn = 0,
MDNode *TParam = 0,
MDNode *Decl = 0);
Function *Fn = nullptr,
MDNode *TParam = nullptr,
MDNode *Decl = nullptr);
/// FIXME: this is added for dragonegg. Once we update dragonegg
/// to call resolve function, this will be removed.
@ -578,9 +579,9 @@ namespace llvm {
unsigned ScopeLine,
unsigned Flags = 0,
bool isOptimized = false,
Function *Fn = 0,
MDNode *TParam = 0,
MDNode *Decl = 0);
Function *Fn = nullptr,
MDNode *TParam = nullptr,
MDNode *Decl = nullptr);
/// createMethod - Create a new descriptor for the specified C++ method.
/// See comments in DISubprogram for descriptions of these fields.
@ -610,8 +611,8 @@ namespace llvm {
DIType VTableHolder = DIType(),
unsigned Flags = 0,
bool isOptimized = false,
Function *Fn = 0,
MDNode *TParam = 0);
Function *Fn = nullptr,
MDNode *TParam = nullptr);
/// createNameSpace - This creates new descriptor for a namespace
/// with the specified parent scope.

View File

@ -174,14 +174,14 @@ private:
public:
/// Constructs a DataLayout from a specification string. See reset().
explicit DataLayout(StringRef LayoutDescription) : LayoutMap(0) {
explicit DataLayout(StringRef LayoutDescription) : LayoutMap(nullptr) {
reset(LayoutDescription);
}
/// Initialize target data from properties stored in the module.
explicit DataLayout(const Module *M);
DataLayout(const DataLayout &DL) : LayoutMap(0) { *this = DL; }
DataLayout(const DataLayout &DL) : LayoutMap(nullptr) { *this = DL; }
DataLayout &operator=(const DataLayout &DL) {
clear();
@ -408,7 +408,7 @@ public:
/// none are set.
Type *getLargestLegalIntType(LLVMContext &C) const {
unsigned LargestSize = getLargestLegalIntTypeSize();
return (LargestSize == 0) ? 0 : Type::getIntNTy(C, LargestSize);
return (LargestSize == 0) ? nullptr : Type::getIntNTy(C, LargestSize);
}
/// getLargestLegalIntType - Return the size of largest legal integer type

View File

@ -104,7 +104,7 @@ protected:
void replaceFunctionField(unsigned Elt, Function *F);
public:
explicit DIDescriptor(const MDNode *N = 0) : DbgNode(N) {}
explicit DIDescriptor(const MDNode *N = nullptr) : DbgNode(N) {}
bool Verify() const;
@ -116,7 +116,7 @@ public:
// FIXME: This operator bool isn't actually protecting anything at the
// moment due to the conversion operator above making DIDescriptor nodes
// implicitly convertable to bool.
LLVM_EXPLICIT operator bool() const { return DbgNode != 0; }
LLVM_EXPLICIT operator bool() const { return DbgNode != nullptr; }
bool operator==(DIDescriptor Other) const { return DbgNode == Other.DbgNode; }
bool operator!=(DIDescriptor Other) const { return !operator==(Other); }
@ -159,7 +159,7 @@ class DISubrange : public DIDescriptor {
void printInternal(raw_ostream &OS) const;
public:
explicit DISubrange(const MDNode *N = 0) : DIDescriptor(N) {}
explicit DISubrange(const MDNode *N = nullptr) : DIDescriptor(N) {}
int64_t getLo() const { return getInt64Field(1); }
int64_t getCount() const { return getInt64Field(2); }
@ -169,7 +169,7 @@ public:
/// DIArray - This descriptor holds an array of descriptors.
class DIArray : public DIDescriptor {
public:
explicit DIArray(const MDNode *N = 0) : DIDescriptor(N) {}
explicit DIArray(const MDNode *N = nullptr) : DIDescriptor(N) {}
unsigned getNumElements() const;
DIDescriptor getElement(unsigned Idx) const {
@ -185,7 +185,7 @@ class DIEnumerator : public DIDescriptor {
void printInternal(raw_ostream &OS) const;
public:
explicit DIEnumerator(const MDNode *N = 0) : DIDescriptor(N) {}
explicit DIEnumerator(const MDNode *N = nullptr) : DIDescriptor(N) {}
StringRef getName() const { return getStringField(1); }
int64_t getEnumValue() const { return getInt64Field(2); }
@ -210,7 +210,7 @@ protected:
void printInternal(raw_ostream &OS) const;
public:
explicit DIScope(const MDNode *N = 0) : DIDescriptor(N) {}
explicit DIScope(const MDNode *N = nullptr) : DIDescriptor(N) {}
/// Gets the parent scope for this scope node or returns a
/// default constructed scope.
@ -292,7 +292,7 @@ protected:
void printInternal(raw_ostream &OS) const;
public:
explicit DIType(const MDNode *N = 0) : DIScope(N) {}
explicit DIType(const MDNode *N = nullptr) : DIScope(N) {}
operator DITypeRef () const {
assert(isType() &&
"constructing DITypeRef from an MDNode that is not a type");
@ -346,7 +346,7 @@ public:
/// DIBasicType - A basic type, like 'int' or 'float'.
class DIBasicType : public DIType {
public:
explicit DIBasicType(const MDNode *N = 0) : DIType(N) {}
explicit DIBasicType(const MDNode *N = nullptr) : DIType(N) {}
unsigned getEncoding() const { return getUnsignedField(9); }
@ -362,7 +362,7 @@ class DIDerivedType : public DIType {
void printInternal(raw_ostream &OS) const;
public:
explicit DIDerivedType(const MDNode *N = 0) : DIType(N) {}
explicit DIDerivedType(const MDNode *N = nullptr) : DIType(N) {}
DITypeRef getTypeDerivedFrom() const { return getFieldAs<DITypeRef>(9); }
@ -395,7 +395,7 @@ class DICompositeType : public DIDerivedType {
void printInternal(raw_ostream &OS) const;
public:
explicit DICompositeType(const MDNode *N = 0) : DIDerivedType(N) {}
explicit DICompositeType(const MDNode *N = nullptr) : DIDerivedType(N) {}
DIArray getTypeArray() const { return getFieldAs<DIArray>(10); }
void setTypeArray(DIArray Elements, DIArray TParams = DIArray());
@ -414,7 +414,7 @@ class DIFile : public DIScope {
friend class DIDescriptor;
public:
explicit DIFile(const MDNode *N = 0) : DIScope(N) {}
explicit DIFile(const MDNode *N = nullptr) : DIScope(N) {}
MDNode *getFileNode() const;
bool Verify() const;
};
@ -425,7 +425,7 @@ class DICompileUnit : public DIScope {
void printInternal(raw_ostream &OS) const;
public:
explicit DICompileUnit(const MDNode *N = 0) : DIScope(N) {}
explicit DICompileUnit(const MDNode *N = nullptr) : DIScope(N) {}
unsigned getLanguage() const { return getUnsignedField(2); }
StringRef getProducer() const { return getStringField(3); }
@ -453,7 +453,7 @@ class DISubprogram : public DIScope {
void printInternal(raw_ostream &OS) const;
public:
explicit DISubprogram(const MDNode *N = 0) : DIScope(N) {}
explicit DISubprogram(const MDNode *N = nullptr) : DIScope(N) {}
DIScopeRef getContext() const { return getFieldAs<DIScopeRef>(2); }
StringRef getName() const { return getStringField(3); }
@ -532,7 +532,7 @@ public:
/// DILexicalBlock - This is a wrapper for a lexical block.
class DILexicalBlock : public DIScope {
public:
explicit DILexicalBlock(const MDNode *N = 0) : DIScope(N) {}
explicit DILexicalBlock(const MDNode *N = nullptr) : DIScope(N) {}
DIScope getContext() const { return getFieldAs<DIScope>(2); }
unsigned getLineNumber() const { return getUnsignedField(3); }
unsigned getColumnNumber() const { return getUnsignedField(4); }
@ -544,7 +544,7 @@ public:
/// a filename change.
class DILexicalBlockFile : public DIScope {
public:
explicit DILexicalBlockFile(const MDNode *N = 0) : DIScope(N) {}
explicit DILexicalBlockFile(const MDNode *N = nullptr) : DIScope(N) {}
DIScope getContext() const {
if (getScope().isSubprogram())
return getScope();
@ -562,7 +562,7 @@ class DINameSpace : public DIScope {
void printInternal(raw_ostream &OS) const;
public:
explicit DINameSpace(const MDNode *N = 0) : DIScope(N) {}
explicit DINameSpace(const MDNode *N = nullptr) : DIScope(N) {}
DIScope getContext() const { return getFieldAs<DIScope>(2); }
StringRef getName() const { return getStringField(3); }
unsigned getLineNumber() const { return getUnsignedField(4); }
@ -572,14 +572,16 @@ public:
/// DIUnspecifiedParameter - This is a wrapper for unspecified parameters.
class DIUnspecifiedParameter : public DIDescriptor {
public:
explicit DIUnspecifiedParameter(const MDNode *N = 0) : DIDescriptor(N) {}
explicit DIUnspecifiedParameter(const MDNode *N = nullptr)
: DIDescriptor(N) {}
bool Verify() const;
};
/// DITemplateTypeParameter - This is a wrapper for template type parameter.
class DITemplateTypeParameter : public DIDescriptor {
public:
explicit DITemplateTypeParameter(const MDNode *N = 0) : DIDescriptor(N) {}
explicit DITemplateTypeParameter(const MDNode *N = nullptr)
: DIDescriptor(N) {}
DIScopeRef getContext() const { return getFieldAs<DIScopeRef>(1); }
StringRef getName() const { return getStringField(2); }
@ -596,7 +598,8 @@ public:
/// DITemplateValueParameter - This is a wrapper for template value parameter.
class DITemplateValueParameter : public DIDescriptor {
public:
explicit DITemplateValueParameter(const MDNode *N = 0) : DIDescriptor(N) {}
explicit DITemplateValueParameter(const MDNode *N = nullptr)
: DIDescriptor(N) {}
DIScopeRef getContext() const { return getFieldAs<DIScopeRef>(1); }
StringRef getName() const { return getStringField(2); }
@ -617,7 +620,7 @@ class DIGlobalVariable : public DIDescriptor {
void printInternal(raw_ostream &OS) const;
public:
explicit DIGlobalVariable(const MDNode *N = 0) : DIDescriptor(N) {}
explicit DIGlobalVariable(const MDNode *N = nullptr) : DIDescriptor(N) {}
DIScope getContext() const { return getFieldAs<DIScope>(2); }
StringRef getName() const { return getStringField(3); }
@ -650,7 +653,7 @@ class DIVariable : public DIDescriptor {
void printInternal(raw_ostream &OS) const;
public:
explicit DIVariable(const MDNode *N = 0) : DIDescriptor(N) {}
explicit DIVariable(const MDNode *N = nullptr) : DIDescriptor(N) {}
DIScope getContext() const { return getFieldAs<DIScope>(1); }
StringRef getName() const { return getStringField(2); }

View File

@ -58,7 +58,7 @@ namespace llvm {
/// get - Get a new DebugLoc that corresponds to the specified line/col
/// scope/inline location.
static DebugLoc get(unsigned Line, unsigned Col,
MDNode *Scope, MDNode *InlinedAt = 0);
MDNode *Scope, MDNode *InlinedAt = nullptr);
/// getFromDILocation - Translate the DILocation quad into a DebugLoc.
static DebugLoc getFromDILocation(MDNode *N);

View File

@ -188,7 +188,7 @@ class StructType : public CompositeType {
StructType(const StructType &) LLVM_DELETED_FUNCTION;
const StructType &operator=(const StructType &) LLVM_DELETED_FUNCTION;
StructType(LLVMContext &C)
: CompositeType(C, StructTyID), SymbolTableEntry(0) {}
: CompositeType(C, StructTyID), SymbolTableEntry(nullptr) {}
enum {
/// This is the contents of the SubClassData field.
SCDB_HasBody = 1,
@ -249,10 +249,10 @@ public:
bool isOpaque() const { return (getSubclassData() & SCDB_HasBody) == 0; }
/// isSized - Return true if this is a sized type.
bool isSized(SmallPtrSet<const Type*, 4> *Visited = 0) const;
bool isSized(SmallPtrSet<const Type*, 4> *Visited = nullptr) const;
/// hasName - Return true if this is a named struct that has a non-empty name.
bool hasName() const { return SymbolTableEntry != 0; }
bool hasName() const { return SymbolTableEntry != nullptr; }
/// getName - Return the name for this struct type if it has an identity.
/// This may return an empty string for an unnamed struct type. Do not call

View File

@ -107,7 +107,7 @@ public:
DiagnosticInfoInlineAsm(const Twine &MsgStr,
DiagnosticSeverity Severity = DS_Error)
: DiagnosticInfo(DK_InlineAsm, Severity), LocCookie(0), MsgStr(MsgStr),
Instr(NULL) {}
Instr(nullptr) {}
/// \p LocCookie if non-zero gives the line number for this report.
/// \p MsgStr gives the message.
@ -116,7 +116,7 @@ public:
DiagnosticInfoInlineAsm(unsigned LocCookie, const Twine &MsgStr,
DiagnosticSeverity Severity = DS_Error)
: DiagnosticInfo(DK_InlineAsm, Severity), LocCookie(LocCookie),
MsgStr(MsgStr), Instr(NULL) {}
MsgStr(MsgStr), Instr(nullptr) {}
/// \p Instr gives the original instruction that triggered the diagnostic.
/// \p MsgStr gives the message.
@ -210,7 +210,7 @@ public:
LineNum(0), Msg(Msg) {}
DiagnosticInfoSampleProfile(const Twine &Msg,
DiagnosticSeverity Severity = DS_Error)
: DiagnosticInfo(DK_SampleProfile, Severity), FileName(NULL),
: DiagnosticInfo(DK_SampleProfile, Severity), FileName(nullptr),
LineNum(0), Msg(Msg) {}
/// \see DiagnosticInfo::print.

View File

@ -182,7 +182,7 @@ public:
void releaseMemory() override { DT.releaseMemory(); }
void print(raw_ostream &OS, const Module *M = 0) const override;
void print(raw_ostream &OS, const Module *M = nullptr) const override;
};
} // End llvm namespace

View File

@ -123,11 +123,11 @@ private:
/// the module.
///
Function(FunctionType *Ty, LinkageTypes Linkage,
const Twine &N = "", Module *M = 0);
const Twine &N = "", Module *M = nullptr);
public:
static Function *Create(FunctionType *Ty, LinkageTypes Linkage,
const Twine &N = "", Module *M = 0) {
const Twine &N = "", Module *M = nullptr) {
return new(0) Function(Ty, Linkage, N, M);
}
@ -483,7 +483,7 @@ public:
/// other than direct calls or invokes to it, or blockaddress expressions.
/// Optionally passes back an offending user for diagnostic purposes.
///
bool hasAddressTaken(const User** = 0) const;
bool hasAddressTaken(const User** = nullptr) const;
/// isDefTriviallyDead - Return true if it is trivially safe to remove
/// this function definition from the module (because it isn't externally
@ -505,12 +505,12 @@ private:
inline ValueSymbolTable *
ilist_traits<BasicBlock>::getSymTab(Function *F) {
return F ? &F->getValueSymbolTable() : 0;
return F ? &F->getValueSymbolTable() : nullptr;
}
inline ValueSymbolTable *
ilist_traits<Argument>::getSymTab(Function *F) {
return F ? &F->getValueSymbolTable() : 0;
return F ? &F->getValueSymbolTable() : nullptr;
}
} // End llvm namespace

View File

@ -38,7 +38,7 @@ namespace llvm {
}
static generic_gep_type_iterator end(ItTy It) {
generic_gep_type_iterator I;
I.CurTy = 0;
I.CurTy = nullptr;
I.OpIt = It;
return I;
}
@ -69,7 +69,7 @@ namespace llvm {
if (CompositeType *CT = dyn_cast<CompositeType>(CurTy)) {
CurTy = CT->getTypeAtIndex(getOperand());
} else {
CurTy = 0;
CurTy = nullptr;
}
++OpIt;
return *this;

View File

@ -41,7 +41,7 @@ public:
/// GlobalAlias ctor - If a parent module is specified, the alias is
/// automatically inserted into the end of the specified module's alias list.
GlobalAlias(Type *Ty, LinkageTypes Linkage, const Twine &Name = "",
Constant* Aliasee = 0, Module *Parent = 0);
Constant* Aliasee = nullptr, Module *Parent = nullptr);
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);

View File

@ -63,7 +63,7 @@ protected:
LinkageTypes linkage, const Twine &Name)
: Constant(ty, vty, Ops, NumOps), Linkage(linkage),
Visibility(DefaultVisibility), Alignment(0), UnnamedAddr(0),
DllStorageClass(DefaultStorageClass), Parent(0) {
DllStorageClass(DefaultStorageClass), Parent(nullptr) {
setName(Name);
}
@ -251,7 +251,7 @@ public:
/// Materialize - make sure this GlobalValue is fully read. If the module is
/// corrupt, this returns true and fills in the optional string with
/// information about the problem. If successful, this returns false.
bool Materialize(std::string *ErrInfo = 0);
bool Materialize(std::string *ErrInfo = nullptr);
/// Dematerialize - If this GlobalValue is read in, and if the GVMaterializer
/// supports it, release the memory for the function, and set it up to be

View File

@ -66,14 +66,14 @@ public:
/// GlobalVariable ctor - If a parent module is specified, the global is
/// automatically inserted into the end of the specified modules global list.
GlobalVariable(Type *Ty, bool isConstant, LinkageTypes Linkage,
Constant *Initializer = 0, const Twine &Name = "",
Constant *Initializer = nullptr, const Twine &Name = "",
ThreadLocalMode = NotThreadLocal, unsigned AddressSpace = 0,
bool isExternallyInitialized = false);
/// GlobalVariable ctor - This creates a global and inserts it before the
/// specified other global.
GlobalVariable(Module &M, Type *Ty, bool isConstant,
LinkageTypes Linkage, Constant *Initializer,
const Twine &Name = "", GlobalVariable *InsertBefore = 0,
const Twine &Name = "", GlobalVariable *InsertBefore = nullptr,
ThreadLocalMode = NotThreadLocal, unsigned AddressSpace = 0,
bool isExternallyInitialized = false);

View File

@ -58,7 +58,7 @@ protected:
FastMathFlags FMF;
public:
IRBuilderBase(LLVMContext &context, MDNode *FPMathTag = 0)
IRBuilderBase(LLVMContext &context, MDNode *FPMathTag = nullptr)
: Context(context), DefaultFPMathTag(FPMathTag), FMF() {
ClearInsertionPoint();
}
@ -70,8 +70,8 @@ public:
/// \brief Clear the insertion point: created instructions will not be
/// inserted into a block.
void ClearInsertionPoint() {
BB = 0;
InsertPt = 0;
BB = nullptr;
InsertPt = nullptr;
}
BasicBlock *GetInsertBlock() const { return BB; }
@ -140,14 +140,14 @@ public:
public:
/// \brief Creates a new insertion point which doesn't point to anything.
InsertPoint() : Block(0) {}
InsertPoint() : Block(nullptr) {}
/// \brief Creates a new insertion point at the given location.
InsertPoint(BasicBlock *InsertBlock, BasicBlock::iterator InsertPoint)
: Block(InsertBlock), Point(InsertPoint) {}
/// \brief Returns true if this insert point is set.
bool isSet() const { return (Block != 0); }
bool isSet() const { return (Block != nullptr); }
llvm::BasicBlock *getBlock() const { return Block; }
llvm::BasicBlock::iterator getPoint() const { return Point; }
@ -362,27 +362,27 @@ public:
/// If the pointer isn't an i8*, it will be converted. If a TBAA tag is
/// specified, it will be added to the instruction.
CallInst *CreateMemSet(Value *Ptr, Value *Val, uint64_t Size, unsigned Align,
bool isVolatile = false, MDNode *TBAATag = 0) {
bool isVolatile = false, MDNode *TBAATag = nullptr) {
return CreateMemSet(Ptr, Val, getInt64(Size), Align, isVolatile, TBAATag);
}
CallInst *CreateMemSet(Value *Ptr, Value *Val, Value *Size, unsigned Align,
bool isVolatile = false, MDNode *TBAATag = 0);
bool isVolatile = false, MDNode *TBAATag = nullptr);
/// \brief Create and insert a memcpy between the specified pointers.
///
/// If the pointers aren't i8*, they will be converted. If a TBAA tag is
/// specified, it will be added to the instruction.
CallInst *CreateMemCpy(Value *Dst, Value *Src, uint64_t Size, unsigned Align,
bool isVolatile = false, MDNode *TBAATag = 0,
MDNode *TBAAStructTag = 0) {
bool isVolatile = false, MDNode *TBAATag = nullptr,
MDNode *TBAAStructTag = nullptr) {
return CreateMemCpy(Dst, Src, getInt64(Size), Align, isVolatile, TBAATag,
TBAAStructTag);
}
CallInst *CreateMemCpy(Value *Dst, Value *Src, Value *Size, unsigned Align,
bool isVolatile = false, MDNode *TBAATag = 0,
MDNode *TBAAStructTag = 0);
bool isVolatile = false, MDNode *TBAATag = nullptr,
MDNode *TBAAStructTag = nullptr);
/// \brief Create and insert a memmove between the specified
/// pointers.
@ -390,22 +390,22 @@ public:
/// If the pointers aren't i8*, they will be converted. If a TBAA tag is
/// specified, it will be added to the instruction.
CallInst *CreateMemMove(Value *Dst, Value *Src, uint64_t Size, unsigned Align,
bool isVolatile = false, MDNode *TBAATag = 0) {
bool isVolatile = false, MDNode *TBAATag = nullptr) {
return CreateMemMove(Dst, Src, getInt64(Size), Align, isVolatile, TBAATag);
}
CallInst *CreateMemMove(Value *Dst, Value *Src, Value *Size, unsigned Align,
bool isVolatile = false, MDNode *TBAATag = 0);
bool isVolatile = false, MDNode *TBAATag = nullptr);
/// \brief Create a lifetime.start intrinsic.
///
/// If the pointer isn't i8* it will be converted.
CallInst *CreateLifetimeStart(Value *Ptr, ConstantInt *Size = 0);
CallInst *CreateLifetimeStart(Value *Ptr, ConstantInt *Size = nullptr);
/// \brief Create a lifetime.end intrinsic.
///
/// If the pointer isn't i8* it will be converted.
CallInst *CreateLifetimeEnd(Value *Ptr, ConstantInt *Size = 0);
CallInst *CreateLifetimeEnd(Value *Ptr, ConstantInt *Size = nullptr);
private:
Value *getCastedInt8PtrValue(Value *Ptr);
@ -433,43 +433,44 @@ class IRBuilder : public IRBuilderBase, public Inserter {
T Folder;
public:
IRBuilder(LLVMContext &C, const T &F, const Inserter &I = Inserter(),
MDNode *FPMathTag = 0)
MDNode *FPMathTag = nullptr)
: IRBuilderBase(C, FPMathTag), Inserter(I), Folder(F) {
}
explicit IRBuilder(LLVMContext &C, MDNode *FPMathTag = 0)
explicit IRBuilder(LLVMContext &C, MDNode *FPMathTag = nullptr)
: IRBuilderBase(C, FPMathTag), Folder() {
}
explicit IRBuilder(BasicBlock *TheBB, const T &F, MDNode *FPMathTag = 0)
explicit IRBuilder(BasicBlock *TheBB, const T &F, MDNode *FPMathTag = nullptr)
: IRBuilderBase(TheBB->getContext(), FPMathTag), Folder(F) {
SetInsertPoint(TheBB);
}
explicit IRBuilder(BasicBlock *TheBB, MDNode *FPMathTag = 0)
explicit IRBuilder(BasicBlock *TheBB, MDNode *FPMathTag = nullptr)
: IRBuilderBase(TheBB->getContext(), FPMathTag), Folder() {
SetInsertPoint(TheBB);
}
explicit IRBuilder(Instruction *IP, MDNode *FPMathTag = 0)
explicit IRBuilder(Instruction *IP, MDNode *FPMathTag = nullptr)
: IRBuilderBase(IP->getContext(), FPMathTag), Folder() {
SetInsertPoint(IP);
SetCurrentDebugLocation(IP->getDebugLoc());
}
explicit IRBuilder(Use &U, MDNode *FPMathTag = 0)
explicit IRBuilder(Use &U, MDNode *FPMathTag = nullptr)
: IRBuilderBase(U->getContext(), FPMathTag), Folder() {
SetInsertPoint(U);
SetCurrentDebugLocation(cast<Instruction>(U.getUser())->getDebugLoc());
}
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, const T& F,
MDNode *FPMathTag = 0)
MDNode *FPMathTag = nullptr)
: IRBuilderBase(TheBB->getContext(), FPMathTag), Folder(F) {
SetInsertPoint(TheBB, IP);
}
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, MDNode *FPMathTag = 0)
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP,
MDNode *FPMathTag = nullptr)
: IRBuilderBase(TheBB->getContext(), FPMathTag), Folder() {
SetInsertPoint(TheBB, IP);
}
@ -541,7 +542,7 @@ public:
/// \brief Create a conditional 'br Cond, TrueDest, FalseDest'
/// instruction.
BranchInst *CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False,
MDNode *BranchWeights = 0) {
MDNode *BranchWeights = nullptr) {
return Insert(addBranchWeights(BranchInst::Create(True, False, Cond),
BranchWeights));
}
@ -550,7 +551,7 @@ public:
/// and with a hint for the number of cases that will be added (for efficient
/// allocation).
SwitchInst *CreateSwitch(Value *V, BasicBlock *Dest, unsigned NumCases = 10,
MDNode *BranchWeights = 0) {
MDNode *BranchWeights = nullptr) {
return Insert(addBranchWeights(SwitchInst::Create(V, Dest, NumCases),
BranchWeights));
}
@ -638,7 +639,7 @@ public:
return CreateAdd(LHS, RHS, Name, true, false);
}
Value *CreateFAdd(Value *LHS, Value *RHS, const Twine &Name = "",
MDNode *FPMathTag = 0) {
MDNode *FPMathTag = nullptr) {
if (Constant *LC = dyn_cast<Constant>(LHS))
if (Constant *RC = dyn_cast<Constant>(RHS))
return Insert(Folder.CreateFAdd(LC, RC), Name);
@ -660,7 +661,7 @@ public:
return CreateSub(LHS, RHS, Name, true, false);
}
Value *CreateFSub(Value *LHS, Value *RHS, const Twine &Name = "",
MDNode *FPMathTag = 0) {
MDNode *FPMathTag = nullptr) {
if (Constant *LC = dyn_cast<Constant>(LHS))
if (Constant *RC = dyn_cast<Constant>(RHS))
return Insert(Folder.CreateFSub(LC, RC), Name);
@ -682,7 +683,7 @@ public:
return CreateMul(LHS, RHS, Name, true, false);
}
Value *CreateFMul(Value *LHS, Value *RHS, const Twine &Name = "",
MDNode *FPMathTag = 0) {
MDNode *FPMathTag = nullptr) {
if (Constant *LC = dyn_cast<Constant>(LHS))
if (Constant *RC = dyn_cast<Constant>(RHS))
return Insert(Folder.CreateFMul(LC, RC), Name);
@ -714,7 +715,7 @@ public:
return CreateSDiv(LHS, RHS, Name, true);
}
Value *CreateFDiv(Value *LHS, Value *RHS, const Twine &Name = "",
MDNode *FPMathTag = 0) {
MDNode *FPMathTag = nullptr) {
if (Constant *LC = dyn_cast<Constant>(LHS))
if (Constant *RC = dyn_cast<Constant>(RHS))
return Insert(Folder.CreateFDiv(LC, RC), Name);
@ -734,7 +735,7 @@ public:
return Insert(BinaryOperator::CreateSRem(LHS, RHS), Name);
}
Value *CreateFRem(Value *LHS, Value *RHS, const Twine &Name = "",
MDNode *FPMathTag = 0) {
MDNode *FPMathTag = nullptr) {
if (Constant *LC = dyn_cast<Constant>(LHS))
if (Constant *RC = dyn_cast<Constant>(RHS))
return Insert(Folder.CreateFRem(LC, RC), Name);
@ -844,7 +845,7 @@ public:
Value *CreateBinOp(Instruction::BinaryOps Opc,
Value *LHS, Value *RHS, const Twine &Name = "",
MDNode *FPMathTag = 0) {
MDNode *FPMathTag = nullptr) {
if (Constant *LC = dyn_cast<Constant>(LHS))
if (Constant *RC = dyn_cast<Constant>(RHS))
return Insert(Folder.CreateBinOp(Opc, LC, RC), Name);
@ -869,7 +870,8 @@ public:
Value *CreateNUWNeg(Value *V, const Twine &Name = "") {
return CreateNeg(V, Name, true, false);
}
Value *CreateFNeg(Value *V, const Twine &Name = "", MDNode *FPMathTag = 0) {
Value *CreateFNeg(Value *V, const Twine &Name = "",
MDNode *FPMathTag = nullptr) {
if (Constant *VC = dyn_cast<Constant>(V))
return Insert(Folder.CreateFNeg(VC), Name);
return Insert(AddFPMathAttributes(BinaryOperator::CreateFNeg(V),
@ -885,7 +887,7 @@ public:
// Instruction creation methods: Memory Instructions
//===--------------------------------------------------------------------===//
AllocaInst *CreateAlloca(Type *Ty, Value *ArraySize = 0,
AllocaInst *CreateAlloca(Type *Ty, Value *ArraySize = nullptr,
const Twine &Name = "") {
return Insert(new AllocaInst(Ty, ArraySize), Name);
}
@ -898,7 +900,7 @@ public:
return Insert(new LoadInst(Ptr), Name);
}
LoadInst *CreateLoad(Value *Ptr, bool isVolatile, const Twine &Name = "") {
return Insert(new LoadInst(Ptr, 0, isVolatile), Name);
return Insert(new LoadInst(Ptr, nullptr, isVolatile), Name);
}
StoreInst *CreateStore(Value *Val, Value *Ptr, bool isVolatile = false) {
return Insert(new StoreInst(Val, Ptr, isVolatile));

View File

@ -36,7 +36,7 @@ class TerminatorInst : public Instruction {
protected:
TerminatorInst(Type *Ty, Instruction::TermOps iType,
Use *Ops, unsigned NumOps,
Instruction *InsertBefore = 0)
Instruction *InsertBefore = nullptr)
: Instruction(Ty, iType, Ops, NumOps, InsertBefore) {}
TerminatorInst(Type *Ty, Instruction::TermOps iType,
@ -91,7 +91,7 @@ class UnaryInstruction : public Instruction {
protected:
UnaryInstruction(Type *Ty, unsigned iType, Value *V,
Instruction *IB = 0)
Instruction *IB = nullptr)
: Instruction(Ty, iType, &Op<0>(), 1, IB) {
Op<0>() = V;
}
@ -160,7 +160,7 @@ public:
///
static BinaryOperator *Create(BinaryOps Op, Value *S1, Value *S2,
const Twine &Name = Twine(),
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
/// Create() - Construct a binary instruction, given the opcode and the two
/// operands. Also automatically insert this instruction to the end of the
@ -285,23 +285,23 @@ public:
/// instructions out of SUB and XOR instructions.
///
static BinaryOperator *CreateNeg(Value *Op, const Twine &Name = "",
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
static BinaryOperator *CreateNeg(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd);
static BinaryOperator *CreateNSWNeg(Value *Op, const Twine &Name = "",
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
static BinaryOperator *CreateNSWNeg(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd);
static BinaryOperator *CreateNUWNeg(Value *Op, const Twine &Name = "",
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
static BinaryOperator *CreateNUWNeg(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd);
static BinaryOperator *CreateFNeg(Value *Op, const Twine &Name = "",
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
static BinaryOperator *CreateFNeg(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd);
static BinaryOperator *CreateNot(Value *Op, const Twine &Name = "",
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
static BinaryOperator *CreateNot(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd);
@ -389,7 +389,7 @@ class CastInst : public UnaryInstruction {
protected:
/// @brief Constructor with insert-before-instruction semantics for subclasses
CastInst(Type *Ty, unsigned iType, Value *S,
const Twine &NameStr = "", Instruction *InsertBefore = 0)
const Twine &NameStr = "", Instruction *InsertBefore = nullptr)
: UnaryInstruction(Ty, iType, S, InsertBefore) {
setName(NameStr);
}
@ -411,7 +411,7 @@ public:
Value *S, ///< The value to be casted (operand 0)
Type *Ty, ///< The type to which cast should be made
const Twine &Name = "", ///< Name for the instruction
Instruction *InsertBefore = 0 ///< Place to insert the instruction
Instruction *InsertBefore = nullptr ///< Place to insert the instruction
);
/// Provides a way to construct any of the CastInst subclasses using an
/// opcode instead of the subclass's constructor. The opcode must be in the
@ -432,7 +432,7 @@ public:
Value *S, ///< The value to be casted (operand 0)
Type *Ty, ///< The type to which cast should be made
const Twine &Name = "", ///< Name for the instruction
Instruction *InsertBefore = 0 ///< Place to insert the instruction
Instruction *InsertBefore = nullptr ///< Place to insert the instruction
);
/// @brief Create a ZExt or BitCast cast instruction
@ -448,7 +448,7 @@ public:
Value *S, ///< The value to be casted (operand 0)
Type *Ty, ///< The type to which cast should be made
const Twine &Name = "", ///< Name for the instruction
Instruction *InsertBefore = 0 ///< Place to insert the instruction
Instruction *InsertBefore = nullptr ///< Place to insert the instruction
);
/// @brief Create a SExt or BitCast cast instruction
@ -472,7 +472,7 @@ public:
Value *S, ///< The pointer value to be casted (operand 0)
Type *Ty, ///< The type to which cast should be made
const Twine &Name = "", ///< Name for the instruction
Instruction *InsertBefore = 0 ///< Place to insert the instruction
Instruction *InsertBefore = nullptr ///< Place to insert the instruction
);
/// @brief Create a ZExt, BitCast, or Trunc for int -> int casts.
@ -481,7 +481,7 @@ public:
Type *Ty, ///< The type to which cast should be made
bool isSigned, ///< Whether to regard S as signed or not
const Twine &Name = "", ///< Name for the instruction
Instruction *InsertBefore = 0 ///< Place to insert the instruction
Instruction *InsertBefore = nullptr ///< Place to insert the instruction
);
/// @brief Create a ZExt, BitCast, or Trunc for int -> int casts.
@ -498,7 +498,7 @@ public:
Value *S, ///< The floating point value to be casted
Type *Ty, ///< The floating point type to cast to
const Twine &Name = "", ///< Name for the instruction
Instruction *InsertBefore = 0 ///< Place to insert the instruction
Instruction *InsertBefore = nullptr ///< Place to insert the instruction
);
/// @brief Create an FPExt, BitCast, or FPTrunc for fp -> fp casts
@ -514,7 +514,7 @@ public:
Value *S, ///< The value to be casted (operand 0)
Type *Ty, ///< The type to which cast should be made
const Twine &Name = "", ///< Name for the instruction
Instruction *InsertBefore = 0 ///< Place to insert the instruction
Instruction *InsertBefore = nullptr ///< Place to insert the instruction
);
/// @brief Create a Trunc or BitCast cast instruction
@ -641,7 +641,7 @@ class CmpInst : public Instruction {
protected:
CmpInst(Type *ty, Instruction::OtherOps op, unsigned short pred,
Value *LHS, Value *RHS, const Twine &Name = "",
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
CmpInst(Type *ty, Instruction::OtherOps op, unsigned short pred,
Value *LHS, Value *RHS, const Twine &Name,
@ -701,7 +701,7 @@ public:
static CmpInst *Create(OtherOps Op,
unsigned short predicate, Value *S1,
Value *S2, const Twine &Name = "",
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
/// Construct a compare instruction, given the opcode, the predicate and the
/// two operands. Also automatically insert this instruction to the end of

View File

@ -141,14 +141,14 @@ public:
/// getMetadata - Get the metadata of given kind attached to this Instruction.
/// If the metadata is not found then return null.
MDNode *getMetadata(unsigned KindID) const {
if (!hasMetadata()) return 0;
if (!hasMetadata()) return nullptr;
return getMetadataImpl(KindID);
}
/// getMetadata - Get the metadata of given kind attached to this Instruction.
/// If the metadata is not found then return null.
MDNode *getMetadata(StringRef Kind) const {
if (!hasMetadata()) return 0;
if (!hasMetadata()) return nullptr;
return getMetadataImpl(Kind);
}
@ -461,7 +461,7 @@ protected:
}
Instruction(Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
Instruction(Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
BasicBlock *InsertAtEnd);
virtual Instruction *clone_impl() const = 0;

View File

@ -60,16 +60,17 @@ class AllocaInst : public UnaryInstruction {
protected:
AllocaInst *clone_impl() const override;
public:
explicit AllocaInst(Type *Ty, Value *ArraySize = 0,
const Twine &Name = "", Instruction *InsertBefore = 0);
explicit AllocaInst(Type *Ty, Value *ArraySize = nullptr,
const Twine &Name = "",
Instruction *InsertBefore = nullptr);
AllocaInst(Type *Ty, Value *ArraySize,
const Twine &Name, BasicBlock *InsertAtEnd);
AllocaInst(Type *Ty, const Twine &Name, Instruction *InsertBefore = 0);
AllocaInst(Type *Ty, const Twine &Name, Instruction *InsertBefore = nullptr);
AllocaInst(Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd);
AllocaInst(Type *Ty, Value *ArraySize, unsigned Align,
const Twine &Name = "", Instruction *InsertBefore = 0);
const Twine &Name = "", Instruction *InsertBefore = nullptr);
AllocaInst(Type *Ty, Value *ArraySize, unsigned Align,
const Twine &Name, BasicBlock *InsertAtEnd);
@ -156,17 +157,17 @@ public:
LoadInst(Value *Ptr, const Twine &NameStr, Instruction *InsertBefore);
LoadInst(Value *Ptr, const Twine &NameStr, BasicBlock *InsertAtEnd);
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile = false,
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile,
BasicBlock *InsertAtEnd);
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile,
unsigned Align, Instruction *InsertBefore = 0);
unsigned Align, Instruction *InsertBefore = nullptr);
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile,
unsigned Align, BasicBlock *InsertAtEnd);
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile,
unsigned Align, AtomicOrdering Order,
SynchronizationScope SynchScope = CrossThread,
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
LoadInst(Value *Ptr, const Twine &NameStr, bool isVolatile,
unsigned Align, AtomicOrdering Order,
SynchronizationScope SynchScope,
@ -174,8 +175,9 @@ public:
LoadInst(Value *Ptr, const char *NameStr, Instruction *InsertBefore);
LoadInst(Value *Ptr, const char *NameStr, BasicBlock *InsertAtEnd);
explicit LoadInst(Value *Ptr, const char *NameStr = 0,
bool isVolatile = false, Instruction *InsertBefore = 0);
explicit LoadInst(Value *Ptr, const char *NameStr = nullptr,
bool isVolatile = false,
Instruction *InsertBefore = nullptr);
LoadInst(Value *Ptr, const char *NameStr, bool isVolatile,
BasicBlock *InsertAtEnd);
@ -280,16 +282,16 @@ public:
StoreInst(Value *Val, Value *Ptr, Instruction *InsertBefore);
StoreInst(Value *Val, Value *Ptr, BasicBlock *InsertAtEnd);
StoreInst(Value *Val, Value *Ptr, bool isVolatile = false,
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
StoreInst(Value *Val, Value *Ptr, bool isVolatile, BasicBlock *InsertAtEnd);
StoreInst(Value *Val, Value *Ptr, bool isVolatile,
unsigned Align, Instruction *InsertBefore = 0);
unsigned Align, Instruction *InsertBefore = nullptr);
StoreInst(Value *Val, Value *Ptr, bool isVolatile,
unsigned Align, BasicBlock *InsertAtEnd);
StoreInst(Value *Val, Value *Ptr, bool isVolatile,
unsigned Align, AtomicOrdering Order,
SynchronizationScope SynchScope = CrossThread,
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
StoreInst(Value *Val, Value *Ptr, bool isVolatile,
unsigned Align, AtomicOrdering Order,
SynchronizationScope SynchScope,
@ -409,7 +411,7 @@ public:
// SequentiallyConsistent.
FenceInst(LLVMContext &C, AtomicOrdering Ordering,
SynchronizationScope SynchScope = CrossThread,
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
FenceInst(LLVMContext &C, AtomicOrdering Ordering,
SynchronizationScope SynchScope,
BasicBlock *InsertAtEnd);
@ -477,7 +479,7 @@ public:
AtomicOrdering SuccessOrdering,
AtomicOrdering FailureOrdering,
SynchronizationScope SynchScope,
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal,
AtomicOrdering SuccessOrdering,
AtomicOrdering FailureOrdering,
@ -651,7 +653,7 @@ public:
}
AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val,
AtomicOrdering Ordering, SynchronizationScope SynchScope,
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val,
AtomicOrdering Ordering, SynchronizationScope SynchScope,
BasicBlock *InsertAtEnd);
@ -779,7 +781,7 @@ protected:
public:
static GetElementPtrInst *Create(Value *Ptr, ArrayRef<Value *> IdxList,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
Instruction *InsertBefore = nullptr) {
unsigned Values = 1 + unsigned(IdxList.size());
return new(Values)
GetElementPtrInst(Ptr, IdxList, Values, NameStr, InsertBefore);
@ -797,7 +799,7 @@ public:
static GetElementPtrInst *CreateInBounds(Value *Ptr,
ArrayRef<Value *> IdxList,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
Instruction *InsertBefore = nullptr){
GetElementPtrInst *GEP = Create(Ptr, IdxList, NameStr, InsertBefore);
GEP->setIsInBounds(true);
return GEP;
@ -1237,7 +1239,7 @@ public:
static CallInst *Create(Value *Func,
ArrayRef<Value *> Args,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
Instruction *InsertBefore = nullptr) {
return new(unsigned(Args.size() + 1))
CallInst(Func, Args, NameStr, InsertBefore);
}
@ -1248,7 +1250,7 @@ public:
CallInst(Func, Args, NameStr, InsertAtEnd);
}
static CallInst *Create(Value *F, const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
Instruction *InsertBefore = nullptr) {
return new(1) CallInst(F, NameStr, InsertBefore);
}
static CallInst *Create(Value *F, const Twine &NameStr,
@ -1263,13 +1265,13 @@ public:
/// 3. Bitcast the result of the malloc call to the specified type.
static Instruction *CreateMalloc(Instruction *InsertBefore,
Type *IntPtrTy, Type *AllocTy,
Value *AllocSize, Value *ArraySize = 0,
Function* MallocF = 0,
Value *AllocSize, Value *ArraySize = nullptr,
Function* MallocF = nullptr,
const Twine &Name = "");
static Instruction *CreateMalloc(BasicBlock *InsertAtEnd,
Type *IntPtrTy, Type *AllocTy,
Value *AllocSize, Value *ArraySize = 0,
Function* MallocF = 0,
Value *AllocSize, Value *ArraySize = nullptr,
Function* MallocF = nullptr,
const Twine &Name = "");
/// CreateFree - Generate the IR for a call to the builtin free function.
static Instruction* CreateFree(Value* Source, Instruction *InsertBefore);
@ -1520,7 +1522,7 @@ protected:
public:
static SelectInst *Create(Value *C, Value *S1, Value *S2,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
Instruction *InsertBefore = nullptr) {
return new(3) SelectInst(C, S1, S2, NameStr, InsertBefore);
}
static SelectInst *Create(Value *C, Value *S1, Value *S2,
@ -1575,7 +1577,7 @@ protected:
public:
VAArgInst(Value *List, Type *Ty, const Twine &NameStr = "",
Instruction *InsertBefore = 0)
Instruction *InsertBefore = nullptr)
: UnaryInstruction(Ty, VAArg, List, InsertBefore) {
setName(NameStr);
}
@ -1607,7 +1609,7 @@ public:
///
class ExtractElementInst : public Instruction {
ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr = "",
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr,
BasicBlock *InsertAtEnd);
protected:
@ -1616,7 +1618,7 @@ protected:
public:
static ExtractElementInst *Create(Value *Vec, Value *Idx,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
Instruction *InsertBefore = nullptr) {
return new(2) ExtractElementInst(Vec, Idx, NameStr, InsertBefore);
}
static ExtractElementInst *Create(Value *Vec, Value *Idx,
@ -1668,7 +1670,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractElementInst, Value)
class InsertElementInst : public Instruction {
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
const Twine &NameStr = "",
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
const Twine &NameStr, BasicBlock *InsertAtEnd);
protected:
@ -1677,7 +1679,7 @@ protected:
public:
static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
Instruction *InsertBefore = nullptr) {
return new(3) InsertElementInst(Vec, NewElt, Idx, NameStr, InsertBefore);
}
static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx,
@ -1734,7 +1736,7 @@ public:
}
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
const Twine &NameStr = "",
Instruction *InsertBefor = 0);
Instruction *InsertBefor = nullptr);
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
const Twine &NameStr, BasicBlock *InsertAtEnd);
@ -1832,7 +1834,7 @@ public:
static ExtractValueInst *Create(Value *Agg,
ArrayRef<unsigned> Idxs,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
Instruction *InsertBefore = nullptr) {
return new
ExtractValueInst(Agg, Idxs, NameStr, InsertBefore);
}
@ -1933,7 +1935,7 @@ class InsertValueInst : public Instruction {
/// and two index insertvalue instructions are so common.
InsertValueInst(Value *Agg, Value *Val,
unsigned Idx, const Twine &NameStr = "",
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
InsertValueInst(Value *Agg, Value *Val, unsigned Idx,
const Twine &NameStr, BasicBlock *InsertAtEnd);
protected:
@ -1947,7 +1949,7 @@ public:
static InsertValueInst *Create(Value *Agg, Value *Val,
ArrayRef<unsigned> Idxs,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
Instruction *InsertBefore = nullptr) {
return new InsertValueInst(Agg, Val, Idxs, NameStr, InsertBefore);
}
static InsertValueInst *Create(Value *Agg, Value *Val,
@ -2052,8 +2054,9 @@ class PHINode : public Instruction {
return User::operator new(s, 0);
}
explicit PHINode(Type *Ty, unsigned NumReservedValues,
const Twine &NameStr = "", Instruction *InsertBefore = 0)
: Instruction(Ty, Instruction::PHI, 0, 0, InsertBefore),
const Twine &NameStr = "",
Instruction *InsertBefore = nullptr)
: Instruction(Ty, Instruction::PHI, nullptr, 0, InsertBefore),
ReservedSpace(NumReservedValues) {
setName(NameStr);
OperandList = allocHungoffUses(ReservedSpace);
@ -2061,7 +2064,7 @@ class PHINode : public Instruction {
PHINode(Type *Ty, unsigned NumReservedValues, const Twine &NameStr,
BasicBlock *InsertAtEnd)
: Instruction(Ty, Instruction::PHI, 0, 0, InsertAtEnd),
: Instruction(Ty, Instruction::PHI, nullptr, 0, InsertAtEnd),
ReservedSpace(NumReservedValues) {
setName(NameStr);
OperandList = allocHungoffUses(ReservedSpace);
@ -2078,7 +2081,7 @@ public:
/// edges that this phi node will have (use 0 if you really have no idea).
static PHINode *Create(Type *Ty, unsigned NumReservedValues,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
Instruction *InsertBefore = nullptr) {
return new PHINode(Ty, NumReservedValues, NameStr, InsertBefore);
}
static PHINode *Create(Type *Ty, unsigned NumReservedValues,
@ -2270,7 +2273,7 @@ public:
static LandingPadInst *Create(Type *RetTy, Value *PersonalityFn,
unsigned NumReservedClauses,
const Twine &NameStr = "",
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
static LandingPadInst *Create(Type *RetTy, Value *PersonalityFn,
unsigned NumReservedClauses,
const Twine &NameStr, BasicBlock *InsertAtEnd);
@ -2356,15 +2359,15 @@ private:
//
// NOTE: If the Value* passed is of type void then the constructor behaves as
// if it was passed NULL.
explicit ReturnInst(LLVMContext &C, Value *retVal = 0,
Instruction *InsertBefore = 0);
explicit ReturnInst(LLVMContext &C, Value *retVal = nullptr,
Instruction *InsertBefore = nullptr);
ReturnInst(LLVMContext &C, Value *retVal, BasicBlock *InsertAtEnd);
explicit ReturnInst(LLVMContext &C, BasicBlock *InsertAtEnd);
protected:
ReturnInst *clone_impl() const override;
public:
static ReturnInst* Create(LLVMContext &C, Value *retVal = 0,
Instruction *InsertBefore = 0) {
static ReturnInst* Create(LLVMContext &C, Value *retVal = nullptr,
Instruction *InsertBefore = nullptr) {
return new(!!retVal) ReturnInst(C, retVal, InsertBefore);
}
static ReturnInst* Create(LLVMContext &C, Value *retVal,
@ -2381,7 +2384,7 @@ public:
/// Convenience accessor. Returns null if there is no return value.
Value *getReturnValue() const {
return getNumOperands() != 0 ? getOperand(0) : 0;
return getNumOperands() != 0 ? getOperand(0) : nullptr;
}
unsigned getNumSuccessors() const { return 0; }
@ -2426,20 +2429,21 @@ class BranchInst : public TerminatorInst {
// BranchInst(BB* T, BB *F, Value *C, Inst *I) - 'br C, T, F', insert before I
// BranchInst(BB* B, BB *I) - 'br B' insert at end
// BranchInst(BB* T, BB *F, Value *C, BB *I) - 'br C, T, F', insert at end
explicit BranchInst(BasicBlock *IfTrue, Instruction *InsertBefore = 0);
explicit BranchInst(BasicBlock *IfTrue, Instruction *InsertBefore = nullptr);
BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
Instruction *InsertBefore = 0);
Instruction *InsertBefore = nullptr);
BranchInst(BasicBlock *IfTrue, BasicBlock *InsertAtEnd);
BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
BasicBlock *InsertAtEnd);
protected:
BranchInst *clone_impl() const override;
public:
static BranchInst *Create(BasicBlock *IfTrue, Instruction *InsertBefore = 0) {
static BranchInst *Create(BasicBlock *IfTrue,
Instruction *InsertBefore = nullptr) {
return new(1) BranchInst(IfTrue, InsertBefore);
}
static BranchInst *Create(BasicBlock *IfTrue, BasicBlock *IfFalse,
Value *Cond, Instruction *InsertBefore = 0) {
Value *Cond, Instruction *InsertBefore = nullptr) {
return new(3) BranchInst(IfTrue, IfFalse, Cond, InsertBefore);
}
static BranchInst *Create(BasicBlock *IfTrue, BasicBlock *InsertAtEnd) {
@ -2658,7 +2662,8 @@ public:
};
static SwitchInst *Create(Value *Value, BasicBlock *Default,
unsigned NumCases, Instruction *InsertBefore = 0) {
unsigned NumCases,
Instruction *InsertBefore = nullptr) {
return new SwitchInst(Value, Default, NumCases, InsertBefore);
}
static SwitchInst *Create(Value *Value, BasicBlock *Default,
@ -2742,12 +2747,12 @@ public:
/// findCaseDest - Finds the unique case value for a given successor. Returns
/// null if the successor is not found, not unique, or is the default case.
ConstantInt *findCaseDest(BasicBlock *BB) {
if (BB == getDefaultDest()) return NULL;
if (BB == getDefaultDest()) return nullptr;
ConstantInt *CI = NULL;
ConstantInt *CI = nullptr;
for (CaseIt i = case_begin(), e = case_end(); i != e; ++i) {
if (i.getCaseSuccessor() == BB) {
if (CI) return NULL; // Multiple cases lead to BB.
if (CI) return nullptr; // Multiple cases lead to BB.
else CI = i.getCaseValue();
}
}
@ -2834,7 +2839,7 @@ protected:
IndirectBrInst *clone_impl() const override;
public:
static IndirectBrInst *Create(Value *Address, unsigned NumDests,
Instruction *InsertBefore = 0) {
Instruction *InsertBefore = nullptr) {
return new IndirectBrInst(Address, NumDests, InsertBefore);
}
static IndirectBrInst *Create(Value *Address, unsigned NumDests,
@ -2928,7 +2933,7 @@ public:
static InvokeInst *Create(Value *Func,
BasicBlock *IfNormal, BasicBlock *IfException,
ArrayRef<Value *> Args, const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
Instruction *InsertBefore = nullptr) {
unsigned Values = unsigned(Args.size()) + 3;
return new(Values) InvokeInst(Func, IfNormal, IfException, Args,
Values, NameStr, InsertBefore);
@ -3175,12 +3180,12 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InvokeInst, Value)
class ResumeInst : public TerminatorInst {
ResumeInst(const ResumeInst &RI);
explicit ResumeInst(Value *Exn, Instruction *InsertBefore=0);
explicit ResumeInst(Value *Exn, Instruction *InsertBefore=nullptr);
ResumeInst(Value *Exn, BasicBlock *InsertAtEnd);
protected:
ResumeInst *clone_impl() const override;
public:
static ResumeInst *Create(Value *Exn, Instruction *InsertBefore = 0) {
static ResumeInst *Create(Value *Exn, Instruction *InsertBefore = nullptr) {
return new(1) ResumeInst(Exn, InsertBefore);
}
static ResumeInst *Create(Value *Exn, BasicBlock *InsertAtEnd) {
@ -3234,7 +3239,7 @@ public:
void *operator new(size_t s) {
return User::operator new(s, 0);
}
explicit UnreachableInst(LLVMContext &C, Instruction *InsertBefore = 0);
explicit UnreachableInst(LLVMContext &C, Instruction *InsertBefore = nullptr);
explicit UnreachableInst(LLVMContext &C, BasicBlock *InsertAtEnd);
unsigned getNumSuccessors() const { return 0; }
@ -3265,16 +3270,16 @@ protected:
public:
/// \brief Constructor with insert-before-instruction semantics
TruncInst(
Value *S, ///< The value to be truncated
Type *Ty, ///< The (smaller) type to truncate to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = 0 ///< Where to insert the new instruction
Value *S, ///< The value to be truncated
Type *Ty, ///< The (smaller) type to truncate to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
);
/// \brief Constructor with insert-at-end-of-block semantics
TruncInst(
Value *S, ///< The value to be truncated
Type *Ty, ///< The (smaller) type to truncate to
Type *Ty, ///< The (smaller) type to truncate to
const Twine &NameStr, ///< A name for the new instruction
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
@ -3301,16 +3306,16 @@ protected:
public:
/// \brief Constructor with insert-before-instruction semantics
ZExtInst(
Value *S, ///< The value to be zero extended
Type *Ty, ///< The type to zero extend to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = 0 ///< Where to insert the new instruction
Value *S, ///< The value to be zero extended
Type *Ty, ///< The type to zero extend to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
);
/// \brief Constructor with insert-at-end semantics.
ZExtInst(
Value *S, ///< The value to be zero extended
Type *Ty, ///< The type to zero extend to
Type *Ty, ///< The type to zero extend to
const Twine &NameStr, ///< A name for the new instruction
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
@ -3337,16 +3342,16 @@ protected:
public:
/// \brief Constructor with insert-before-instruction semantics
SExtInst(
Value *S, ///< The value to be sign extended
Type *Ty, ///< The type to sign extend to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = 0 ///< Where to insert the new instruction
Value *S, ///< The value to be sign extended
Type *Ty, ///< The type to sign extend to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
);
/// \brief Constructor with insert-at-end-of-block semantics
SExtInst(
Value *S, ///< The value to be sign extended
Type *Ty, ///< The type to sign extend to
Type *Ty, ///< The type to sign extend to
const Twine &NameStr, ///< A name for the new instruction
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
@ -3373,16 +3378,16 @@ protected:
public:
/// \brief Constructor with insert-before-instruction semantics
FPTruncInst(
Value *S, ///< The value to be truncated
Type *Ty, ///< The type to truncate to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = 0 ///< Where to insert the new instruction
Value *S, ///< The value to be truncated
Type *Ty, ///< The type to truncate to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
);
/// \brief Constructor with insert-before-instruction semantics
FPTruncInst(
Value *S, ///< The value to be truncated
Type *Ty, ///< The type to truncate to
Type *Ty, ///< The type to truncate to
const Twine &NameStr, ///< A name for the new instruction
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
@ -3409,16 +3414,16 @@ protected:
public:
/// \brief Constructor with insert-before-instruction semantics
FPExtInst(
Value *S, ///< The value to be extended
Type *Ty, ///< The type to extend to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = 0 ///< Where to insert the new instruction
Value *S, ///< The value to be extended
Type *Ty, ///< The type to extend to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
);
/// \brief Constructor with insert-at-end-of-block semantics
FPExtInst(
Value *S, ///< The value to be extended
Type *Ty, ///< The type to extend to
Type *Ty, ///< The type to extend to
const Twine &NameStr, ///< A name for the new instruction
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
@ -3445,16 +3450,16 @@ protected:
public:
/// \brief Constructor with insert-before-instruction semantics
UIToFPInst(
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = 0 ///< Where to insert the new instruction
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
);
/// \brief Constructor with insert-at-end-of-block semantics
UIToFPInst(
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
Type *Ty, ///< The type to convert to
const Twine &NameStr, ///< A name for the new instruction
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
@ -3481,16 +3486,16 @@ protected:
public:
/// \brief Constructor with insert-before-instruction semantics
SIToFPInst(
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = 0 ///< Where to insert the new instruction
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
);
/// \brief Constructor with insert-at-end-of-block semantics
SIToFPInst(
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
Type *Ty, ///< The type to convert to
const Twine &NameStr, ///< A name for the new instruction
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
@ -3517,16 +3522,16 @@ protected:
public:
/// \brief Constructor with insert-before-instruction semantics
FPToUIInst(
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = 0 ///< Where to insert the new instruction
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
);
/// \brief Constructor with insert-at-end-of-block semantics
FPToUIInst(
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
Type *Ty, ///< The type to convert to
const Twine &NameStr, ///< A name for the new instruction
BasicBlock *InsertAtEnd ///< Where to insert the new instruction
);
@ -3553,16 +3558,16 @@ protected:
public:
/// \brief Constructor with insert-before-instruction semantics
FPToSIInst(
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = 0 ///< Where to insert the new instruction
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
);
/// \brief Constructor with insert-at-end-of-block semantics
FPToSIInst(
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
Type *Ty, ///< The type to convert to
const Twine &NameStr, ///< A name for the new instruction
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
@ -3585,16 +3590,16 @@ class IntToPtrInst : public CastInst {
public:
/// \brief Constructor with insert-before-instruction semantics
IntToPtrInst(
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = 0 ///< Where to insert the new instruction
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
);
/// \brief Constructor with insert-at-end-of-block semantics
IntToPtrInst(
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
Type *Ty, ///< The type to convert to
const Twine &NameStr, ///< A name for the new instruction
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
@ -3629,16 +3634,16 @@ protected:
public:
/// \brief Constructor with insert-before-instruction semantics
PtrToIntInst(
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = 0 ///< Where to insert the new instruction
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
);
/// \brief Constructor with insert-at-end-of-block semantics
PtrToIntInst(
Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
Type *Ty, ///< The type to convert to
const Twine &NameStr, ///< A name for the new instruction
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
@ -3677,16 +3682,16 @@ protected:
public:
/// \brief Constructor with insert-before-instruction semantics
BitCastInst(
Value *S, ///< The value to be casted
Type *Ty, ///< The type to casted to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = 0 ///< Where to insert the new instruction
Value *S, ///< The value to be casted
Type *Ty, ///< The type to casted to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
);
/// \brief Constructor with insert-at-end-of-block semantics
BitCastInst(
Value *S, ///< The value to be casted
Type *Ty, ///< The type to casted to
Type *Ty, ///< The type to casted to
const Twine &NameStr, ///< A name for the new instruction
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
@ -3714,10 +3719,10 @@ protected:
public:
/// \brief Constructor with insert-before-instruction semantics
AddrSpaceCastInst(
Value *S, ///< The value to be casted
Type *Ty, ///< The type to casted to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = 0 ///< Where to insert the new instruction
Value *S, ///< The value to be casted
Type *Ty, ///< The type to casted to
const Twine &NameStr = "", ///< A name for the new instruction
Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
);
/// \brief Constructor with insert-at-end-of-block semantics

View File

@ -80,7 +80,7 @@ public:
/// LLVMContext doesn't take ownership or interpret either of these
/// pointers.
void setInlineAsmDiagnosticHandler(InlineAsmDiagHandlerTy DiagHandler,
void *DiagContext = 0);
void *DiagContext = nullptr);
/// getInlineAsmDiagnosticHandler - Return the diagnostic handler set by
/// setInlineAsmDiagnosticHandler.
@ -98,7 +98,7 @@ public:
/// LLVMContext doesn't take ownership or interpret either of these
/// pointers.
void setDiagnosticHandler(DiagnosticHandlerTy DiagHandler,
void *DiagContext = 0);
void *DiagContext = nullptr);
/// getDiagnosticHandler - Return the diagnostic handler set by
/// setDiagnosticHandler.

View File

@ -120,11 +120,11 @@ class PassManagerPrettyStackEntry : public PrettyStackTraceEntry {
Module *M;
public:
explicit PassManagerPrettyStackEntry(Pass *p)
: P(p), V(0), M(0) {} // When P is releaseMemory'd.
: P(p), V(nullptr), M(nullptr) {} // When P is releaseMemory'd.
PassManagerPrettyStackEntry(Pass *p, Value &v)
: P(p), V(&v), M(0) {} // When P is run on V
: P(p), V(&v), M(nullptr) {} // When P is run on V
PassManagerPrettyStackEntry(Pass *p, Module &m)
: P(p), V(0), M(&m) {} // When P is run on M
: P(p), V(nullptr), M(&m) {} // When P is run on M
/// print - Emit information about this stack frame to OS.
void print(raw_ostream &OS) const override;
@ -263,7 +263,7 @@ private:
class PMDataManager {
public:
explicit PMDataManager() : TPM(NULL), Depth(0) {
explicit PMDataManager() : TPM(nullptr), Depth(0) {
initializeAnalysisInfo();
}
@ -303,7 +303,7 @@ public:
void initializeAnalysisInfo() {
AvailableAnalysis.clear();
for (unsigned i = 0; i < PMT_Last; ++i)
InheritedAnalysis[i] = NULL;
InheritedAnalysis[i] = nullptr;
}
// Return true if P preserves high level analysis used by other

View File

@ -43,7 +43,7 @@ class PassNameParser : public PassRegistrationListener,
public cl::parser<const PassInfo*> {
cl::Option *Opt;
public:
PassNameParser() : Opt(0) {}
PassNameParser() : Opt(nullptr) {}
virtual ~PassNameParser();
void initialize(cl::Option &O) {
@ -62,8 +62,8 @@ public:
inline bool ignorablePass(const PassInfo *P) const {
// Ignore non-selectable and non-constructible passes! Ignore
// non-optimizations.
return P->getPassArgument() == 0 || *P->getPassArgument() == 0 ||
P->getNormalCtor() == 0 || ignorablePassImpl(P);
return P->getPassArgument() == nullptr || *P->getPassArgument() == 0 ||
P->getNormalCtor() == nullptr || ignorablePassImpl(P);
}
// Implement the PassRegistrationListener callbacks used to populate our map

View File

@ -218,7 +218,7 @@ class NamedMDNode : public ilist_node<NamedMDNode> {
friend class NamedMDNode;
public:
op_iterator_impl() : Node(0), Idx(0) { }
op_iterator_impl() : Node(nullptr), Idx(0) { }
bool operator==(const op_iterator_impl &o) const { return Idx == o.Idx; }
bool operator!=(const op_iterator_impl &o) const { return Idx != o.Idx; }
@ -272,7 +272,7 @@ public:
StringRef getName() const;
/// print - Implement operator<< on NamedMDNode.
void print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW = 0) const;
void print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW = nullptr) const;
/// dump() - Allow printing of NamedMDNodes from the debugger.
void dump() const;

View File

@ -457,7 +457,7 @@ public:
/// Materialize - Make sure the GlobalValue is fully read. If the module is
/// corrupt, this returns true and fills in the optional string with
/// information about the problem. If successful, this returns false.
bool Materialize(GlobalValue *GV, std::string *ErrInfo = 0);
bool Materialize(GlobalValue *GV, std::string *ErrInfo = nullptr);
/// Dematerialize - If the GlobalValue is read in, and if the GVMaterializer
/// supports it, release the memory for the function, and set it up to be
/// materialized lazily. If !isDematerializable(), this method is a noop.
@ -603,7 +603,7 @@ public:
/// An raw_ostream inserter for modules.
inline raw_ostream &operator<<(raw_ostream &O, const Module &M) {
M.print(O, 0);
M.print(O, nullptr);
return O;
}

View File

@ -480,7 +480,7 @@ public:
///
/// This method should only be called for a single module as there is the
/// expectation that the lifetime of a pass is bounded to that of a module.
PreservedAnalyses run(Module *M, ModuleAnalysisManager *AM = 0);
PreservedAnalyses run(Module *M, ModuleAnalysisManager *AM = nullptr);
template <typename ModulePassT> void addPass(ModulePassT Pass) {
Passes.emplace_back(new ModulePassModel<ModulePassT>(std::move(Pass)));
@ -524,7 +524,7 @@ public:
Passes.emplace_back(new FunctionPassModel<FunctionPassT>(std::move(Pass)));
}
PreservedAnalyses run(Function *F, FunctionAnalysisManager *AM = 0);
PreservedAnalyses run(Function *F, FunctionAnalysisManager *AM = nullptr);
static StringRef name() { return "FunctionPassManager"; }
@ -987,7 +987,7 @@ public:
/// \brief Runs the function pass across every function in the module.
PreservedAnalyses run(Module *M, ModuleAnalysisManager *AM) {
FunctionAnalysisManager *FAM = 0;
FunctionAnalysisManager *FAM = nullptr;
if (AM)
// Setup the function analysis manager from its proxy.
FAM = &AM->getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();

View File

@ -46,19 +46,19 @@ public:
/// getListOwner - Return the object that owns this list. If this is a list
/// of instructions, it returns the BasicBlock that owns them.
ItemParentClass *getListOwner() {
size_t Offset(size_t(&((ItemParentClass*)0->*ItemParentClass::
getSublistAccess(static_cast<ValueSubClass*>(0)))));
size_t Offset(size_t(&((ItemParentClass*)nullptr->*ItemParentClass::
getSublistAccess(static_cast<ValueSubClass*>(nullptr)))));
iplist<ValueSubClass>* Anchor(static_cast<iplist<ValueSubClass>*>(this));
return reinterpret_cast<ItemParentClass*>(reinterpret_cast<char*>(Anchor)-
Offset);
}
static iplist<ValueSubClass> &getList(ItemParentClass *Par) {
return Par->*(Par->getSublistAccess((ValueSubClass*)0));
return Par->*(Par->getSublistAccess((ValueSubClass*)nullptr));
}
static ValueSymbolTable *getSymTab(ItemParentClass *Par) {
return Par ? toPtr(Par->getValueSymbolTable()) : 0;
return Par ? toPtr(Par->getValueSymbolTable()) : nullptr;
}
void addNodeToList(ValueSubClass *V);

View File

@ -88,7 +88,7 @@ protected:
friend class LLVMContextImpl;
explicit Type(LLVMContext &C, TypeID tid)
: Context(C), IDAndSubclassData(0),
NumContainedTys(0), ContainedTys(0) {
NumContainedTys(0), ContainedTys(nullptr) {
setTypeID(tid);
}
~Type() {}
@ -265,7 +265,7 @@ public:
/// get the actual size for a particular target, it is reasonable to use the
/// DataLayout subsystem to do this.
///
bool isSized(SmallPtrSet<const Type*, 4> *Visited = 0) const {
bool isSized(SmallPtrSet<const Type*, 4> *Visited = nullptr) const {
// If it's a primitive, it is always sized.
if (getTypeID() == IntegerTyID || isFloatingPointTy() ||
getTypeID() == PointerTyID ||
@ -419,7 +419,7 @@ private:
/// isSizedDerivedType - Derived types like structures and arrays are sized
/// iff all of the members of the type are sized as well. Since asking for
/// their size is relatively uncommon, move this operation out of line.
bool isSizedDerivedType(SmallPtrSet<const Type*, 4> *Visited = 0) const;
bool isSizedDerivedType(SmallPtrSet<const Type*, 4> *Visited = nullptr) const;
};
// Printing of types.

View File

@ -88,7 +88,7 @@ private:
enum PrevPtrTag { zeroDigitTag, oneDigitTag, stopTag, fullStopTag };
/// Constructor
Use(PrevPtrTag tag) : Val(0) { Prev.setInt(tag); }
Use(PrevPtrTag tag) : Val(nullptr) { Prev.setInt(tag); }
public:
operator Value *() const { return Val; }

View File

@ -55,7 +55,7 @@ protected:
Use *allocHungoffUses(unsigned) const;
void dropHungoffUses() {
Use::zap(OperandList, OperandList + NumOperands, true);
OperandList = 0;
OperandList = nullptr;
// Reset NumOperands so User::operator delete() does the right thing.
NumOperands = 0;
}
@ -179,7 +179,7 @@ public:
//
void dropAllReferences() {
for (Use &U : operands())
U.set(0);
U.set(nullptr);
}
/// replaceUsesOfWith - Replaces all references to the "From" definition with

View File

@ -203,7 +203,8 @@ public:
/// instruction that generated it. If you specify a Module for context, then
/// even constanst get pretty-printed; for example, the type of a null
/// pointer is printed symbolically.
void printAsOperand(raw_ostream &O, bool PrintType = true, const Module *M = 0) const;
void printAsOperand(raw_ostream &O, bool PrintType = true,
const Module *M = nullptr) const;
/// All values are typed, get the type of this value.
///
@ -213,7 +214,7 @@ public:
LLVMContext &getContext() const;
// All values can potentially be named.
bool hasName() const { return Name != 0 && SubclassID != MDStringVal; }
bool hasName() const { return Name != nullptr && SubclassID != MDStringVal; }
ValueName *getValueName() const { return Name; }
void setValueName(ValueName *VN) { Name = VN; }
@ -242,7 +243,7 @@ public:
//----------------------------------------------------------------------
// Methods for handling the chain of uses of this Value.
//
bool use_empty() const { return UseList == 0; }
bool use_empty() const { return UseList == nullptr; }
typedef use_iterator_impl<Use> use_iterator;
typedef use_iterator_impl<const Use> const_use_iterator;

View File

@ -64,14 +64,14 @@ private:
ValueHandleBase(const ValueHandleBase&) LLVM_DELETED_FUNCTION;
public:
explicit ValueHandleBase(HandleBaseKind Kind)
: PrevPair(0, Kind), Next(0), VP(0, 0) {}
: PrevPair(nullptr, Kind), Next(nullptr), VP(nullptr, 0) {}
ValueHandleBase(HandleBaseKind Kind, Value *V)
: PrevPair(0, Kind), Next(0), VP(V, 0) {
: PrevPair(nullptr, Kind), Next(nullptr), VP(V, 0) {
if (isValid(VP.getPointer()))
AddToUseList();
}
ValueHandleBase(HandleBaseKind Kind, const ValueHandleBase &RHS)
: PrevPair(0, Kind), Next(0), VP(RHS.VP) {
: PrevPair(nullptr, Kind), Next(nullptr), VP(RHS.VP) {
if (isValid(VP.getPointer()))
AddToExistingUseList(RHS.getPrevPtr());
}
@ -366,7 +366,7 @@ public:
///
/// All implementations must remove the reference from this object to the
/// Value that's being destroyed.
virtual void deleted() { setValPtr(NULL); }
virtual void deleted() { setValPtr(nullptr); }
/// Called when this->getValPtr()->replaceAllUsesWith(new_value) is called,
/// _before_ any of the uses have actually been replaced. If WeakVH were

View File

@ -38,14 +38,14 @@ class raw_ostream;
/// If there are no errors, the function returns false. If an error is found,
/// a message describing the error is written to OS (if non-null) and true is
/// returned.
bool verifyFunction(const Function &F, raw_ostream *OS = 0);
bool verifyFunction(const Function &F, raw_ostream *OS = nullptr);
/// \brief Check a module for errors.
///
/// If there are no errors, the function returns false. If an error is found,
/// a message describing the error is written to OS (if non-null) and true is
/// returned.
bool verifyModule(const Module &M, raw_ostream *OS = 0);
bool verifyModule(const Module &M, raw_ostream *OS = nullptr);
/// \brief Create a verifier pass.
///

View File

@ -87,7 +87,8 @@ class Pass {
Pass(const Pass &) LLVM_DELETED_FUNCTION;
public:
explicit Pass(PassKind K, char &pid) : Resolver(0), PassID(&pid), Kind(K) { }
explicit Pass(PassKind K, char &pid)
: Resolver(nullptr), PassID(&pid), Kind(K) { }
virtual ~Pass();

View File

@ -129,7 +129,7 @@ public:
// Find pass that is implementing PI.
Pass *findImplPass(AnalysisID PI) {
Pass *ResultPass = 0;
Pass *ResultPass = nullptr;
for (unsigned i = 0; i < AnalysisImpls.size() ; ++i) {
if (AnalysisImpls[i].first == PI) {
ResultPass = AnalysisImpls[i].second;
@ -182,7 +182,7 @@ AnalysisType *Pass::getAnalysisIfAvailable() const {
const void *PI = &AnalysisType::ID;
Pass *ResultPass = Resolver->getAnalysisIfAvailable(PI, true);
if (ResultPass == 0) return 0;
if (!ResultPass) return 0;
// Because the AnalysisType may not be a subclass of pass (for
// AnalysisGroups), we use getAdjustedAnalysisPointer here to potentially

View File

@ -37,7 +37,7 @@ class PassRegistry {
void *getImpl() const;
public:
PassRegistry() : pImpl(0) { }
PassRegistry() : pImpl(nullptr) { }
~PassRegistry();
/// getPassRegistry - Access the global registry object, which is

View File

@ -59,7 +59,7 @@ public:
/// through RegisterPass.
PassInfo(const char *name, const char *arg, const void *pi,
NormalCtor_t normal, bool isCFGOnly, bool is_analysis,
TargetMachineCtor_t machine = NULL)
TargetMachineCtor_t machine = nullptr)
: PassName(name), PassArgument(arg), PassID(pi),
IsCFGOnlyPass(isCFGOnly),
IsAnalysis(is_analysis), IsAnalysisGroup(false), NormalCtor(normal),
@ -70,8 +70,8 @@ public:
PassInfo(const char *name, const void *pi)
: PassName(name), PassArgument(""), PassID(pi),
IsCFGOnlyPass(false),
IsAnalysis(false), IsAnalysisGroup(true), NormalCtor(0),
TargetMachineCtor(0) {}
IsAnalysis(false), IsAnalysisGroup(true), NormalCtor(nullptr),
TargetMachineCtor(nullptr) {}
/// getPassName - Return the friendly name for the pass, never returns null
///
@ -256,7 +256,7 @@ class RegisterAGBase : public PassInfo {
public:
RegisterAGBase(const char *Name,
const void *InterfaceID,
const void *PassID = 0,
const void *PassID = nullptr,
bool isDefault = false);
};

View File

@ -245,7 +245,7 @@ inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
template <class X, class Y>
LLVM_ATTRIBUTE_UNUSED_RESULT inline typename cast_retty<X, Y *>::ret_type
cast_or_null(Y *Val) {
if (Val == 0) return 0;
if (!Val) return nullptr;
assert(isa<X>(Val) && "cast_or_null<Ty>() argument of incompatible type!");
return cast<X>(Val);
}
@ -263,13 +263,13 @@ template <class X, class Y>
LLVM_ATTRIBUTE_UNUSED_RESULT inline typename std::enable_if<
!is_simple_type<Y>::value, typename cast_retty<X, const Y>::ret_type>::type
dyn_cast(const Y &Val) {
return isa<X>(Val) ? cast<X>(Val) : 0;
return isa<X>(Val) ? cast<X>(Val) : nullptr;
}
template <class X, class Y>
LLVM_ATTRIBUTE_UNUSED_RESULT inline typename cast_retty<X, Y>::ret_type
dyn_cast(Y &Val) {
return isa<X>(Val) ? cast<X>(Val) : 0;
return isa<X>(Val) ? cast<X>(Val) : nullptr;
}
template <class X, class Y>

View File

@ -186,9 +186,9 @@ class DominatorTreeBase : public DominatorBase<NodeT> {
assert(isReachableFromEntry(A));
const DomTreeNodeBase<NodeT> *IDom;
while ((IDom = B->getIDom()) != 0 && IDom != A && IDom != B)
while ((IDom = B->getIDom()) != nullptr && IDom != A && IDom != B)
B = IDom; // Walk up the tree
return IDom != 0;
return IDom != nullptr;
}
protected:
@ -205,7 +205,7 @@ protected:
unsigned Semi;
NodeT *Label;
InfoRec() : DFSNum(0), Parent(0), Semi(0), Label(0) {}
InfoRec() : DFSNum(0), Parent(0), Semi(0), Label(nullptr) {}
};
DenseMap<NodeT*, NodeT*> IDoms;
@ -224,7 +224,7 @@ protected:
IDoms.clear();
this->Roots.clear();
Vertex.clear();
RootNode = 0;
RootNode = nullptr;
}
// NewBB is split and now it has one successor. Update dominator tree to
@ -260,7 +260,7 @@ protected:
// Find NewBB's immediate dominator and create new dominator tree node for
// NewBB.
NodeT *NewBBIDom = 0;
NodeT *NewBBIDom = nullptr;
unsigned i = 0;
for (i = 0; i < PredBlocks.size(); ++i)
if (DT.isReachableFromEntry(PredBlocks[i])) {
@ -344,7 +344,7 @@ public:
void getDescendants(NodeT *R, SmallVectorImpl<NodeT *> &Result) const {
Result.clear();
const DomTreeNodeBase<NodeT> *RN = getNode(R);
if (RN == NULL)
if (!RN)
return; // If R is unreachable, it will not be present in the DOM tree.
SmallVector<const DomTreeNodeBase<NodeT> *, 8> WL;
WL.push_back(RN);
@ -361,7 +361,7 @@ public:
///
bool properlyDominates(const DomTreeNodeBase<NodeT> *A,
const DomTreeNodeBase<NodeT> *B) const {
if (A == 0 || B == 0)
if (!A || !B)
return false;
if (A == B)
return false;
@ -471,7 +471,7 @@ public:
IDomB = IDomB->getIDom();
}
return NULL;
return nullptr;
}
const NodeT *findNearestCommonDominator(const NodeT *A, const NodeT *B) {
@ -659,14 +659,14 @@ public:
void recalculate(FT& F) {
typedef GraphTraits<FT*> TraitsTy;
reset();
this->Vertex.push_back(0);
this->Vertex.push_back(nullptr);
if (!this->IsPostDominators) {
// Initialize root
NodeT *entry = TraitsTy::getEntryNode(&F);
this->Roots.push_back(entry);
this->IDoms[entry] = 0;
this->DomTreeNodes[entry] = 0;
this->IDoms[entry] = nullptr;
this->DomTreeNodes[entry] = nullptr;
Calculate<FT, NodeT*>(*this, F);
} else {
@ -677,8 +677,8 @@ public:
addRoot(I);
// Prepopulate maps so that we don't get iterator invalidation issues later.
this->IDoms[I] = 0;
this->DomTreeNodes[I] = 0;
this->IDoms[I] = nullptr;
this->DomTreeNodes[I] = nullptr;
}
Calculate<FT, Inverse<NodeT*> >(*this, F);

View File

@ -156,11 +156,11 @@ void Calculate(DominatorTreeBase<typename GraphTraits<NodeT>::NodeType>& DT,
bool MultipleRoots = (DT.Roots.size() > 1);
if (MultipleRoots) {
typename DominatorTreeBase<typename GraphT::NodeType>::InfoRec &BBInfo =
DT.Info[NULL];
DT.Info[nullptr];
BBInfo.DFSNum = BBInfo.Semi = ++N;
BBInfo.Label = NULL;
BBInfo.Label = nullptr;
DT.Vertex.push_back(NULL); // Vertex[n] = V;
DT.Vertex.push_back(nullptr); // Vertex[n] = V;
}
// Step #1: Number blocks in depth-first order and initialize variables used
@ -249,10 +249,10 @@ void Calculate(DominatorTreeBase<typename GraphTraits<NodeT>::NodeType>& DT,
// one exit block, or it may be the virtual exit (denoted by (BasicBlock *)0)
// which postdominates all real exits if there are multiple exit blocks, or
// an infinite loop.
typename GraphT::NodeType* Root = !MultipleRoots ? DT.Roots[0] : 0;
typename GraphT::NodeType* Root = !MultipleRoots ? DT.Roots[0] : nullptr;
DT.DomTreeNodes[Root] = DT.RootNode =
new DomTreeNodeBase<typename GraphT::NodeType>(Root, 0);
new DomTreeNodeBase<typename GraphT::NodeType>(Root, nullptr);
// Loop over all of the reachable blocks in the function...
for (unsigned i = 2; i <= N; ++i) {

View File

@ -51,19 +51,19 @@ AssemblyAnnotationWriter::~AssemblyAnnotationWriter() {}
static const Module *getModuleFromVal(const Value *V) {
if (const Argument *MA = dyn_cast<Argument>(V))
return MA->getParent() ? MA->getParent()->getParent() : 0;
return MA->getParent() ? MA->getParent()->getParent() : nullptr;
if (const BasicBlock *BB = dyn_cast<BasicBlock>(V))
return BB->getParent() ? BB->getParent()->getParent() : 0;
return BB->getParent() ? BB->getParent()->getParent() : nullptr;
if (const Instruction *I = dyn_cast<Instruction>(V)) {
const Function *M = I->getParent() ? I->getParent()->getParent() : 0;
return M ? M->getParent() : 0;
const Function *M = I->getParent() ? I->getParent()->getParent() : nullptr;
return M ? M->getParent() : nullptr;
}
if (const GlobalValue *GV = dyn_cast<GlobalValue>(V))
return GV->getParent();
return 0;
return nullptr;
}
static void PrintCallingConv(unsigned cc, raw_ostream &Out) {
@ -421,10 +421,10 @@ static SlotTracker *createSlotTracker(const Value *V) {
if (!MD->isFunctionLocal())
return new SlotTracker(MD->getFunction());
return new SlotTracker((Function *)0);
return new SlotTracker((Function *)nullptr);
}
return 0;
return nullptr;
}
#if 0
@ -436,21 +436,21 @@ static SlotTracker *createSlotTracker(const Value *V) {
// Module level constructor. Causes the contents of the Module (sans functions)
// to be added to the slot table.
SlotTracker::SlotTracker(const Module *M)
: TheModule(M), TheFunction(0), FunctionProcessed(false),
: TheModule(M), TheFunction(nullptr), FunctionProcessed(false),
mNext(0), fNext(0), mdnNext(0), asNext(0) {
}
// Function level constructor. Causes the contents of the Module and the one
// function provided to be added to the slot table.
SlotTracker::SlotTracker(const Function *F)
: TheModule(F ? F->getParent() : 0), TheFunction(F), FunctionProcessed(false),
mNext(0), fNext(0), mdnNext(0), asNext(0) {
: TheModule(F ? F->getParent() : nullptr), TheFunction(F),
FunctionProcessed(false), mNext(0), fNext(0), mdnNext(0), asNext(0) {
}
inline void SlotTracker::initialize() {
if (TheModule) {
processModule();
TheModule = 0; ///< Prevent re-processing next time we're called.
TheModule = nullptr; ///< Prevent re-processing next time we're called.
}
if (TheFunction && !FunctionProcessed)
@ -560,7 +560,7 @@ void SlotTracker::processFunction() {
void SlotTracker::purgeFunction() {
ST_DEBUG("begin purgeFunction!\n");
fMap.clear(); // Simply discard the function level map
TheFunction = 0;
TheFunction = nullptr;
FunctionProcessed = false;
ST_DEBUG("end purgeFunction!\n");
}
@ -1048,7 +1048,7 @@ static void WriteMDNodeBodyInternal(raw_ostream &Out, const MDNode *Node,
Out << "!{";
for (unsigned mi = 0, me = Node->getNumOperands(); mi != me; ++mi) {
const Value *V = Node->getOperand(mi);
if (V == 0)
if (!V)
Out << "null";
else {
TypePrinter->print(V->getType(), Out);
@ -1160,7 +1160,7 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Value *V,
Slot = Machine->getLocalSlot(V);
}
delete Machine;
Machine = 0;
Machine = nullptr;
} else {
Slot = -1;
}
@ -1194,7 +1194,7 @@ AssemblyWriter::AssemblyWriter(formatted_raw_ostream &o, const Module *M,
AssemblyWriter::~AssemblyWriter() { }
void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType) {
if (Operand == 0) {
if (!Operand) {
Out << "<null operand!>";
return;
}
@ -1259,7 +1259,7 @@ void AssemblyWriter::writeAtomicCmpXchg(AtomicOrdering SuccessOrdering,
void AssemblyWriter::writeParamOperand(const Value *Operand,
AttributeSet Attrs, unsigned Idx) {
if (Operand == 0) {
if (!Operand) {
Out << "<null operand!>";
return;
}
@ -1502,7 +1502,7 @@ void AssemblyWriter::printAlias(const GlobalAlias *GA) {
const Constant *Aliasee = GA->getAliasee();
if (Aliasee == 0) {
if (!Aliasee) {
TypePrinter.print(GA->getType(), Out);
Out << " <<NULL ALIASEE>>";
} else {
@ -1707,7 +1707,7 @@ void AssemblyWriter::printBasicBlock(const BasicBlock *BB) {
Out << "<badref>";
}
if (BB->getParent() == 0) {
if (!BB->getParent()) {
Out.PadToColumn(50);
Out << "; Error: Block without parent!";
} else if (BB != &BB->getParent()->getEntryBlock()) { // Not the entry block?
@ -1804,7 +1804,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
writeAtomicRMWOperation(Out, RMWI->getOperation());
// Print out the type of the operands...
const Value *Operand = I.getNumOperands() ? I.getOperand(0) : 0;
const Value *Operand = I.getNumOperands() ? I.getOperand(0) : nullptr;
// Special case conditional branches to swizzle the condition out to the front
if (isa<BranchInst>(I) && cast<BranchInst>(I).isConditional()) {
@ -2155,7 +2155,7 @@ void NamedMDNode::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const {
}
void Type::print(raw_ostream &OS) const {
if (this == 0) {
if (!this) {
OS << "<null Type>";
return;
}
@ -2220,7 +2220,7 @@ void Value::printAsOperand(raw_ostream &O, bool PrintType, const Module *M) cons
if (!PrintType &&
((!isa<Constant>(this) && !isa<MDNode>(this)) ||
hasName() || isa<GlobalValue>(this))) {
WriteAsOperandInternal(O, this, 0, 0, M);
WriteAsOperandInternal(O, this, nullptr, nullptr, M);
return;
}
@ -2235,7 +2235,7 @@ void Value::printAsOperand(raw_ostream &O, bool PrintType, const Module *M) cons
O << ' ';
}
WriteAsOperandInternal(O, this, &TypePrinter, 0, M);
WriteAsOperandInternal(O, this, &TypePrinter, nullptr, M);
}
// Value::printCustom - subclasses should override this to implement printing.
@ -2250,7 +2250,7 @@ void Value::dump() const { print(dbgs()); dbgs() << '\n'; }
void Type::dump() const { print(dbgs()); }
// Module::dump() - Allow printing of Modules from the debugger.
void Module::dump() const { print(dbgs(), 0); }
void Module::dump() const { print(dbgs(), nullptr); }
// NamedMDNode::dump() - Allow printing of NamedMDNodes from the debugger.
void NamedMDNode::dump() const { print(dbgs(), 0); }
void NamedMDNode::dump() const { print(dbgs(), nullptr); }

View File

@ -402,7 +402,7 @@ uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) {
AttributeSetNode *AttributeSetNode::get(LLVMContext &C,
ArrayRef<Attribute> Attrs) {
if (Attrs.empty())
return 0;
return nullptr;
// Otherwise, build a key to look up the existing attributes.
LLVMContextImpl *pImpl = C.pImpl;
@ -836,7 +836,7 @@ bool AttributeSet::hasAttributes(unsigned Index) const {
/// \brief Return true if the specified attribute is set for at least one
/// parameter or for the return value.
bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr) const {
if (pImpl == 0) return false;
if (!pImpl) return false;
for (unsigned I = 0, E = pImpl->getNumAttributes(); I != E; ++I)
for (AttributeSetImpl::iterator II = pImpl->begin(I),
@ -877,14 +877,14 @@ std::string AttributeSet::getAsString(unsigned Index,
/// \brief The attributes for the specified index are returned.
AttributeSetNode *AttributeSet::getAttributes(unsigned Index) const {
if (!pImpl) return 0;
if (!pImpl) return nullptr;
// Loop through to find the attribute node we want.
for (unsigned I = 0, E = pImpl->getNumAttributes(); I != E; ++I)
if (pImpl->getSlotIndex(I) == Index)
return pImpl->getSlotNode(I);
return 0;
return nullptr;
}
AttributeSet::iterator AttributeSet::begin(unsigned Slot) const {

View File

@ -115,7 +115,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
Name == "x86.avx.movnt.ps.256" ||
Name == "x86.sse42.crc32.64.8" ||
(Name.startswith("x86.xop.vpcom") && F->arg_size() == 2)) {
NewFn = 0;
NewFn = nullptr;
return true;
}
// SSE4.1 ptest functions may have an old signature.
@ -158,7 +158,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
}
bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn) {
NewFn = 0;
NewFn = nullptr;
bool Upgraded = UpgradeIntrinsicFunction1(F, NewFn);
// Upgrade intrinsic attributes. This does not change the function.
@ -453,9 +453,9 @@ void llvm::UpgradeInstWithTBAATag(Instruction *I) {
Instruction *llvm::UpgradeBitCastInst(unsigned Opc, Value *V, Type *DestTy,
Instruction *&Temp) {
if (Opc != Instruction::BitCast)
return 0;
return nullptr;
Temp = 0;
Temp = nullptr;
Type *SrcTy = V->getType();
if (SrcTy->isPtrOrPtrVectorTy() && DestTy->isPtrOrPtrVectorTy() &&
SrcTy->getPointerAddressSpace() != DestTy->getPointerAddressSpace()) {
@ -469,12 +469,12 @@ Instruction *llvm::UpgradeBitCastInst(unsigned Opc, Value *V, Type *DestTy,
return CastInst::Create(Instruction::IntToPtr, Temp, DestTy);
}
return 0;
return nullptr;
}
Value *llvm::UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy) {
if (Opc != Instruction::BitCast)
return 0;
return nullptr;
Type *SrcTy = C->getType();
if (SrcTy->isPtrOrPtrVectorTy() && DestTy->isPtrOrPtrVectorTy() &&
@ -489,7 +489,7 @@ Value *llvm::UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy) {
DestTy);
}
return 0;
return nullptr;
}
/// Check the debug info version number, if it is out-dated, drop the debug

View File

@ -27,7 +27,7 @@ using namespace llvm;
ValueSymbolTable *BasicBlock::getValueSymbolTable() {
if (Function *F = getParent())
return &F->getValueSymbolTable();
return 0;
return nullptr;
}
const DataLayout *BasicBlock::getDataLayout() const {
@ -45,7 +45,7 @@ template class llvm::SymbolTableListTraits<Instruction, BasicBlock>;
BasicBlock::BasicBlock(LLVMContext &C, const Twine &Name, Function *NewParent,
BasicBlock *InsertBefore)
: Value(Type::getLabelTy(C), Value::BasicBlockVal), Parent(0) {
: Value(Type::getLabelTy(C), Value::BasicBlockVal), Parent(nullptr) {
// Make sure that we get added to a function
LeakDetector::addGarbageObject(this);
@ -122,12 +122,12 @@ void BasicBlock::moveAfter(BasicBlock *MovePos) {
TerminatorInst *BasicBlock::getTerminator() {
if (InstList.empty()) return 0;
if (InstList.empty()) return nullptr;
return dyn_cast<TerminatorInst>(&InstList.back());
}
const TerminatorInst *BasicBlock::getTerminator() const {
if (InstList.empty()) return 0;
if (InstList.empty()) return nullptr;
return dyn_cast<TerminatorInst>(&InstList.back());
}
@ -186,10 +186,10 @@ void BasicBlock::dropAllReferences() {
/// return the block, otherwise return a null pointer.
BasicBlock *BasicBlock::getSinglePredecessor() {
pred_iterator PI = pred_begin(this), E = pred_end(this);
if (PI == E) return 0; // No preds.
if (PI == E) return nullptr; // No preds.
BasicBlock *ThePred = *PI;
++PI;
return (PI == E) ? ThePred : 0 /*multiple preds*/;
return (PI == E) ? ThePred : nullptr /*multiple preds*/;
}
/// getUniquePredecessor - If this basic block has a unique predecessor block,
@ -199,12 +199,12 @@ BasicBlock *BasicBlock::getSinglePredecessor() {
/// a switch statement with multiple cases having the same destination).
BasicBlock *BasicBlock::getUniquePredecessor() {
pred_iterator PI = pred_begin(this), E = pred_end(this);
if (PI == E) return 0; // No preds.
if (PI == E) return nullptr; // No preds.
BasicBlock *PredBB = *PI;
++PI;
for (;PI != E; ++PI) {
if (*PI != PredBB)
return 0;
return nullptr;
// The same predecessor appears multiple times in the predecessor list.
// This is OK.
}
@ -277,7 +277,7 @@ void BasicBlock::removePredecessor(BasicBlock *Pred,
PN->removeIncomingValue(Pred, false);
// If all incoming values to the Phi are the same, we can replace the Phi
// with that value.
Value* PNV = 0;
Value* PNV = nullptr;
if (!DontDeleteUselessPHIs && (PNV = PN->hasConstantValue()))
if (PNV != PN) {
PN->replaceAllUsesWith(PNV);

View File

@ -51,7 +51,7 @@ static Constant *BitCastConstantVector(Constant *CV, VectorType *DstTy) {
// Analysis/ConstantFolding.cpp
unsigned NumElts = DstTy->getNumElements();
if (NumElts != CV->getType()->getVectorNumElements())
return 0;
return nullptr;
Type *DstEltTy = DstTy->getElementType();
@ -94,7 +94,7 @@ foldConstantCastPair(
// Let CastInst::isEliminableCastPair do the heavy lifting.
return CastInst::isEliminableCastPair(firstOp, secondOp, SrcTy, MidTy, DstTy,
0, FakeIntPtrTy, 0);
nullptr, FakeIntPtrTy, nullptr);
}
static Constant *FoldBitCast(Constant *V, Type *DestTy) {
@ -139,7 +139,7 @@ static Constant *FoldBitCast(Constant *V, Type *DestTy) {
if (VectorType *SrcTy = dyn_cast<VectorType>(V->getType())) {
assert(DestPTy->getBitWidth() == SrcTy->getBitWidth() &&
"Not cast between same sized vectors!");
SrcTy = NULL;
SrcTy = nullptr;
// First, check for null. Undef is already handled.
if (isa<ConstantAggregateZero>(V))
return Constant::getNullValue(DestTy);
@ -173,7 +173,7 @@ static Constant *FoldBitCast(Constant *V, Type *DestTy) {
CI->getValue()));
// Otherwise, can't fold this (vector?)
return 0;
return nullptr;
}
// Handle ConstantFP input: FP -> Integral.
@ -181,7 +181,7 @@ static Constant *FoldBitCast(Constant *V, Type *DestTy) {
return ConstantInt::get(FP->getContext(),
FP->getValueAPF().bitcastToAPInt());
return 0;
return nullptr;
}
@ -216,14 +216,14 @@ static Constant *ExtractConstantBytes(Constant *C, unsigned ByteStart,
// In the input is a constant expr, we might be able to recursively simplify.
// If not, we definitely can't do anything.
ConstantExpr *CE = dyn_cast<ConstantExpr>(C);
if (CE == 0) return 0;
if (!CE) return nullptr;
switch (CE->getOpcode()) {
default: return 0;
default: return nullptr;
case Instruction::Or: {
Constant *RHS = ExtractConstantBytes(CE->getOperand(1), ByteStart,ByteSize);
if (RHS == 0)
return 0;
if (!RHS)
return nullptr;
// X | -1 -> -1.
if (ConstantInt *RHSC = dyn_cast<ConstantInt>(RHS))
@ -231,32 +231,32 @@ static Constant *ExtractConstantBytes(Constant *C, unsigned ByteStart,
return RHSC;
Constant *LHS = ExtractConstantBytes(CE->getOperand(0), ByteStart,ByteSize);
if (LHS == 0)
return 0;
if (!LHS)
return nullptr;
return ConstantExpr::getOr(LHS, RHS);
}
case Instruction::And: {
Constant *RHS = ExtractConstantBytes(CE->getOperand(1), ByteStart,ByteSize);
if (RHS == 0)
return 0;
if (!RHS)
return nullptr;
// X & 0 -> 0.
if (RHS->isNullValue())
return RHS;
Constant *LHS = ExtractConstantBytes(CE->getOperand(0), ByteStart,ByteSize);
if (LHS == 0)
return 0;
if (!LHS)
return nullptr;
return ConstantExpr::getAnd(LHS, RHS);
}
case Instruction::LShr: {
ConstantInt *Amt = dyn_cast<ConstantInt>(CE->getOperand(1));
if (Amt == 0)
return 0;
if (!Amt)
return nullptr;
unsigned ShAmt = Amt->getZExtValue();
// Cannot analyze non-byte shifts.
if ((ShAmt & 7) != 0)
return 0;
return nullptr;
ShAmt >>= 3;
// If the extract is known to be all zeros, return zero.
@ -268,17 +268,17 @@ static Constant *ExtractConstantBytes(Constant *C, unsigned ByteStart,
return ExtractConstantBytes(CE->getOperand(0), ByteStart+ShAmt, ByteSize);
// TODO: Handle the 'partially zero' case.
return 0;
return nullptr;
}
case Instruction::Shl: {
ConstantInt *Amt = dyn_cast<ConstantInt>(CE->getOperand(1));
if (Amt == 0)
return 0;
if (!Amt)
return nullptr;
unsigned ShAmt = Amt->getZExtValue();
// Cannot analyze non-byte shifts.
if ((ShAmt & 7) != 0)
return 0;
return nullptr;
ShAmt >>= 3;
// If the extract is known to be all zeros, return zero.
@ -290,7 +290,7 @@ static Constant *ExtractConstantBytes(Constant *C, unsigned ByteStart,
return ExtractConstantBytes(CE->getOperand(0), ByteStart-ShAmt, ByteSize);
// TODO: Handle the 'partially zero' case.
return 0;
return nullptr;
}
case Instruction::ZExt: {
@ -324,7 +324,7 @@ static Constant *ExtractConstantBytes(Constant *C, unsigned ByteStart,
}
// TODO: Handle the 'partially zero' case.
return 0;
return nullptr;
}
}
}
@ -376,7 +376,7 @@ static Constant *getFoldedSizeOf(Type *Ty, Type *DestTy,
// If there's no interesting folding happening, bail so that we don't create
// a constant that looks like it needs folding but really doesn't.
if (!Folded)
return 0;
return nullptr;
// Base case: Get a regular sizeof expression.
Constant *C = ConstantExpr::getSizeOf(Ty);
@ -442,7 +442,7 @@ static Constant *getFoldedAlignOf(Type *Ty, Type *DestTy,
// If there's no interesting folding happening, bail so that we don't create
// a constant that looks like it needs folding but really doesn't.
if (!Folded)
return 0;
return nullptr;
// Base case: Get a regular alignof expression.
Constant *C = ConstantExpr::getAlignOf(Ty);
@ -473,7 +473,7 @@ static Constant *getFoldedOffsetOf(Type *Ty, Constant *FieldNo,
unsigned NumElems = STy->getNumElements();
// An empty struct has no members.
if (NumElems == 0)
return 0;
return nullptr;
// Check for a struct with all members having the same size.
Constant *MemberSize =
getFoldedSizeOf(STy->getElementType(0), DestTy, true);
@ -497,7 +497,7 @@ static Constant *getFoldedOffsetOf(Type *Ty, Constant *FieldNo,
// If there's no interesting folding happening, bail so that we don't create
// a constant that looks like it needs folding but really doesn't.
if (!Folded)
return 0;
return nullptr;
// Base case: Get a regular offsetof expression.
Constant *C = ConstantExpr::getOffsetOf(Ty, FieldNo);
@ -582,7 +582,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
APFloat::rmNearestTiesToEven, &ignored);
return ConstantFP::get(V->getContext(), Val);
}
return 0; // Can't fold.
return nullptr; // Can't fold.
case Instruction::FPToUI:
case Instruction::FPToSI:
if (ConstantFP *FPC = dyn_cast<ConstantFP>(V)) {
@ -595,11 +595,11 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
APInt Val(DestBitWidth, x);
return ConstantInt::get(FPC->getContext(), Val);
}
return 0; // Can't fold.
return nullptr; // Can't fold.
case Instruction::IntToPtr: //always treated as unsigned
if (V->isNullValue()) // Is it an integral null value?
return ConstantPointerNull::get(cast<PointerType>(DestTy));
return 0; // Other pointer types cannot be casted
return nullptr; // Other pointer types cannot be casted
case Instruction::PtrToInt: // always treated as unsigned
// Is it a null pointer value?
if (V->isNullValue())
@ -643,7 +643,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
}
}
// Other pointer types cannot be casted
return 0;
return nullptr;
case Instruction::UIToFP:
case Instruction::SIToFP:
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
@ -655,21 +655,21 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
APFloat::rmNearestTiesToEven);
return ConstantFP::get(V->getContext(), apf);
}
return 0;
return nullptr;
case Instruction::ZExt:
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
uint32_t BitWidth = cast<IntegerType>(DestTy)->getBitWidth();
return ConstantInt::get(V->getContext(),
CI->getValue().zext(BitWidth));
}
return 0;
return nullptr;
case Instruction::SExt:
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
uint32_t BitWidth = cast<IntegerType>(DestTy)->getBitWidth();
return ConstantInt::get(V->getContext(),
CI->getValue().sext(BitWidth));
}
return 0;
return nullptr;
case Instruction::Trunc: {
uint32_t DestBitWidth = cast<IntegerType>(DestTy)->getBitWidth();
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
@ -685,12 +685,12 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
if (Constant *Res = ExtractConstantBytes(V, 0, DestBitWidth / 8))
return Res;
return 0;
return nullptr;
}
case Instruction::BitCast:
return FoldBitCast(V, DestTy);
case Instruction::AddrSpaceCast:
return 0;
return nullptr;
}
}
@ -746,7 +746,7 @@ Constant *llvm::ConstantFoldSelectInstruction(Constant *Cond,
return ConstantExpr::getSelect(Cond, V1, FalseVal->getOperand(2));
}
return 0;
return nullptr;
}
Constant *llvm::ConstantFoldExtractElementInstruction(Constant *Val,
@ -766,14 +766,14 @@ Constant *llvm::ConstantFoldExtractElementInstruction(Constant *Val,
return UndefValue::get(Val->getType()->getVectorElementType());
return Val->getAggregateElement(Index);
}
return 0;
return nullptr;
}
Constant *llvm::ConstantFoldInsertElementInstruction(Constant *Val,
Constant *Elt,
Constant *Idx) {
ConstantInt *CIdx = dyn_cast<ConstantInt>(Idx);
if (!CIdx) return 0;
if (!CIdx) return nullptr;
const APInt &IdxVal = CIdx->getValue();
SmallVector<Constant*, 16> Result;
@ -803,7 +803,7 @@ Constant *llvm::ConstantFoldShuffleVectorInstruction(Constant *V1,
return UndefValue::get(VectorType::get(EltTy, MaskNumElts));
// Don't break the bitcode reader hack.
if (isa<ConstantExpr>(Mask)) return 0;
if (isa<ConstantExpr>(Mask)) return nullptr;
unsigned SrcNumElts = V1->getType()->getVectorNumElements();
@ -842,7 +842,7 @@ Constant *llvm::ConstantFoldExtractValueInstruction(Constant *Agg,
if (Constant *C = Agg->getAggregateElement(Idxs[0]))
return ConstantFoldExtractValueInstruction(C, Idxs.slice(1));
return 0;
return nullptr;
}
Constant *llvm::ConstantFoldInsertValueInstruction(Constant *Agg,
@ -863,8 +863,8 @@ Constant *llvm::ConstantFoldInsertValueInstruction(Constant *Agg,
SmallVector<Constant*, 32> Result;
for (unsigned i = 0; i != NumElts; ++i) {
Constant *C = Agg->getAggregateElement(i);
if (C == 0) return 0;
if (!C) return nullptr;
if (Idxs[0] == i)
C = ConstantFoldInsertValueInstruction(C, Val, Idxs.slice(1));
@ -1209,7 +1209,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
}
// We don't know how to fold this.
return 0;
return nullptr;
}
/// isZeroSizedType - This type is zero sized if its an array or structure of
@ -1289,7 +1289,7 @@ static FCmpInst::Predicate evaluateFCmpRelation(Constant *V1, Constant *V2) {
if (!isa<ConstantExpr>(V1)) {
if (!isa<ConstantExpr>(V2)) {
// We distilled thisUse the standard constant folder for a few cases
ConstantInt *R = 0;
ConstantInt *R = nullptr;
R = dyn_cast<ConstantInt>(
ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ, V1, V2));
if (R && !R->isZero())
@ -1355,7 +1355,7 @@ static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2,
!isa<BlockAddress>(V2)) {
// We distilled this down to a simple case, use the standard constant
// folder.
ConstantInt *R = 0;
ConstantInt *R = nullptr;
ICmpInst::Predicate pred = ICmpInst::ICMP_EQ;
R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, V1, V2));
if (R && !R->isZero())
@ -1885,7 +1885,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
return ConstantExpr::getICmp(pred, C2, C1);
}
}
return 0;
return nullptr;
}
/// isInBoundsIndices - Test whether the given sequence of *normalized* indices
@ -1977,7 +1977,7 @@ static Constant *ConstantFoldGetElementPtrImpl(Constant *C,
// getelementptr instructions into a single instruction.
//
if (CE->getOpcode() == Instruction::GetElementPtr) {
Type *LastTy = 0;
Type *LastTy = nullptr;
for (gep_type_iterator I = gep_type_begin(CE), E = gep_type_end(CE);
I != E; ++I)
LastTy = *I;
@ -2072,7 +2072,7 @@ static Constant *ConstantFoldGetElementPtrImpl(Constant *C,
bool Unknown = false;
SmallVector<Constant *, 8> NewIdxs;
Type *Ty = C->getType();
Type *Prev = 0;
Type *Prev = nullptr;
for (unsigned i = 0, e = Idxs.size(); i != e;
Prev = Ty, Ty = cast<CompositeType>(Ty)->getTypeAtIndex(Idxs[i]), ++i) {
if (ConstantInt *CI = dyn_cast<ConstantInt>(Idxs[i])) {
@ -2130,7 +2130,7 @@ static Constant *ConstantFoldGetElementPtrImpl(Constant *C,
isa<GlobalVariable>(C) && isInBoundsIndices(Idxs))
return ConstantExpr::getInBoundsGetElementPtr(C, Idxs);
return 0;
return nullptr;
}
Constant *llvm::ConstantFoldGetElementPtr(Constant *C,

View File

@ -182,13 +182,13 @@ Constant *Constant::getAllOnesValue(Type *Ty) {
/// 'this' is a constant expr.
Constant *Constant::getAggregateElement(unsigned Elt) const {
if (const ConstantStruct *CS = dyn_cast<ConstantStruct>(this))
return Elt < CS->getNumOperands() ? CS->getOperand(Elt) : 0;
return Elt < CS->getNumOperands() ? CS->getOperand(Elt) : nullptr;
if (const ConstantArray *CA = dyn_cast<ConstantArray>(this))
return Elt < CA->getNumOperands() ? CA->getOperand(Elt) : 0;
return Elt < CA->getNumOperands() ? CA->getOperand(Elt) : nullptr;
if (const ConstantVector *CV = dyn_cast<ConstantVector>(this))
return Elt < CV->getNumOperands() ? CV->getOperand(Elt) : 0;
return Elt < CV->getNumOperands() ? CV->getOperand(Elt) : nullptr;
if (const ConstantAggregateZero *CAZ =dyn_cast<ConstantAggregateZero>(this))
return CAZ->getElementValue(Elt);
@ -197,15 +197,16 @@ Constant *Constant::getAggregateElement(unsigned Elt) const {
return UV->getElementValue(Elt);
if (const ConstantDataSequential *CDS =dyn_cast<ConstantDataSequential>(this))
return Elt < CDS->getNumElements() ? CDS->getElementAsConstant(Elt) : 0;
return 0;
return Elt < CDS->getNumElements() ? CDS->getElementAsConstant(Elt)
: nullptr;
return nullptr;
}
Constant *Constant::getAggregateElement(Constant *Elt) const {
assert(isa<IntegerType>(Elt->getType()) && "Index must be an integer");
if (ConstantInt *CI = dyn_cast<ConstantInt>(Elt))
return getAggregateElement(CI->getZExtValue());
return 0;
return nullptr;
}
@ -309,7 +310,7 @@ bool Constant::isThreadDependent() const {
bool Constant::isConstantUsed() const {
for (const User *U : users()) {
const Constant *UC = dyn_cast<Constant>(U);
if (UC == 0 || isa<GlobalValue>(UC))
if (!UC || isa<GlobalValue>(UC))
return true;
if (UC->isConstantUsed())
@ -397,7 +398,7 @@ void Constant::removeDeadConstantUsers() const {
Value::const_user_iterator LastNonDeadUser = E;
while (I != E) {
const Constant *User = dyn_cast<Constant>(*I);
if (User == 0) {
if (!User) {
LastNonDeadUser = I;
++I;
continue;
@ -431,7 +432,7 @@ void Constant::removeDeadConstantUsers() const {
void ConstantInt::anchor() { }
ConstantInt::ConstantInt(IntegerType *Ty, const APInt& V)
: Constant(Ty, ConstantIntVal, 0, 0), Val(V) {
: Constant(Ty, ConstantIntVal, nullptr, 0), Val(V) {
assert(V.getBitWidth() == Ty->getBitWidth() && "Invalid constant for type");
}
@ -644,7 +645,7 @@ Constant *ConstantFP::getInfinity(Type *Ty, bool Negative) {
}
ConstantFP::ConstantFP(Type *Ty, const APFloat& V)
: Constant(Ty, ConstantFPVal, 0, 0), Val(V) {
: Constant(Ty, ConstantFPVal, nullptr, 0), Val(V) {
assert(&V.getSemantics() == TypeToFloatSemantics(Ty) &&
"FP type Mismatch");
}
@ -1235,7 +1236,7 @@ ConstantAggregateZero *ConstantAggregateZero::get(Type *Ty) {
"Cannot create an aggregate zero of non-aggregate type!");
ConstantAggregateZero *&Entry = Ty->getContext().pImpl->CAZConstants[Ty];
if (Entry == 0)
if (!Entry)
Entry = new ConstantAggregateZero(Ty);
return Entry;
@ -1283,7 +1284,7 @@ Constant *Constant::getSplatValue() const {
return CV->getSplatValue();
if (const ConstantVector *CV = dyn_cast<ConstantVector>(this))
return CV->getSplatValue();
return 0;
return nullptr;
}
/// getSplatValue - If this is a splat constant, where all of the
@ -1294,7 +1295,7 @@ Constant *ConstantVector::getSplatValue() const {
// Then make sure all remaining elements point to the same value.
for (unsigned I = 1, E = getNumOperands(); I < E; ++I)
if (getOperand(I) != Elt)
return 0;
return nullptr;
return Elt;
}
@ -1315,7 +1316,7 @@ const APInt &Constant::getUniqueInteger() const {
ConstantPointerNull *ConstantPointerNull::get(PointerType *Ty) {
ConstantPointerNull *&Entry = Ty->getContext().pImpl->CPNConstants[Ty];
if (Entry == 0)
if (!Entry)
Entry = new ConstantPointerNull(Ty);
return Entry;
@ -1335,7 +1336,7 @@ void ConstantPointerNull::destroyConstant() {
UndefValue *UndefValue::get(Type *Ty) {
UndefValue *&Entry = Ty->getContext().pImpl->UVConstants[Ty];
if (Entry == 0)
if (!Entry)
Entry = new UndefValue(Ty);
return Entry;
@ -1360,7 +1361,7 @@ BlockAddress *BlockAddress::get(BasicBlock *BB) {
BlockAddress *BlockAddress::get(Function *F, BasicBlock *BB) {
BlockAddress *&BA =
F->getContext().pImpl->BlockAddresses[std::make_pair(F, BB)];
if (BA == 0)
if (!BA)
BA = new BlockAddress(F, BB);
assert(BA->getFunction() == F && "Basic block moved between functions");
@ -1377,7 +1378,7 @@ BlockAddress::BlockAddress(Function *F, BasicBlock *BB)
BlockAddress *BlockAddress::lookup(const BasicBlock *BB) {
if (!BB->hasAddressTaken())
return 0;
return nullptr;
const Function *F = BB->getParent();
assert(F != 0 && "Block must have a parent");
@ -1411,7 +1412,7 @@ void BlockAddress::replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) {
// and return early.
BlockAddress *&NewBA =
getContext().pImpl->BlockAddresses[std::make_pair(NewF, NewBB)];
if (NewBA == 0) {
if (!NewBA) {
getBasicBlock()->AdjustBlockAddressRefCount(-1);
// Remove the old entry, this can't cause the map to rehash (just a
@ -2145,7 +2146,7 @@ Constant *ConstantExpr::getBinOpIdentity(unsigned Opcode, Type *Ty) {
switch (Opcode) {
default:
// Doesn't have an identity.
return 0;
return nullptr;
case Instruction::Add:
case Instruction::Or:
@ -2168,7 +2169,7 @@ Constant *ConstantExpr::getBinOpAbsorber(unsigned Opcode, Type *Ty) {
switch (Opcode) {
default:
// Doesn't have an absorber.
return 0;
return nullptr;
case Instruction::Or:
return Constant::getAllOnesValue(Ty);
@ -2285,7 +2286,7 @@ Constant *ConstantDataSequential::getImpl(StringRef Elements, Type *Ty) {
// of i8, or a 1-element array of i32. They'll both end up in the same
/// StringMap bucket, linked up by their Next pointers. Walk the list.
ConstantDataSequential **Entry = &Slot.getValue();
for (ConstantDataSequential *Node = *Entry; Node != 0;
for (ConstantDataSequential *Node = *Entry; Node;
Entry = &Node->Next, Node = *Entry)
if (Node->getType() == Ty)
return Node;
@ -2312,7 +2313,7 @@ void ConstantDataSequential::destroyConstant() {
ConstantDataSequential **Entry = &Slot->getValue();
// Remove the entry from the hash table.
if ((*Entry)->Next == 0) {
if (!(*Entry)->Next) {
// If there is only one value in the bucket (common case) it must be this
// entry, and removing the entry should remove the bucket completely.
assert((*Entry) == this && "Hash mismatch in ConstantDataSequential");
@ -2333,7 +2334,7 @@ void ConstantDataSequential::destroyConstant() {
// If we were part of a list, make sure that we don't delete the list that is
// still owned by the uniquing map.
Next = 0;
Next = nullptr;
// Finally, actually delete it.
destroyConstantImpl();
@ -2561,7 +2562,7 @@ Constant *ConstantDataVector::getSplatValue() const {
unsigned EltSize = getElementByteSize();
for (unsigned i = 1, e = getNumElements(); i != e; ++i)
if (memcmp(Base, Base+i*EltSize, EltSize))
return 0;
return nullptr;
// If they're all the same, return the 0th one as a representative.
return getElementAsConstant(0);
@ -2609,7 +2610,7 @@ void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To,
AllSame &= Val == ToC;
}
Constant *Replacement = 0;
Constant *Replacement = nullptr;
if (AllSame && ToC->isNullValue()) {
Replacement = ConstantAggregateZero::get(getType());
} else if (AllSame && isa<UndefValue>(ToC)) {
@ -2695,7 +2696,7 @@ void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To,
LLVMContextImpl *pImpl = getContext().pImpl;
Constant *Replacement = 0;
Constant *Replacement = nullptr;
if (isAllZeros) {
Replacement = ConstantAggregateZero::get(getType());
} else if (isAllUndef) {

View File

@ -136,7 +136,7 @@ LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename,
return true;
}
unwrap(M)->print(dest, NULL);
unwrap(M)->print(dest, nullptr);
if (!error.empty()) {
*ErrorMessage = strdup(error.c_str());
@ -150,7 +150,7 @@ char *LLVMPrintModuleToString(LLVMModuleRef M) {
std::string buf;
raw_string_ostream os(buf);
unwrap(M)->print(os, NULL);
unwrap(M)->print(os, nullptr);
os.flush();
return strdup(buf.c_str());
@ -374,7 +374,7 @@ const char *LLVMGetStructName(LLVMTypeRef Ty)
{
StructType *Type = unwrap<StructType>(Ty);
if (!Type->hasName())
return 0;
return nullptr;
return Type->getName().data();
}
@ -496,7 +496,8 @@ LLVMValueRef LLVMGetMetadata(LLVMValueRef Inst, unsigned KindID) {
}
void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef MD) {
unwrap<Instruction>(Inst)->setMetadata(KindID, MD? unwrap<MDNode>(MD) : NULL);
unwrap<Instruction>(Inst)->setMetadata(KindID,
MD ? unwrap<MDNode>(MD) : nullptr);
}
/*--.. Conversion functions ................................................--*/
@ -513,7 +514,7 @@ LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val) {
Value *V = unwrap(Val);
Value::use_iterator I = V->use_begin();
if (I == V->use_end())
return 0;
return nullptr;
return wrap(&*I);
}
@ -521,7 +522,7 @@ LLVMUseRef LLVMGetNextUse(LLVMUseRef U) {
Use *Next = unwrap(U)->getNext();
if (Next)
return wrap(Next);
return 0;
return nullptr;
}
LLVMValueRef LLVMGetUser(LLVMUseRef U) {
@ -611,7 +612,7 @@ const char *LLVMGetMDString(LLVMValueRef V, unsigned* Len) {
return S->getString().data();
}
*Len = 0;
return 0;
return nullptr;
}
unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V)
@ -650,7 +651,7 @@ void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char* name,
NamedMDNode *N = unwrap(M)->getOrInsertNamedMetadata(name);
if (!N)
return;
MDNode *Op = Val ? unwrap<MDNode>(Val) : NULL;
MDNode *Op = Val ? unwrap<MDNode>(Val) : nullptr;
if (Op)
N->addOperand(Op);
}
@ -1302,15 +1303,16 @@ void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes) {
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name) {
return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
GlobalValue::ExternalLinkage, 0, Name));
GlobalValue::ExternalLinkage, nullptr, Name));
}
LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty,
const char *Name,
unsigned AddressSpace) {
return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
GlobalValue::ExternalLinkage, 0, Name, 0,
GlobalVariable::NotThreadLocal, AddressSpace));
GlobalValue::ExternalLinkage, nullptr, Name,
nullptr, GlobalVariable::NotThreadLocal,
AddressSpace));
}
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name) {
@ -1321,7 +1323,7 @@ LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M) {
Module *Mod = unwrap(M);
Module::global_iterator I = Mod->global_begin();
if (I == Mod->global_end())
return 0;
return nullptr;
return wrap(I);
}
@ -1329,7 +1331,7 @@ LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M) {
Module *Mod = unwrap(M);
Module::global_iterator I = Mod->global_end();
if (I == Mod->global_begin())
return 0;
return nullptr;
return wrap(--I);
}
@ -1337,7 +1339,7 @@ LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar) {
GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
Module::global_iterator I = GV;
if (++I == GV->getParent()->global_end())
return 0;
return nullptr;
return wrap(I);
}
@ -1345,7 +1347,7 @@ LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar) {
GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar);
Module::global_iterator I = GV;
if (I == GV->getParent()->global_begin())
return 0;
return nullptr;
return wrap(--I);
}
@ -1356,7 +1358,7 @@ void LLVMDeleteGlobal(LLVMValueRef GlobalVar) {
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar) {
GlobalVariable* GV = unwrap<GlobalVariable>(GlobalVar);
if ( !GV->hasInitializer() )
return 0;
return nullptr;
return wrap(GV->getInitializer());
}
@ -1452,7 +1454,7 @@ LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M) {
Module *Mod = unwrap(M);
Module::iterator I = Mod->begin();
if (I == Mod->end())
return 0;
return nullptr;
return wrap(I);
}
@ -1460,7 +1462,7 @@ LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M) {
Module *Mod = unwrap(M);
Module::iterator I = Mod->end();
if (I == Mod->begin())
return 0;
return nullptr;
return wrap(--I);
}
@ -1468,7 +1470,7 @@ LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn) {
Function *Func = unwrap<Function>(Fn);
Module::iterator I = Func;
if (++I == Func->getParent()->end())
return 0;
return nullptr;
return wrap(I);
}
@ -1476,7 +1478,7 @@ LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn) {
Function *Func = unwrap<Function>(Fn);
Module::iterator I = Func;
if (I == Func->getParent()->begin())
return 0;
return nullptr;
return wrap(--I);
}
@ -1501,7 +1503,7 @@ void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC) {
const char *LLVMGetGC(LLVMValueRef Fn) {
Function *F = unwrap<Function>(Fn);
return F->hasGC()? F->getGC() : 0;
return F->hasGC()? F->getGC() : nullptr;
}
void LLVMSetGC(LLVMValueRef Fn, const char *GC) {
@ -1582,7 +1584,7 @@ LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn) {
Function *Func = unwrap<Function>(Fn);
Function::arg_iterator I = Func->arg_begin();
if (I == Func->arg_end())
return 0;
return nullptr;
return wrap(I);
}
@ -1590,7 +1592,7 @@ LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn) {
Function *Func = unwrap<Function>(Fn);
Function::arg_iterator I = Func->arg_end();
if (I == Func->arg_begin())
return 0;
return nullptr;
return wrap(--I);
}
@ -1598,7 +1600,7 @@ LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg) {
Argument *A = unwrap<Argument>(Arg);
Function::arg_iterator I = A;
if (++I == A->getParent()->arg_end())
return 0;
return nullptr;
return wrap(I);
}
@ -1606,7 +1608,7 @@ LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg) {
Argument *A = unwrap<Argument>(Arg);
Function::arg_iterator I = A;
if (I == A->getParent()->arg_begin())
return 0;
return nullptr;
return wrap(--I);
}
@ -1676,7 +1678,7 @@ LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn) {
Function *Func = unwrap<Function>(Fn);
Function::iterator I = Func->begin();
if (I == Func->end())
return 0;
return nullptr;
return wrap(I);
}
@ -1684,7 +1686,7 @@ LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn) {
Function *Func = unwrap<Function>(Fn);
Function::iterator I = Func->end();
if (I == Func->begin())
return 0;
return nullptr;
return wrap(--I);
}
@ -1692,7 +1694,7 @@ LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB) {
BasicBlock *Block = unwrap(BB);
Function::iterator I = Block;
if (++I == Block->getParent()->end())
return 0;
return nullptr;
return wrap(I);
}
@ -1700,7 +1702,7 @@ LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB) {
BasicBlock *Block = unwrap(BB);
Function::iterator I = Block;
if (I == Block->getParent()->begin())
return 0;
return nullptr;
return wrap(--I);
}
@ -1752,7 +1754,7 @@ LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB) {
BasicBlock *Block = unwrap(BB);
BasicBlock::iterator I = Block->begin();
if (I == Block->end())
return 0;
return nullptr;
return wrap(I);
}
@ -1760,7 +1762,7 @@ LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB) {
BasicBlock *Block = unwrap(BB);
BasicBlock::iterator I = Block->end();
if (I == Block->begin())
return 0;
return nullptr;
return wrap(--I);
}
@ -1768,7 +1770,7 @@ LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst) {
Instruction *Instr = unwrap<Instruction>(Inst);
BasicBlock::iterator I = Instr;
if (++I == Instr->getParent()->end())
return 0;
return nullptr;
return wrap(I);
}
@ -1776,7 +1778,7 @@ LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst) {
Instruction *Instr = unwrap<Instruction>(Inst);
BasicBlock::iterator I = Instr;
if (I == Instr->getParent()->begin())
return 0;
return nullptr;
return wrap(--I);
}
@ -1939,7 +1941,7 @@ void LLVMDisposeBuilder(LLVMBuilderRef Builder) {
/*--.. Metadata builders ...................................................--*/
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L) {
MDNode *Loc = L ? unwrap<MDNode>(L) : NULL;
MDNode *Loc = L ? unwrap<MDNode>(L) : nullptr;
unwrap(Builder)->SetCurrentDebugLocation(DebugLoc::getFromDILocation(Loc));
}
@ -2195,7 +2197,7 @@ LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty,
AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy);
Instruction* Malloc = CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(),
ITy, unwrap(Ty), AllocSize,
0, 0, "");
nullptr, nullptr, "");
return wrap(unwrap(B)->Insert(Malloc, Twine(Name)));
}
@ -2206,13 +2208,13 @@ LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef B, LLVMTypeRef Ty,
AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy);
Instruction* Malloc = CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(),
ITy, unwrap(Ty), AllocSize,
unwrap(Val), 0, "");
unwrap(Val), nullptr, "");
return wrap(unwrap(B)->Insert(Malloc, Twine(Name)));
}
LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef B, LLVMTypeRef Ty,
const char *Name) {
return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), 0, Name));
return wrap(unwrap(B)->CreateAlloca(unwrap(Ty), nullptr, Name));
}
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef B, LLVMTypeRef Ty,

View File

@ -30,8 +30,9 @@ static Constant *GetTagConstant(LLVMContext &VMContext, unsigned Tag) {
}
DIBuilder::DIBuilder(Module &m)
: M(m), VMContext(M.getContext()), TempEnumTypes(0), TempRetainTypes(0),
TempSubprograms(0), TempGVs(0), DeclareFn(0), ValueFn(0) {}
: M(m), VMContext(M.getContext()), TempEnumTypes(nullptr),
TempRetainTypes(nullptr), TempSubprograms(nullptr), TempGVs(nullptr),
DeclareFn(nullptr), ValueFn(nullptr) {}
/// finalize - Construct any deferred debug info descriptors.
void DIBuilder::finalize() {
@ -80,7 +81,7 @@ void DIBuilder::finalize() {
/// N.
static MDNode *getNonCompileUnitScope(MDNode *N) {
if (DIDescriptor(N).isCompileUnit())
return NULL;
return nullptr;
return N;
}
@ -231,8 +232,8 @@ DIBasicType DIBuilder::createUnspecifiedType(StringRef Name) {
// size, alignment, offset and flags are always empty here.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_unspecified_type),
NULL, // Filename
NULL, // Unused
nullptr, // Filename
nullptr, // Unused
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
@ -259,8 +260,8 @@ DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits,
// offset and flags are always empty here.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_base_type),
NULL, // File/directory name
NULL, // Unused
nullptr, // File/directory name
nullptr, // Unused
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
@ -278,8 +279,8 @@ DIDerivedType DIBuilder::createQualifiedType(unsigned Tag, DIType FromTy) {
// Qualified types are encoded in DIDerivedType format.
Value *Elts[] = {
GetTagConstant(VMContext, Tag),
NULL, // Filename
NULL, // Unused
nullptr, // Filename
nullptr, // Unused
MDString::get(VMContext, StringRef()), // Empty name.
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
@ -298,8 +299,8 @@ DIBuilder::createPointerType(DIType PointeeTy, uint64_t SizeInBits,
// Pointer types are encoded in DIDerivedType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_pointer_type),
NULL, // Filename
NULL, // Unused
nullptr, // Filename
nullptr, // Unused
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
@ -316,9 +317,9 @@ DIDerivedType DIBuilder::createMemberPointerType(DIType PointeeTy,
// Pointer types are encoded in DIDerivedType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_ptr_to_member_type),
NULL, // Filename
NULL, // Unused
NULL,
nullptr, // Filename
nullptr, // Unused
nullptr,
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
@ -337,9 +338,9 @@ DIDerivedType DIBuilder::createReferenceType(unsigned Tag, DIType RTy) {
// References are encoded in DIDerivedType format.
Value *Elts[] = {
GetTagConstant(VMContext, Tag),
NULL, // Filename
NULL, // TheCU,
NULL, // Name
nullptr, // Filename
nullptr, // TheCU,
nullptr, // Name
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
@ -377,9 +378,9 @@ DIDerivedType DIBuilder::createFriend(DIType Ty, DIType FriendTy) {
assert(FriendTy.isType() && "Invalid friend type!");
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_friend),
NULL,
nullptr,
Ty.getRef(),
NULL, // Name
nullptr, // Name
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
@ -399,9 +400,9 @@ DIDerivedType DIBuilder::createInheritance(DIType Ty, DIType BaseTy,
// TAG_inheritance is encoded in DIDerivedType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_inheritance),
NULL,
nullptr,
Ty.getRef(),
NULL, // Name
nullptr, // Name
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
@ -630,7 +631,8 @@ DICompositeType DIBuilder::createClassType(DIDescriptor Context, StringRef Name,
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
VTableHolder.getRef(),
TemplateParams,
UniqueIdentifier.empty() ? NULL : MDString::get(VMContext, UniqueIdentifier)
UniqueIdentifier.empty() ? nullptr
: MDString::get(VMContext, UniqueIdentifier)
};
DICompositeType R(MDNode::get(VMContext, Elts));
assert(R.isCompositeType() &&
@ -666,8 +668,9 @@ DICompositeType DIBuilder::createStructType(DIDescriptor Context,
Elements,
ConstantInt::get(Type::getInt32Ty(VMContext), RunTimeLang),
VTableHolder.getRef(),
NULL,
UniqueIdentifier.empty() ? NULL : MDString::get(VMContext, UniqueIdentifier)
nullptr,
UniqueIdentifier.empty() ? nullptr
: MDString::get(VMContext, UniqueIdentifier)
};
DICompositeType R(MDNode::get(VMContext, Elts));
assert(R.isCompositeType() &&
@ -696,12 +699,13 @@ DICompositeType DIBuilder::createUnionType(DIDescriptor Scope, StringRef Name,
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
NULL,
nullptr,
Elements,
ConstantInt::get(Type::getInt32Ty(VMContext), RunTimeLang),
NULL,
NULL,
UniqueIdentifier.empty() ? NULL : MDString::get(VMContext, UniqueIdentifier)
nullptr,
nullptr,
UniqueIdentifier.empty() ? nullptr
: MDString::get(VMContext, UniqueIdentifier)
};
DICompositeType R(MDNode::get(VMContext, Elts));
if (!UniqueIdentifier.empty())
@ -717,19 +721,19 @@ DICompositeType DIBuilder::createSubroutineType(DIFile File,
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_subroutine_type),
Constant::getNullValue(Type::getInt32Ty(VMContext)),
NULL,
nullptr,
MDString::get(VMContext, ""),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
ConstantInt::get(Type::getInt32Ty(VMContext), Flags), // Flags
NULL,
nullptr,
ParameterTypes,
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
NULL,
NULL,
NULL // Type Identifer
nullptr,
nullptr,
nullptr // Type Identifer
};
return DICompositeType(MDNode::get(VMContext, Elts));
}
@ -754,9 +758,10 @@ DICompositeType DIBuilder::createEnumerationType(
UnderlyingType.getRef(),
Elements,
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
NULL,
NULL,
UniqueIdentifier.empty() ? NULL : MDString::get(VMContext, UniqueIdentifier)
nullptr,
nullptr,
UniqueIdentifier.empty() ? nullptr
: MDString::get(VMContext, UniqueIdentifier)
};
DICompositeType CTy(MDNode::get(VMContext, Elts));
AllEnumTypes.push_back(CTy);
@ -771,8 +776,8 @@ DICompositeType DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
// TAG_array_type is encoded in DICompositeType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_array_type),
NULL, // Filename/Directory,
NULL, // Unused
nullptr, // Filename/Directory,
nullptr, // Unused
MDString::get(VMContext, ""),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), Size),
@ -782,9 +787,9 @@ DICompositeType DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
Ty.getRef(),
Subscripts,
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
NULL,
NULL,
NULL // Type Identifer
nullptr,
nullptr,
nullptr // Type Identifer
};
return DICompositeType(MDNode::get(VMContext, Elts));
}
@ -795,8 +800,8 @@ DICompositeType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits,
// A vector is an array type with the FlagVector flag applied.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_array_type),
NULL, // Filename/Directory,
NULL, // Unused
nullptr, // Filename/Directory,
nullptr, // Unused
MDString::get(VMContext, ""),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), Size),
@ -806,9 +811,9 @@ DICompositeType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits,
Ty.getRef(),
Subscripts,
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
NULL,
NULL,
NULL // Type Identifer
nullptr,
nullptr,
nullptr // Type Identifer
};
return DICompositeType(MDNode::get(VMContext, Elts));
}
@ -889,12 +894,13 @@ DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope,
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Offset
ConstantInt::get(Type::getInt32Ty(VMContext), DIDescriptor::FlagFwdDecl),
NULL,
nullptr,
DIArray(),
ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang),
NULL,
NULL, //TemplateParams
UniqueIdentifier.empty() ? NULL : MDString::get(VMContext, UniqueIdentifier)
nullptr,
nullptr, //TemplateParams
UniqueIdentifier.empty() ? nullptr
: MDString::get(VMContext, UniqueIdentifier)
};
MDNode *Node = MDNode::getTemporary(VMContext, Elts);
DICompositeType RetTy(Node);
@ -931,7 +937,7 @@ DIGlobalVariable DIBuilder::createGlobalVariable(StringRef Name,
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_variable),
Constant::getNullValue(Type::getInt32Ty(VMContext)),
NULL, // TheCU,
nullptr, // TheCU,
MDString::get(VMContext, Name),
MDString::get(VMContext, Name),
MDString::get(VMContext, LinkageName),
@ -1086,7 +1092,7 @@ DISubprogram DIBuilder::createFunction(DIDescriptor Context, StringRef Name,
ConstantInt::get(Type::getInt1Ty(VMContext), isDefinition),
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
NULL,
nullptr,
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized),
Fn,

View File

@ -178,7 +178,7 @@ static const LayoutAlignElem DefaultAlignments[] = {
void DataLayout::reset(StringRef Desc) {
clear();
LayoutMap = 0;
LayoutMap = nullptr;
LittleEndian = false;
StackNaturalAlign = 0;
ManglingMode = MM_None;
@ -344,7 +344,7 @@ void DataLayout::parseSpecifier(StringRef Desc) {
}
}
DataLayout::DataLayout(const Module *M) : LayoutMap(0) {
DataLayout::DataLayout(const Module *M) : LayoutMap(nullptr) {
const DataLayout *Other = M->getDataLayout();
if (Other)
*this = *Other;
@ -488,7 +488,7 @@ void DataLayout::clear() {
Alignments.clear();
Pointers.clear();
delete static_cast<StructLayoutMap *>(LayoutMap);
LayoutMap = 0;
LayoutMap = nullptr;
}
DataLayout::~DataLayout() {
@ -687,7 +687,7 @@ unsigned DataLayout::getABITypeAlignment(Type *Ty) const {
/// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for
/// an integer type of the specified bitwidth.
unsigned DataLayout::getABIIntegerTypeAlignment(unsigned BitWidth) const {
return getAlignmentInfo(INTEGER_ALIGN, BitWidth, true, 0);
return getAlignmentInfo(INTEGER_ALIGN, BitWidth, true, nullptr);
}
unsigned DataLayout::getPrefTypeAlignment(Type *Ty) const {
@ -719,7 +719,7 @@ Type *DataLayout::getSmallestLegalIntType(LLVMContext &C, unsigned Width) const
for (unsigned LegalIntWidth : LegalIntWidths)
if (Width <= LegalIntWidth)
return Type::getIntNTy(C, LegalIntWidth);
return 0;
return nullptr;
}
unsigned DataLayout::getLargestLegalIntTypeSize() const {

View File

@ -53,8 +53,8 @@ bool DIDescriptor::Verify() const {
}
static Value *getField(const MDNode *DbgNode, unsigned Elt) {
if (DbgNode == 0 || Elt >= DbgNode->getNumOperands())
return 0;
if (!DbgNode || Elt >= DbgNode->getNumOperands())
return nullptr;
return DbgNode->getOperand(Elt);
}
@ -73,7 +73,7 @@ StringRef DIDescriptor::getStringField(unsigned Elt) const {
}
uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const {
if (DbgNode == 0)
if (!DbgNode)
return 0;
if (Elt < DbgNode->getNumOperands())
@ -85,7 +85,7 @@ uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const {
}
int64_t DIDescriptor::getInt64Field(unsigned Elt) const {
if (DbgNode == 0)
if (!DbgNode)
return 0;
if (Elt < DbgNode->getNumOperands())
@ -102,34 +102,34 @@ DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const {
}
GlobalVariable *DIDescriptor::getGlobalVariableField(unsigned Elt) const {
if (DbgNode == 0)
return 0;
if (!DbgNode)
return nullptr;
if (Elt < DbgNode->getNumOperands())
return dyn_cast_or_null<GlobalVariable>(DbgNode->getOperand(Elt));
return 0;
return nullptr;
}
Constant *DIDescriptor::getConstantField(unsigned Elt) const {
if (DbgNode == 0)
return 0;
if (!DbgNode)
return nullptr;
if (Elt < DbgNode->getNumOperands())
return dyn_cast_or_null<Constant>(DbgNode->getOperand(Elt));
return 0;
return nullptr;
}
Function *DIDescriptor::getFunctionField(unsigned Elt) const {
if (DbgNode == 0)
return 0;
if (!DbgNode)
return nullptr;
if (Elt < DbgNode->getNumOperands())
return dyn_cast_or_null<Function>(DbgNode->getOperand(Elt));
return 0;
return nullptr;
}
void DIDescriptor::replaceFunctionField(unsigned Elt, Function *F) {
if (DbgNode == 0)
if (!DbgNode)
return;
if (Elt < DbgNode->getNumOperands()) {
@ -759,7 +759,7 @@ DIScopeRef DIScope::getContext() const {
return DIScopeRef(DINameSpace(DbgNode).getContext());
assert((isFile() || isCompileUnit()) && "Unhandled type of scope.");
return DIScopeRef(NULL);
return DIScopeRef(nullptr);
}
// If the scope node has a name, return that, else return an empty string.

View File

@ -18,7 +18,7 @@ using namespace llvm;
//===----------------------------------------------------------------------===//
MDNode *DebugLoc::getScope(const LLVMContext &Ctx) const {
if (ScopeIdx == 0) return 0;
if (ScopeIdx == 0) return nullptr;
if (ScopeIdx > 0) {
// Positive ScopeIdx is an index into ScopeRecords, which has no inlined-at
@ -37,7 +37,7 @@ MDNode *DebugLoc::getScope(const LLVMContext &Ctx) const {
MDNode *DebugLoc::getInlinedAt(const LLVMContext &Ctx) const {
// Positive ScopeIdx is an index into ScopeRecords, which has no inlined-at
// position specified. Zero is invalid.
if (ScopeIdx >= 0) return 0;
if (ScopeIdx >= 0) return nullptr;
// Otherwise, the index is in the ScopeInlinedAtRecords array.
assert(unsigned(-ScopeIdx) <= Ctx.pImpl->ScopeInlinedAtRecords.size() &&
@ -49,7 +49,7 @@ MDNode *DebugLoc::getInlinedAt(const LLVMContext &Ctx) const {
void DebugLoc::getScopeAndInlinedAt(MDNode *&Scope, MDNode *&IA,
const LLVMContext &Ctx) const {
if (ScopeIdx == 0) {
Scope = IA = 0;
Scope = IA = nullptr;
return;
}
@ -59,7 +59,7 @@ void DebugLoc::getScopeAndInlinedAt(MDNode *&Scope, MDNode *&IA,
assert(unsigned(ScopeIdx) <= Ctx.pImpl->ScopeRecords.size() &&
"Invalid ScopeIdx!");
Scope = Ctx.pImpl->ScopeRecords[ScopeIdx-1].get();
IA = 0;
IA = nullptr;
return;
}
@ -96,8 +96,8 @@ DebugLoc DebugLoc::get(unsigned Line, unsigned Col,
DebugLoc Result;
// If no scope is available, this is an unknown location.
if (Scope == 0) return Result;
if (!Scope) return Result;
// Saturate line and col to "unknown".
if (Col > 255) Col = 0;
if (Line >= (1 << 24)) Line = 0;
@ -106,7 +106,7 @@ DebugLoc DebugLoc::get(unsigned Line, unsigned Col,
LLVMContext &Ctx = Scope->getContext();
// If there is no inlined-at location, use the ScopeRecords array.
if (InlinedAt == 0)
if (!InlinedAt)
Result.ScopeIdx = Ctx.pImpl->getOrAddScopeRecordIdxEntry(Scope, 0);
else
Result.ScopeIdx = Ctx.pImpl->getOrAddScopeInlinedAtIdxEntry(Scope,
@ -118,7 +118,7 @@ DebugLoc DebugLoc::get(unsigned Line, unsigned Col,
/// getAsMDNode - This method converts the compressed DebugLoc node into a
/// DILocation-compatible MDNode.
MDNode *DebugLoc::getAsMDNode(const LLVMContext &Ctx) const {
if (isUnknown()) return 0;
if (isUnknown()) return nullptr;
MDNode *Scope, *IA;
getScopeAndInlinedAt(Scope, IA, Ctx);
@ -137,7 +137,7 @@ MDNode *DebugLoc::getAsMDNode(const LLVMContext &Ctx) const {
DebugLoc DebugLoc::getFromDILocation(MDNode *N) {
DILocation Loc(N);
MDNode *Scope = Loc.getScope();
if (Scope == 0) return DebugLoc();
if (!Scope) return DebugLoc();
return get(Loc.getLineNumber(), Loc.getColumnNumber(), Scope,
Loc.getOrigLocation());
}
@ -146,8 +146,9 @@ DebugLoc DebugLoc::getFromDILocation(MDNode *N) {
DebugLoc DebugLoc::getFromDILexicalBlock(MDNode *N) {
DILexicalBlock LexBlock(N);
MDNode *Scope = LexBlock.getContext();
if (Scope == 0) return DebugLoc();
return get(LexBlock.getLineNumber(), LexBlock.getColumnNumber(), Scope, NULL);
if (!Scope) return DebugLoc();
return get(LexBlock.getLineNumber(), LexBlock.getColumnNumber(), Scope,
nullptr);
}
void DebugLoc::dump(const LLVMContext &Ctx) const {
@ -234,7 +235,7 @@ void DebugRecVH::deleted() {
// If this is a non-canonical reference, just drop the value to null, we know
// it doesn't have a map entry.
if (Idx == 0) {
setValPtr(0);
setValPtr(nullptr);
return;
}
@ -245,7 +246,7 @@ void DebugRecVH::deleted() {
assert(Ctx->ScopeRecordIdx[Cur] == Idx && "Mapping out of date!");
Ctx->ScopeRecordIdx.erase(Cur);
// Reset this VH to null and we're done.
setValPtr(0);
setValPtr(nullptr);
Idx = 0;
return;
}
@ -269,7 +270,7 @@ void DebugRecVH::deleted() {
// Reset this VH to null. Drop both 'Idx' values to null to indicate that
// we're in non-canonical form now.
setValPtr(0);
setValPtr(nullptr);
Entry.first.Idx = Entry.second.Idx = 0;
}
@ -277,8 +278,8 @@ void DebugRecVH::allUsesReplacedWith(Value *NewVa) {
// If being replaced with a non-mdnode value (e.g. undef) handle this as if
// the mdnode got deleted.
MDNode *NewVal = dyn_cast<MDNode>(NewVa);
if (NewVal == 0) return deleted();
if (!NewVal) return deleted();
// If this is a non-canonical reference, just change it, we know it already
// doesn't have a map entry.
if (Idx == 0) {

View File

@ -68,7 +68,7 @@ void DiagnosticInfoSampleProfile::print(DiagnosticPrinter &DP) const {
}
bool DiagnosticInfoOptimizationRemark::isLocationAvailable() const {
return getFunction().getParent()->getNamedMetadata("llvm.dbg.cu") != 0;
return getFunction().getParent()->getNamedMetadata("llvm.dbg.cu") != nullptr;
}
void DiagnosticInfoOptimizationRemark::getLocation(StringRef *Filename,

View File

@ -44,7 +44,7 @@ void Argument::anchor() { }
Argument::Argument(Type *Ty, const Twine &Name, Function *Par)
: Value(Ty, Value::ArgumentVal) {
Parent = 0;
Parent = nullptr;
// Make sure that we get added to a function
LeakDetector::addGarbageObject(this);
@ -210,7 +210,7 @@ void Function::eraseFromParent() {
Function::Function(FunctionType *Ty, LinkageTypes Linkage,
const Twine &name, Module *ParentModule)
: GlobalValue(PointerType::getUnqual(Ty),
Value::FunctionVal, 0, 0, Linkage, name) {
Value::FunctionVal, nullptr, 0, Linkage, name) {
assert(FunctionType::isValidReturnType(getReturnType()) &&
"invalid return type");
SymTab = new ValueSymbolTable();
@ -293,7 +293,7 @@ void Function::dropAllReferences() {
BasicBlocks.begin()->eraseFromParent();
// Prefix data is stored in a side table.
setPrefixData(0);
setPrefixData(nullptr);
}
void Function::addAttribute(unsigned i, Attribute::AttrKind attr) {
@ -348,10 +348,10 @@ void Function::clearGC() {
GCNames->erase(this);
if (GCNames->empty()) {
delete GCNames;
GCNames = 0;
GCNames = nullptr;
if (GCNamePool->empty()) {
delete GCNamePool;
GCNamePool = 0;
GCNamePool = nullptr;
}
}
}
@ -372,7 +372,7 @@ void Function::copyAttributesFrom(const GlobalValue *Src) {
if (SrcF->hasPrefixData())
setPrefixData(SrcF->getPrefixData());
else
setPrefixData(0);
setPrefixData(nullptr);
}
/// getIntrinsicID - This method returns the ID number of the specified

View File

@ -96,7 +96,7 @@ GlobalVariable::GlobalVariable(Type *Ty, bool constant, LinkageTypes Link,
: GlobalValue(PointerType::get(Ty, AddressSpace),
Value::GlobalVariableVal,
OperandTraits<GlobalVariable>::op_begin(this),
InitVal != 0, Link, Name),
InitVal != nullptr, Link, Name),
isConstantGlobal(constant), threadLocalMode(TLMode),
isExternallyInitializedConstant(isExternallyInitialized) {
if (InitVal) {
@ -117,7 +117,7 @@ GlobalVariable::GlobalVariable(Module &M, Type *Ty, bool constant,
: GlobalValue(PointerType::get(Ty, AddressSpace),
Value::GlobalVariableVal,
OperandTraits<GlobalVariable>::op_begin(this),
InitVal != 0, Link, Name),
InitVal != nullptr, Link, Name),
isConstantGlobal(constant), threadLocalMode(TLMode),
isExternallyInitializedConstant(isExternallyInitialized) {
if (InitVal) {
@ -171,9 +171,9 @@ void GlobalVariable::replaceUsesOfWithOnConstant(Value *From, Value *To,
}
void GlobalVariable::setInitializer(Constant *InitVal) {
if (InitVal == 0) {
if (!InitVal) {
if (hasInitializer()) {
Op<0>().set(0);
Op<0>().set(nullptr);
NumOperands = 0;
}
} else {
@ -260,7 +260,7 @@ GlobalValue *GlobalAlias::getAliasedGlobal() {
for (;;) {
GlobalValue *GV = getAliaseeGV(GA);
if (!Visited.insert(GV))
return 0;
return nullptr;
// Iterate over aliasing chain.
GA = dyn_cast<GlobalAlias>(GV);

View File

@ -274,7 +274,7 @@ bool InlineAsm::Verify(FunctionType *Ty, StringRef ConstStr) {
break;
default:
StructType *STy = dyn_cast<StructType>(Ty->getReturnType());
if (STy == 0 || STy->getNumElements() != NumOutputs)
if (!STy || STy->getNumElements() != NumOutputs)
return false;
break;
}

View File

@ -23,7 +23,7 @@ using namespace llvm;
Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
Instruction *InsertBefore)
: User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
: User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(nullptr) {
// Make sure that we get added to a basicblock
LeakDetector::addGarbageObject(this);
@ -41,7 +41,7 @@ const DataLayout *Instruction::getDataLayout() const {
Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
BasicBlock *InsertAtEnd)
: User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(0) {
: User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(nullptr) {
// Make sure that we get added to a basicblock
LeakDetector::addGarbageObject(this);
@ -410,7 +410,7 @@ bool Instruction::isUsedOutsideOfBlock(const BasicBlock *BB) const {
// instructions, just check to see whether the parent of the use matches up.
const Instruction *I = cast<Instruction>(U.getUser());
const PHINode *PN = dyn_cast<PHINode>(I);
if (PN == 0) {
if (!PN) {
if (I->getParent() != BB)
return true;
continue;

View File

@ -68,7 +68,7 @@ const char *SelectInst::areInvalidOperands(Value *Op0, Value *Op1, Value *Op2) {
if (VT->getElementType() != Type::getInt1Ty(Op0->getContext()))
return "vector select condition element type must be i1";
VectorType *ET = dyn_cast<VectorType>(Op1->getType());
if (ET == 0)
if (!ET)
return "selected values for vector select must be vectors";
if (ET->getNumElements() != VT->getNumElements())
return "vector select requires selected vectors to have "
@ -76,7 +76,7 @@ const char *SelectInst::areInvalidOperands(Value *Op0, Value *Op1, Value *Op2) {
} else if (Op0->getType() != Type::getInt1Ty(Op0->getContext())) {
return "select condition must be i1 or <n x i1>";
}
return 0;
return nullptr;
}
@ -123,7 +123,7 @@ Value *PHINode::removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty) {
std::copy(block_begin() + Idx + 1, block_end(), block_begin() + Idx);
// Nuke the last value.
Op<-1>().set(0);
Op<-1>().set(nullptr);
--NumOperands;
// If the PHI node is dead, because it has zero entries, nuke it now.
@ -164,7 +164,7 @@ Value *PHINode::hasConstantValue() const {
for (unsigned i = 1, e = getNumIncomingValues(); i != e; ++i)
if (getIncomingValue(i) != ConstantValue && getIncomingValue(i) != this) {
if (ConstantValue != this)
return 0; // Incoming values not all the same.
return nullptr; // Incoming values not all the same.
// The case where the first value is this PHI.
ConstantValue = getIncomingValue(i);
}
@ -180,14 +180,14 @@ Value *PHINode::hasConstantValue() const {
LandingPadInst::LandingPadInst(Type *RetTy, Value *PersonalityFn,
unsigned NumReservedValues, const Twine &NameStr,
Instruction *InsertBefore)
: Instruction(RetTy, Instruction::LandingPad, 0, 0, InsertBefore) {
: Instruction(RetTy, Instruction::LandingPad, nullptr, 0, InsertBefore) {
init(PersonalityFn, 1 + NumReservedValues, NameStr);
}
LandingPadInst::LandingPadInst(Type *RetTy, Value *PersonalityFn,
unsigned NumReservedValues, const Twine &NameStr,
BasicBlock *InsertAtEnd)
: Instruction(RetTy, Instruction::LandingPad, 0, 0, InsertAtEnd) {
: Instruction(RetTy, Instruction::LandingPad, nullptr, 0, InsertAtEnd) {
init(PersonalityFn, 1 + NumReservedValues, NameStr);
}
@ -420,8 +420,8 @@ static Instruction *createMalloc(Instruction *InsertBefore,
// prototype malloc as "void *malloc(size_t)"
MallocFunc = M->getOrInsertFunction("malloc", BPTy, IntPtrTy, NULL);
PointerType *AllocPtrType = PointerType::getUnqual(AllocTy);
CallInst *MCall = NULL;
Instruction *Result = NULL;
CallInst *MCall = nullptr;
Instruction *Result = nullptr;
if (InsertBefore) {
MCall = CallInst::Create(MallocFunc, AllocSize, "malloccall", InsertBefore);
Result = MCall;
@ -458,7 +458,7 @@ Instruction *CallInst::CreateMalloc(Instruction *InsertBefore,
Value *AllocSize, Value *ArraySize,
Function * MallocF,
const Twine &Name) {
return createMalloc(InsertBefore, NULL, IntPtrTy, AllocTy, AllocSize,
return createMalloc(InsertBefore, nullptr, IntPtrTy, AllocTy, AllocSize,
ArraySize, MallocF, Name);
}
@ -474,7 +474,7 @@ Instruction *CallInst::CreateMalloc(BasicBlock *InsertAtEnd,
Type *IntPtrTy, Type *AllocTy,
Value *AllocSize, Value *ArraySize,
Function *MallocF, const Twine &Name) {
return createMalloc(NULL, InsertAtEnd, IntPtrTy, AllocTy, AllocSize,
return createMalloc(nullptr, InsertAtEnd, IntPtrTy, AllocTy, AllocSize,
ArraySize, MallocF, Name);
}
@ -492,7 +492,7 @@ static Instruction* createFree(Value* Source, Instruction *InsertBefore,
Type *IntPtrTy = Type::getInt8PtrTy(M->getContext());
// prototype free as "void free(void*)"
Value *FreeFunc = M->getOrInsertFunction("free", VoidTy, IntPtrTy, NULL);
CallInst* Result = NULL;
CallInst* Result = nullptr;
Value *PtrCast = Source;
if (InsertBefore) {
if (Source->getType() != IntPtrTy)
@ -512,14 +512,14 @@ static Instruction* createFree(Value* Source, Instruction *InsertBefore,
/// CreateFree - Generate the IR for a call to the builtin free function.
Instruction * CallInst::CreateFree(Value* Source, Instruction *InsertBefore) {
return createFree(Source, InsertBefore, NULL);
return createFree(Source, InsertBefore, nullptr);
}
/// CreateFree - Generate the IR for a call to the builtin free function.
/// Note: This function does not add the call to the basic block, that is the
/// responsibility of the caller.
Instruction* CallInst::CreateFree(Value* Source, BasicBlock *InsertAtEnd) {
Instruction* FreeCall = createFree(Source, NULL, InsertAtEnd);
Instruction* FreeCall = createFree(Source, nullptr, InsertAtEnd);
assert(FreeCall && "CreateFree did not create a CallInst");
return FreeCall;
}
@ -699,11 +699,11 @@ BasicBlock *ResumeInst::getSuccessorV(unsigned idx) const {
UnreachableInst::UnreachableInst(LLVMContext &Context,
Instruction *InsertBefore)
: TerminatorInst(Type::getVoidTy(Context), Instruction::Unreachable,
0, 0, InsertBefore) {
nullptr, 0, InsertBefore) {
}
UnreachableInst::UnreachableInst(LLVMContext &Context, BasicBlock *InsertAtEnd)
: TerminatorInst(Type::getVoidTy(Context), Instruction::Unreachable,
0, 0, InsertAtEnd) {
nullptr, 0, InsertAtEnd) {
}
unsigned UnreachableInst::getNumSuccessorsV() const {
@ -852,7 +852,7 @@ AllocaInst::AllocaInst(Type *Ty, Value *ArraySize,
AllocaInst::AllocaInst(Type *Ty, const Twine &Name,
Instruction *InsertBefore)
: UnaryInstruction(PointerType::getUnqual(Ty), Alloca,
getAISize(Ty->getContext(), 0), InsertBefore) {
getAISize(Ty->getContext(), nullptr), InsertBefore) {
setAlignment(0);
assert(!Ty->isVoidTy() && "Cannot allocate void!");
setName(Name);
@ -861,7 +861,7 @@ AllocaInst::AllocaInst(Type *Ty, const Twine &Name,
AllocaInst::AllocaInst(Type *Ty, const Twine &Name,
BasicBlock *InsertAtEnd)
: UnaryInstruction(PointerType::getUnqual(Ty), Alloca,
getAISize(Ty->getContext(), 0), InsertAtEnd) {
getAISize(Ty->getContext(), nullptr), InsertAtEnd) {
setAlignment(0);
assert(!Ty->isVoidTy() && "Cannot allocate void!");
setName(Name);
@ -1323,7 +1323,7 @@ AtomicRMWInst::AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val,
FenceInst::FenceInst(LLVMContext &C, AtomicOrdering Ordering,
SynchronizationScope SynchScope,
Instruction *InsertBefore)
: Instruction(Type::getVoidTy(C), Fence, 0, 0, InsertBefore) {
: Instruction(Type::getVoidTy(C), Fence, nullptr, 0, InsertBefore) {
setOrdering(Ordering);
setSynchScope(SynchScope);
}
@ -1331,7 +1331,7 @@ FenceInst::FenceInst(LLVMContext &C, AtomicOrdering Ordering,
FenceInst::FenceInst(LLVMContext &C, AtomicOrdering Ordering,
SynchronizationScope SynchScope,
BasicBlock *InsertAtEnd)
: Instruction(Type::getVoidTy(C), Fence, 0, 0, InsertAtEnd) {
: Instruction(Type::getVoidTy(C), Fence, nullptr, 0, InsertAtEnd) {
setOrdering(Ordering);
setSynchScope(SynchScope);
}
@ -1369,7 +1369,7 @@ GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI)
template <typename IndexTy>
static Type *getIndexedTypeInternal(Type *Ptr, ArrayRef<IndexTy> IdxList) {
PointerType *PTy = dyn_cast<PointerType>(Ptr->getScalarType());
if (!PTy) return 0; // Type isn't a pointer type!
if (!PTy) return nullptr; // Type isn't a pointer type!
Type *Agg = PTy->getElementType();
// Handle the special case of the empty set index set, which is always valid.
@ -1379,17 +1379,17 @@ static Type *getIndexedTypeInternal(Type *Ptr, ArrayRef<IndexTy> IdxList) {
// If there is at least one index, the top level type must be sized, otherwise
// it cannot be 'stepped over'.
if (!Agg->isSized())
return 0;
return nullptr;
unsigned CurIdx = 1;
for (; CurIdx != IdxList.size(); ++CurIdx) {
CompositeType *CT = dyn_cast<CompositeType>(Agg);
if (!CT || CT->isPointerTy()) return 0;
if (!CT || CT->isPointerTy()) return nullptr;
IndexTy Index = IdxList[CurIdx];
if (!CT->indexValid(Index)) return 0;
if (!CT->indexValid(Index)) return nullptr;
Agg = CT->getTypeAtIndex(Index);
}
return CurIdx == IdxList.size() ? Agg : 0;
return CurIdx == IdxList.size() ? Agg : nullptr;
}
Type *GetElementPtrInst::getIndexedType(Type *Ptr, ArrayRef<Value *> IdxList) {
@ -1579,7 +1579,7 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2,
// Mask must be vector of i32.
VectorType *MaskTy = dyn_cast<VectorType>(Mask->getType());
if (MaskTy == 0 || !MaskTy->getElementType()->isIntegerTy(32))
if (!MaskTy || !MaskTy->getElementType()->isIntegerTy(32))
return false;
// Check to see if Mask is valid.
@ -1721,13 +1721,13 @@ Type *ExtractValueInst::getIndexedType(Type *Agg,
// as easy to check those manually as well.
if (ArrayType *AT = dyn_cast<ArrayType>(Agg)) {
if (Index >= AT->getNumElements())
return 0;
return nullptr;
} else if (StructType *ST = dyn_cast<StructType>(Agg)) {
if (Index >= ST->getNumElements())
return 0;
return nullptr;
} else {
// Not a valid type to index into.
return 0;
return nullptr;
}
Agg = cast<CompositeType>(Agg)->getTypeAtIndex(Index);
@ -2130,7 +2130,7 @@ bool CastInst::isNoopCast(const DataLayout *DL) const {
return isNoopCast(Type::getInt64Ty(getContext()));
}
Type *PtrOpTy = 0;
Type *PtrOpTy = nullptr;
if (getOpcode() == Instruction::PtrToInt)
PtrOpTy = getOperand(0)->getType();
else if (getOpcode() == Instruction::IntToPtr)
@ -3361,7 +3361,7 @@ void SwitchInst::init(Value *Value, BasicBlock *Default, unsigned NumReserved) {
SwitchInst::SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
Instruction *InsertBefore)
: TerminatorInst(Type::getVoidTy(Value->getContext()), Instruction::Switch,
0, 0, InsertBefore) {
nullptr, 0, InsertBefore) {
init(Value, Default, 2+NumCases*2);
}
@ -3372,12 +3372,12 @@ SwitchInst::SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
SwitchInst::SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
BasicBlock *InsertAtEnd)
: TerminatorInst(Type::getVoidTy(Value->getContext()), Instruction::Switch,
0, 0, InsertAtEnd) {
nullptr, 0, InsertAtEnd) {
init(Value, Default, 2+NumCases*2);
}
SwitchInst::SwitchInst(const SwitchInst &SI)
: TerminatorInst(SI.getType(), Instruction::Switch, 0, 0) {
: TerminatorInst(SI.getType(), Instruction::Switch, nullptr, 0) {
init(SI.getCondition(), SI.getDefaultDest(), SI.getNumOperands());
NumOperands = SI.getNumOperands();
Use *OL = OperandList, *InOL = SI.OperandList;
@ -3425,8 +3425,8 @@ void SwitchInst::removeCase(CaseIt i) {
}
// Nuke the last value.
OL[NumOps-2].set(0);
OL[NumOps-2+1].set(0);
OL[NumOps-2].set(nullptr);
OL[NumOps-2+1].set(nullptr);
NumOperands = NumOps-2;
}
@ -3492,14 +3492,14 @@ void IndirectBrInst::growOperands() {
IndirectBrInst::IndirectBrInst(Value *Address, unsigned NumCases,
Instruction *InsertBefore)
: TerminatorInst(Type::getVoidTy(Address->getContext()),Instruction::IndirectBr,
0, 0, InsertBefore) {
nullptr, 0, InsertBefore) {
init(Address, NumCases);
}
IndirectBrInst::IndirectBrInst(Value *Address, unsigned NumCases,
BasicBlock *InsertAtEnd)
: TerminatorInst(Type::getVoidTy(Address->getContext()),Instruction::IndirectBr,
0, 0, InsertAtEnd) {
nullptr, 0, InsertAtEnd) {
init(Address, NumCases);
}
@ -3541,7 +3541,7 @@ void IndirectBrInst::removeDestination(unsigned idx) {
OL[idx+1] = OL[NumOps-1];
// Nuke the last value.
OL[NumOps-1].set(0);
OL[NumOps-1].set(nullptr);
NumOperands = NumOps-1;
}

View File

@ -35,7 +35,7 @@ static Value *CastOperand(Value *C) {
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
if (CE->isCast())
return CE->getOperand(0);
return NULL;
return nullptr;
}
Value *DbgInfoIntrinsic::StripCast(Value *C) {
@ -57,7 +57,7 @@ Value *DbgDeclareInst::getAddress() const {
if (MDNode* MD = cast_or_null<MDNode>(getArgOperand(0)))
return MD->getOperand(0);
else
return NULL;
return nullptr;
}
//===----------------------------------------------------------------------===//

View File

@ -126,7 +126,7 @@ void LLVMContext::emitError(const Instruction *I, const Twine &ErrorStr) {
void LLVMContext::diagnose(const DiagnosticInfo &DI) {
// If there is a report handler, use it.
if (pImpl->DiagnosticHandler != 0) {
if (pImpl->DiagnosticHandler) {
pImpl->DiagnosticHandler(DI, pImpl->DiagnosticContext);
return;
}

View File

@ -21,7 +21,7 @@
using namespace llvm;
LLVMContextImpl::LLVMContextImpl(LLVMContext &C)
: TheTrueVal(0), TheFalseVal(0),
: TheTrueVal(nullptr), TheFalseVal(nullptr),
VoidTy(C, Type::VoidTyID),
LabelTy(C, Type::LabelTyID),
HalfTy(C, Type::HalfTyID),
@ -37,10 +37,10 @@ LLVMContextImpl::LLVMContextImpl(LLVMContext &C)
Int16Ty(C, 16),
Int32Ty(C, 32),
Int64Ty(C, 64) {
InlineAsmDiagHandler = 0;
InlineAsmDiagContext = 0;
DiagnosticHandler = 0;
DiagnosticContext = 0;
InlineAsmDiagHandler = nullptr;
InlineAsmDiagContext = nullptr;
DiagnosticHandler = nullptr;
DiagnosticContext = nullptr;
NamedStructTypesUniqueID = 0;
}
@ -50,7 +50,7 @@ namespace {
/// command line flag -pass-remarks. Passes whose name matches this
/// regexp will emit a diagnostic when calling
/// LLVMContext::emitOptimizationRemark.
static Regex *OptimizationRemarkPattern = 0;
static Regex *OptimizationRemarkPattern = nullptr;
/// \brief String to hold all the values passed via -pass-remarks. Every
/// instance of -pass-remarks on the command line will be concatenated

View File

@ -118,7 +118,7 @@ bool PMDataManager::isPassDebuggingExecutionsOrMore() const {
void PassManagerPrettyStackEntry::print(raw_ostream &OS) const {
if (V == 0 && M == 0)
if (!V && !M)
OS << "Releasing pass '";
else
OS << "Running pass '";
@ -129,7 +129,7 @@ void PassManagerPrettyStackEntry::print(raw_ostream &OS) const {
OS << " on module '" << M->getModuleIdentifier() << "'.\n";
return;
}
if (V == 0) {
if (!V) {
OS << '\n';
return;
}
@ -484,11 +484,11 @@ public:
/// getPassTimer - Return the timer for the specified pass if it exists.
Timer *getPassTimer(Pass *P) {
if (P->getAsPMDataManager())
return 0;
return nullptr;
sys::SmartScopedLock<true> Lock(*TimingInfoMutex);
Timer *&T = TimingData[P];
if (T == 0)
if (!T)
T = new Timer(P->getPassName(), TG);
return T;
}
@ -579,7 +579,7 @@ void PMTopLevelManager::collectLastUses(SmallVectorImpl<Pass *> &LastUses,
}
AnalysisUsage *PMTopLevelManager::findAnalysisUsage(Pass *P) {
AnalysisUsage *AnUsage = NULL;
AnalysisUsage *AnUsage = nullptr;
DenseMap<Pass *, AnalysisUsage *>::iterator DMI = AnUsageMap.find(P);
if (DMI != AnUsageMap.end())
AnUsage = DMI->second;
@ -626,7 +626,7 @@ void PMTopLevelManager::schedulePass(Pass *P) {
if (!AnalysisPass) {
const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(*I);
if (PI == NULL) {
if (!PI) {
// Pass P is not in the global PassRegistry
dbgs() << "Pass '" << P->getPassName() << "' is not initialized." << "\n";
dbgs() << "Verify if there is a pass dependency cycle." << "\n";
@ -733,7 +733,7 @@ Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) {
}
}
return 0;
return nullptr;
}
// Print passes managed by this top level manager.
@ -830,7 +830,7 @@ void PMDataManager::recordAvailableAnalysis(Pass *P) {
// This pass is the current implementation of all of the interfaces it
// implements as well.
const PassInfo *PInf = PassRegistry::getPassRegistry()->getPassInfo(PI);
if (PInf == 0) return;
if (!PInf) return;
const std::vector<const PassInfo*> &II = PInf->getInterfacesImplemented();
for (unsigned i = 0, e = II.size(); i != e; ++i)
AvailableAnalysis[II[i]->getTypeInfo()] = P;
@ -847,7 +847,7 @@ bool PMDataManager::preserveHigherLevelAnalysis(Pass *P) {
for (SmallVectorImpl<Pass *>::iterator I = HigherLevelAnalysis.begin(),
E = HigherLevelAnalysis.end(); I != E; ++I) {
Pass *P1 = *I;
if (P1->getAsImmutablePass() == 0 &&
if (P1->getAsImmutablePass() == nullptr &&
std::find(PreservedSet.begin(), PreservedSet.end(),
P1->getPassID()) ==
PreservedSet.end())
@ -887,7 +887,7 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) {
for (DenseMap<AnalysisID, Pass*>::iterator I = AvailableAnalysis.begin(),
E = AvailableAnalysis.end(); I != E; ) {
DenseMap<AnalysisID, Pass*>::iterator Info = I++;
if (Info->second->getAsImmutablePass() == 0 &&
if (Info->second->getAsImmutablePass() == nullptr &&
std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) ==
PreservedSet.end()) {
// Remove this analysis
@ -911,7 +911,7 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) {
I = InheritedAnalysis[Index]->begin(),
E = InheritedAnalysis[Index]->end(); I != E; ) {
DenseMap<AnalysisID, Pass *>::iterator Info = I++;
if (Info->second->getAsImmutablePass() == 0 &&
if (Info->second->getAsImmutablePass() == nullptr &&
std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) ==
PreservedSet.end()) {
// Remove this analysis
@ -1028,7 +1028,7 @@ void PMDataManager::add(Pass *P, bool ProcessAnalysis) {
// Set P as P's last user until someone starts using P.
// However, if P is a Pass Manager then it does not need
// to record its last user.
if (P->getAsPMDataManager() == 0)
if (!P->getAsPMDataManager())
LastUses.push_back(P);
TPM->setLastUser(LastUses, P);
@ -1095,7 +1095,7 @@ void PMDataManager::initializeAnalysisImpl(Pass *P) {
I = AnUsage->getRequiredSet().begin(),
E = AnUsage->getRequiredSet().end(); I != E; ++I) {
Pass *Impl = findAnalysisPass(*I, true);
if (Impl == 0)
if (!Impl)
// This may be analysis pass that is initialized on the fly.
// If that is not the case then it will raise an assert when it is used.
continue;
@ -1119,7 +1119,7 @@ Pass *PMDataManager::findAnalysisPass(AnalysisID AID, bool SearchParent) {
if (SearchParent)
return TPM->findAnalysisPass(AID);
return NULL;
return nullptr;
}
// Print list of passes that are last used by P.
@ -1671,7 +1671,7 @@ void MPPassManager::addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) {
const PassInfo * RequiredPassPI =
PassRegistry::getPassRegistry()->getPassInfo(RequiredPass->getPassID());
Pass *FoundPass = NULL;
Pass *FoundPass = nullptr;
if (RequiredPassPI && RequiredPassPI->isAnalysis()) {
FoundPass =
((PMTopLevelManager*)FPP)->findAnalysisPass(RequiredPass->getPassID());
@ -1785,7 +1785,7 @@ void TimingInfo::createTheTimeInfo() {
Timer *llvm::getPassTimer(Pass *P) {
if (TheTimeInfo)
return TheTimeInfo->getPassTimer(P);
return 0;
return nullptr;
}
//===----------------------------------------------------------------------===//

View File

@ -108,7 +108,7 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
}
bool UseAt = false;
const Function *MSFunc = NULL;
const Function *MSFunc = nullptr;
CallingConv::ID CC;
if (DL->hasMicrosoftFastStdCallMangling()) {
if ((MSFunc = dyn_cast<Function>(GV))) {

View File

@ -87,7 +87,7 @@ public:
MDNodeOperand::~MDNodeOperand() {}
void MDNodeOperand::deleted() {
getParent()->replaceOperand(this, 0);
getParent()->replaceOperand(this, nullptr);
}
void MDNodeOperand::allUsesReplacedWith(Value *NV) {
@ -148,10 +148,10 @@ MDNode::~MDNode() {
}
static const Function *getFunctionForValue(Value *V) {
if (!V) return NULL;
if (!V) return nullptr;
if (Instruction *I = dyn_cast<Instruction>(V)) {
BasicBlock *BB = I->getParent();
return BB ? BB->getParent() : 0;
return BB ? BB->getParent() : nullptr;
}
if (Argument *A = dyn_cast<Argument>(V))
return A->getParent();
@ -159,7 +159,7 @@ static const Function *getFunctionForValue(Value *V) {
return BB->getParent();
if (MDNode *MD = dyn_cast<MDNode>(V))
return MD->getFunction();
return NULL;
return nullptr;
}
#ifndef NDEBUG
@ -192,11 +192,11 @@ const Function *MDNode::getFunction() const {
#ifndef NDEBUG
return assertLocalFunction(this);
#else
if (!isFunctionLocal()) return NULL;
if (!isFunctionLocal()) return nullptr;
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
if (const Function *F = getFunctionForValue(getOperand(i)))
return F;
return NULL;
return nullptr;
#endif
}
@ -335,14 +335,14 @@ void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) {
// Likewise if the MDNode is function-local but for a different function.
if (To && isFunctionLocalValue(To)) {
if (!isFunctionLocal())
To = 0;
To = nullptr;
else {
const Function *F = getFunction();
const Function *FV = getFunctionForValue(To);
// Metadata can be function-local without having an associated function.
// So only consider functions to have changed if non-null.
if (F && FV && F != FV)
To = 0;
To = nullptr;
}
}
@ -366,7 +366,7 @@ void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) {
// anymore. This commonly occurs during destruction, and uniquing these
// brings little reuse. Also, this means we don't need to include
// isFunctionLocal bits in FoldingSetNodeIDs for MDNodes.
if (To == 0) {
if (!To) {
setIsNotUniqued();
return;
}
@ -407,7 +407,7 @@ void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) {
MDNode *MDNode::getMostGenericFPMath(MDNode *A, MDNode *B) {
if (!A || !B)
return NULL;
return nullptr;
APFloat AVal = cast<ConstantFP>(A->getOperand(0))->getValueAPF();
APFloat BVal = cast<ConstantFP>(B->getOperand(0))->getValueAPF();
@ -457,7 +457,7 @@ MDNode *MDNode::getMostGenericRange(MDNode *A, MDNode *B) {
// the ones that overlap.
if (!A || !B)
return NULL;
return nullptr;
if (A == B)
return A;
@ -512,7 +512,7 @@ MDNode *MDNode::getMostGenericRange(MDNode *A, MDNode *B) {
ConstantRange Range(cast<ConstantInt>(EndPoints[0])->getValue(),
cast<ConstantInt>(EndPoints[1])->getValue());
if (Range.isFullSet())
return NULL;
return nullptr;
}
return MDNode::get(A->getContext(), EndPoints);
@ -527,7 +527,7 @@ static SmallVector<TrackingVH<MDNode>, 4> &getNMDOps(void *Operands) {
}
NamedMDNode::NamedMDNode(const Twine &N)
: Name(N.str()), Parent(0),
: Name(N.str()), Parent(nullptr),
Operands(new SmallVector<TrackingVH<MDNode>, 4>()) {
}
@ -575,7 +575,7 @@ StringRef NamedMDNode::getName() const {
//
void Instruction::setMetadata(StringRef Kind, MDNode *Node) {
if (Node == 0 && !hasMetadata()) return;
if (!Node && !hasMetadata()) return;
setMetadata(getContext().getMDKindID(Kind), Node);
}
@ -631,7 +631,7 @@ void Instruction::dropUnknownMetadata(ArrayRef<unsigned> KnownIDs) {
/// node. This updates/replaces metadata if already present, or removes it if
/// Node is null.
void Instruction::setMetadata(unsigned KindID, MDNode *Node) {
if (Node == 0 && !hasMetadata()) return;
if (!Node && !hasMetadata()) return;
// Handle 'dbg' as a special case since it is not stored in the hash table.
if (KindID == LLVMContext::MD_dbg) {
@ -691,7 +691,7 @@ MDNode *Instruction::getMetadataImpl(unsigned KindID) const {
if (KindID == LLVMContext::MD_dbg)
return DbgLoc.getAsMDNode(getContext());
if (!hasMetadataHashEntry()) return 0;
if (!hasMetadataHashEntry()) return nullptr;
LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this];
assert(!Info.empty() && "bit out of sync with hash table");
@ -699,7 +699,7 @@ MDNode *Instruction::getMetadataImpl(unsigned KindID) const {
for (const auto &I : Info)
if (I.first == KindID)
return I.second;
return 0;
return nullptr;
}
void Instruction::getAllMetadataImpl(SmallVectorImpl<std::pair<unsigned,

View File

@ -95,7 +95,7 @@ Constant *Module::getOrInsertFunction(StringRef Name,
AttributeSet AttributeList) {
// See if we have a definition for the specified function already.
GlobalValue *F = getNamedValue(Name);
if (F == 0) {
if (!F) {
// Nope, add it
Function *New = Function::Create(Ty, GlobalVariable::ExternalLinkage, Name);
if (!New->isIntrinsic()) // Intrinsics get attrs set on construction
@ -183,7 +183,7 @@ GlobalVariable *Module::getGlobalVariable(StringRef Name, bool AllowLocal) {
dyn_cast_or_null<GlobalVariable>(getNamedValue(Name)))
if (AllowLocal || !Result->hasLocalLinkage())
return Result;
return 0;
return nullptr;
}
/// getOrInsertGlobal - Look up the specified global in the module symbol table.
@ -195,11 +195,11 @@ GlobalVariable *Module::getGlobalVariable(StringRef Name, bool AllowLocal) {
Constant *Module::getOrInsertGlobal(StringRef Name, Type *Ty) {
// See if we have a definition for the specified global already.
GlobalVariable *GV = dyn_cast_or_null<GlobalVariable>(getNamedValue(Name));
if (GV == 0) {
if (!GV) {
// Nope, add it
GlobalVariable *New =
new GlobalVariable(*this, Ty, false, GlobalVariable::ExternalLinkage,
0, Name);
nullptr, Name);
return New; // Return the new declaration.
}
@ -284,7 +284,7 @@ Value *Module::getModuleFlag(StringRef Key) const {
if (Key == MFE.Key->getString())
return MFE.Val;
}
return 0;
return nullptr;
}
/// getModuleFlagsMetadata - Returns the NamedMDNode in the module that
@ -350,7 +350,7 @@ void Module::setDataLayout(const DataLayout *Other) {
const DataLayout *Module::getDataLayout() const {
if (DataLayoutStr.empty())
return 0;
return nullptr;
return &DL;
}

View File

@ -44,7 +44,7 @@ PassManagerType ModulePass::getPotentialPassManagerType() const {
}
bool Pass::mustPreserveAnalysisID(char &AID) const {
return Resolver->getAnalysisIfAvailable(&AID, true) != 0;
return Resolver->getAnalysisIfAvailable(&AID, true) != nullptr;
}
// dumpPassStructure - Implement the -debug-pass=Structure option
@ -90,11 +90,11 @@ void *Pass::getAdjustedAnalysisPointer(AnalysisID AID) {
}
ImmutablePass *Pass::getAsImmutablePass() {
return 0;
return nullptr;
}
PMDataManager *Pass::getAsPMDataManager() {
return 0;
return nullptr;
}
void Pass::setResolver(AnalysisResolver *AR) {
@ -112,7 +112,7 @@ void Pass::print(raw_ostream &O,const Module*) const {
// dump - call print(cerr);
void Pass::dump() const {
print(dbgs(), 0);
print(dbgs(), nullptr);
}
//===----------------------------------------------------------------------===//
@ -193,7 +193,7 @@ const PassInfo *Pass::lookupPassInfo(StringRef Arg) {
Pass *Pass::createPass(AnalysisID ID) {
const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(ID);
if (!PI)
return NULL;
return nullptr;
return PI->createPass();
}

View File

@ -59,7 +59,7 @@ ModuleAnalysisManager::ResultConceptT *
ModuleAnalysisManager::getCachedResultImpl(void *PassID, Module *M) const {
ModuleAnalysisResultMapT::const_iterator RI =
ModuleAnalysisResults.find(PassID);
return RI == ModuleAnalysisResults.end() ? 0 : &*RI->second;
return RI == ModuleAnalysisResults.end() ? nullptr : &*RI->second;
}
void ModuleAnalysisManager::invalidateImpl(void *PassID, Module *M) {
@ -135,7 +135,7 @@ FunctionAnalysisManager::ResultConceptT *
FunctionAnalysisManager::getCachedResultImpl(void *PassID, Function *F) const {
FunctionAnalysisResultMapT::const_iterator RI =
FunctionAnalysisResults.find(std::make_pair(PassID, F));
return RI == FunctionAnalysisResults.end() ? 0 : &*RI->second->second;
return RI == FunctionAnalysisResults.end() ? nullptr : &*RI->second->second;
}
void FunctionAnalysisManager::invalidateImpl(void *PassID, Function *F) {

View File

@ -81,14 +81,14 @@ PassRegistry::~PassRegistry() {
delete *I;
delete Impl;
pImpl = 0;
pImpl = nullptr;
}
const PassInfo *PassRegistry::getPassInfo(const void *TI) const {
sys::SmartScopedReader<true> Guard(*Lock);
PassRegistryImpl *Impl = static_cast<PassRegistryImpl*>(getImpl());
PassRegistryImpl::MapType::const_iterator I = Impl->PassInfoMap.find(TI);
return I != Impl->PassInfoMap.end() ? I->second : 0;
return I != Impl->PassInfoMap.end() ? I->second : nullptr;
}
const PassInfo *PassRegistry::getPassInfo(StringRef Arg) const {
@ -96,7 +96,7 @@ const PassInfo *PassRegistry::getPassInfo(StringRef Arg) const {
PassRegistryImpl *Impl = static_cast<PassRegistryImpl*>(getImpl());
PassRegistryImpl::StringMapType::const_iterator
I = Impl->PassInfoStringMap.find(Arg);
return I != Impl->PassInfoStringMap.end() ? I->second : 0;
return I != Impl->PassInfoStringMap.end() ? I->second : nullptr;
}
//===----------------------------------------------------------------------===//
@ -148,7 +148,7 @@ void PassRegistry::registerAnalysisGroup(const void *InterfaceID,
bool isDefault,
bool ShouldFree) {
PassInfo *InterfaceInfo = const_cast<PassInfo*>(getPassInfo(InterfaceID));
if (InterfaceInfo == 0) {
if (!InterfaceInfo) {
// First reference to Interface, register it now.
registerPass(Registeree);
InterfaceInfo = &Registeree;

View File

@ -36,7 +36,7 @@ Type *Type::getPrimitiveType(LLVMContext &C, TypeID IDNumber) {
case MetadataTyID : return getMetadataTy(C);
case X86_MMXTyID : return getX86_MMXTy(C);
default:
return 0;
return nullptr;
}
}
@ -312,8 +312,8 @@ IntegerType *IntegerType::get(LLVMContext &C, unsigned NumBits) {
}
IntegerType *&Entry = C.pImpl->IntegerTypes[NumBits];
if (Entry == 0)
if (!Entry)
Entry = new (C.pImpl->TypeAllocator) IntegerType(C, NumBits);
return Entry;
@ -448,7 +448,7 @@ void StructType::setName(StringRef Name) {
if (SymbolTableEntry) {
// Delete the old string data.
((EntryTy *)SymbolTableEntry)->Destroy(SymbolTable.getAllocator());
SymbolTableEntry = 0;
SymbolTableEntry = nullptr;
}
return;
}
@ -576,8 +576,8 @@ bool StructType::isSized(SmallPtrSet<const Type*, 4> *Visited) const {
StringRef StructType::getName() const {
assert(!isLiteral() && "Literal structs never have names");
if (SymbolTableEntry == 0) return StringRef();
if (!SymbolTableEntry) return StringRef();
return ((StringMapEntry<StructType*> *)SymbolTableEntry)->getKey();
}
@ -680,8 +680,8 @@ ArrayType *ArrayType::get(Type *elementType, uint64_t NumElements) {
LLVMContextImpl *pImpl = ElementType->getContext().pImpl;
ArrayType *&Entry =
pImpl->ArrayTypes[std::make_pair(ElementType, NumElements)];
if (Entry == 0)
if (!Entry)
Entry = new (pImpl->TypeAllocator) ArrayType(ElementType, NumElements);
return Entry;
}
@ -709,8 +709,8 @@ VectorType *VectorType::get(Type *elementType, unsigned NumElements) {
LLVMContextImpl *pImpl = ElementType->getContext().pImpl;
VectorType *&Entry = ElementType->getContext().pImpl
->VectorTypes[std::make_pair(ElementType, NumElements)];
if (Entry == 0)
if (!Entry)
Entry = new (pImpl->TypeAllocator) VectorType(ElementType, NumElements);
return Entry;
}
@ -734,7 +734,7 @@ PointerType *PointerType::get(Type *EltTy, unsigned AddressSpace) {
PointerType *&Entry = AddressSpace == 0 ? CImpl->PointerTypes[EltTy]
: CImpl->ASPointerTypes[std::make_pair(EltTy, AddressSpace)];
if (Entry == 0)
if (!Entry)
Entry = new (CImpl->TypeAllocator) PointerType(EltTy, AddressSpace);
return Entry;
}

View File

@ -27,14 +27,14 @@ void Use::swap(Use &RHS) {
Val = RHS.Val;
Val->addUse(*this);
} else {
Val = 0;
Val = nullptr;
}
if (OldVal) {
RHS.Val = OldVal;
RHS.Val->addUse(RHS);
} else {
RHS.Val = 0;
RHS.Val = nullptr;
}
}

View File

@ -44,7 +44,7 @@ static inline Type *checkType(Type *Ty) {
Value::Value(Type *ty, unsigned scid)
: SubclassID(scid), HasValueHandle(0),
SubclassOptionalData(0), SubclassData(0), VTy((Type*)checkType(ty)),
UseList(0), Name(0) {
UseList(nullptr), Name(nullptr) {
// FIXME: Why isn't this in the subclass gunk??
// Note, we cannot call isa<CallInst> before the CallInst has been
// constructed.
@ -141,7 +141,7 @@ unsigned Value::getNumUses() const {
}
static bool getSymTab(Value *V, ValueSymbolTable *&ST) {
ST = 0;
ST = nullptr;
if (Instruction *I = dyn_cast<Instruction>(V)) {
if (BasicBlock *P = I->getParent())
if (Function *PP = P->getParent())
@ -203,7 +203,7 @@ void Value::setName(const Twine &NewName) {
if (NameRef.empty()) {
// Free the name for this value.
Name->Destroy();
Name = 0;
Name = nullptr;
return;
}
@ -225,7 +225,7 @@ void Value::setName(const Twine &NewName) {
// Remove old name.
ST->removeValueName(Name);
Name->Destroy();
Name = 0;
Name = nullptr;
if (NameRef.empty())
return;
@ -241,7 +241,7 @@ void Value::setName(const Twine &NewName) {
void Value::takeName(Value *V) {
assert(SubclassID != MDStringVal && "Cannot take the name of an MDString!");
ValueSymbolTable *ST = 0;
ValueSymbolTable *ST = nullptr;
// If this value has a name, drop it.
if (hasName()) {
// Get the symtab this is in.
@ -256,7 +256,7 @@ void Value::takeName(Value *V) {
if (ST)
ST->removeValueName(Name);
Name->Destroy();
Name = 0;
Name = nullptr;
}
// Now we know that this has no name.
@ -283,7 +283,7 @@ void Value::takeName(Value *V) {
if (ST == VST) {
// Take the name!
Name = V->Name;
V->Name = 0;
V->Name = nullptr;
Name->setValue(this);
return;
}
@ -294,7 +294,7 @@ void Value::takeName(Value *V) {
if (VST)
VST->removeValueName(V->Name);
Name = V->Name;
V->Name = 0;
V->Name = nullptr;
Name->setValue(this);
if (ST)
@ -652,7 +652,7 @@ void ValueHandleBase::ValueIsDeleted(Value *V) {
break;
case Weak:
// Weak just goes to null, which will unlink it from the list.
Entry->operator=(0);
Entry->operator=(nullptr);
break;
case Callback:
// Forward to the subclass's implementation.

View File

@ -56,7 +56,7 @@ void ValueSymbolTable::reinsertValue(Value* V) {
// Try insert the vmap entry with this suffix.
ValueName &NewName = vmap.GetOrCreateValue(UniqueName);
if (NewName.getValue() == 0) {
if (!NewName.getValue()) {
// Newly inserted name. Success!
NewName.setValue(V);
V->Name = &NewName;
@ -78,7 +78,7 @@ void ValueSymbolTable::removeValueName(ValueName *V) {
ValueName *ValueSymbolTable::createValueName(StringRef Name, Value *V) {
// In the common case, the name is not already in the symbol table.
ValueName &Entry = vmap.GetOrCreateValue(Name);
if (Entry.getValue() == 0) {
if (!Entry.getValue()) {
Entry.setValue(V);
//DEBUG(dbgs() << " Inserted value: " << Entry.getKeyData() << ": "
// << *V << "\n");
@ -95,7 +95,7 @@ ValueName *ValueSymbolTable::createValueName(StringRef Name, Value *V) {
// Try insert the vmap entry with this suffix.
ValueName &NewName = vmap.GetOrCreateValue(UniqueName);
if (NewName.getValue() == 0) {
if (!NewName.getValue()) {
// Newly inserted name. Success!
NewName.setValue(V);
//DEBUG(dbgs() << " Inserted value: " << UniqueName << ": " << *V << "\n");

View File

@ -111,7 +111,8 @@ class Verifier : public InstVisitor<Verifier> {
public:
explicit Verifier(raw_ostream &OS = dbgs())
: OS(OS), M(0), Context(0), DL(0), PersonalityFn(0), Broken(false) {}
: OS(OS), M(nullptr), Context(nullptr), DL(nullptr),
PersonalityFn(nullptr), Broken(false) {}
bool verify(const Function &F) {
M = F.getParent();
@ -146,7 +147,7 @@ public:
// FIXME: We strip const here because the inst visitor strips const.
visit(const_cast<Function &>(F));
InstsInThisBlock.clear();
PersonalityFn = 0;
PersonalityFn = nullptr;
if (VerifyDebugInfo)
// Verify Debug Info.
@ -300,9 +301,9 @@ private:
// CheckFailed - A check failed, so print out the condition and the message
// that failed. This provides a nice place to put a breakpoint if you want
// to see why something is not correct.
void CheckFailed(const Twine &Message, const Value *V1 = 0,
const Value *V2 = 0, const Value *V3 = 0,
const Value *V4 = 0) {
void CheckFailed(const Twine &Message, const Value *V1 = nullptr,
const Value *V2 = nullptr, const Value *V3 = nullptr,
const Value *V4 = nullptr) {
OS << Message.str() << "\n";
WriteValue(V1);
WriteValue(V2);
@ -312,7 +313,7 @@ private:
}
void CheckFailed(const Twine &Message, const Value *V1, Type *T2,
const Value *V3 = 0) {
const Value *V3 = nullptr) {
OS << Message.str() << "\n";
WriteValue(V1);
WriteType(T2);
@ -320,7 +321,8 @@ private:
Broken = true;
}
void CheckFailed(const Twine &Message, Type *T1, Type *T2 = 0, Type *T3 = 0) {
void CheckFailed(const Twine &Message, Type *T1, Type *T2 = nullptr,
Type *T3 = nullptr) {
OS << Message.str() << "\n";
WriteType(T1);
WriteType(T2);
@ -344,7 +346,7 @@ private:
void Verifier::visit(Instruction &I) {
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i)
Assert1(I.getOperand(i) != 0, "Operand is null", &I);
Assert1(I.getOperand(i) != nullptr, "Operand is null", &I);
InstVisitor<Verifier>::visit(I);
}
@ -521,7 +523,7 @@ void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
Assert1(!MD->isFunctionLocal(),
"Named metadata operand cannot be function local!", MD);
visitMDNode(*MD, 0);
visitMDNode(*MD, nullptr);
}
}
@ -547,7 +549,7 @@ void Verifier::visitMDNode(MDNode &MD, Function *F) {
// If this was an instruction, bb, or argument, verify that it is in the
// function that we expect.
Function *ActualF = 0;
Function *ActualF = nullptr;
if (Instruction *I = dyn_cast<Instruction>(Op))
ActualF = I->getParent()->getParent();
else if (BasicBlock *BB = dyn_cast<BasicBlock>(Op))
@ -1529,7 +1531,7 @@ void Verifier::VerifyCallSite(CallSite CS) {
}
// Verify that there's no metadata unless it's a direct call to an intrinsic.
if (CS.getCalledFunction() == 0 ||
if (CS.getCalledFunction() == nullptr ||
!CS.getCalledFunction()->getName().startswith("llvm.")) {
for (FunctionType::param_iterator PI = FTy->param_begin(),
PE = FTy->param_end(); PI != PE; ++PI)
@ -2019,8 +2021,8 @@ void Verifier::visitInstruction(Instruction &I) {
// instruction, it is an error!
for (Use &U : I.uses()) {
if (Instruction *Used = dyn_cast<Instruction>(U.getUser()))
Assert2(Used->getParent() != 0, "Instruction referencing instruction not"
" embedded in a basic block!", &I, Used);
Assert2(Used->getParent() != nullptr, "Instruction referencing"
" instruction not embedded in a basic block!", &I, Used);
else {
CheckFailed("Use of instruction is not an instruction!", U);
return;
@ -2028,7 +2030,7 @@ void Verifier::visitInstruction(Instruction &I) {
}
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) {
Assert1(I.getOperand(i) != 0, "Instruction has null operand!", &I);
Assert1(I.getOperand(i) != nullptr, "Instruction has null operand!", &I);
// Check to make sure that only first-class-values are operands to
// instructions.
@ -2136,18 +2138,18 @@ bool Verifier::VerifyIntrinsicType(Type *Ty,
case IITDescriptor::Integer: return !Ty->isIntegerTy(D.Integer_Width);
case IITDescriptor::Vector: {
VectorType *VT = dyn_cast<VectorType>(Ty);
return VT == 0 || VT->getNumElements() != D.Vector_Width ||
return !VT || VT->getNumElements() != D.Vector_Width ||
VerifyIntrinsicType(VT->getElementType(), Infos, ArgTys);
}
case IITDescriptor::Pointer: {
PointerType *PT = dyn_cast<PointerType>(Ty);
return PT == 0 || PT->getAddressSpace() != D.Pointer_AddressSpace ||
return !PT || PT->getAddressSpace() != D.Pointer_AddressSpace ||
VerifyIntrinsicType(PT->getElementType(), Infos, ArgTys);
}
case IITDescriptor::Struct: {
StructType *ST = dyn_cast<StructType>(Ty);
if (ST == 0 || ST->getNumElements() != D.Struct_NumElements)
if (!ST || ST->getNumElements() != D.Struct_NumElements)
return true;
for (unsigned i = 0, e = D.Struct_NumElements; i != e; ++i)