diff options
author | Craig Topper <craig.topper@gmail.com> | 2014-05-21 05:09:00 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2014-05-21 05:09:00 +0000 |
commit | 8a13c4180e1a50fd4458ad522e2c271ce8ceb3d6 (patch) | |
tree | be98b83ca922b4a9f79937f9166969913f2edcb8 /clang/lib/CodeGen/CGExprScalar.cpp | |
parent | 5c35c8c9abc2a830c912c70d51c72197917470c7 (diff) | |
download | bcm5719-llvm-8a13c4180e1a50fd4458ad522e2c271ce8ceb3d6.tar.gz bcm5719-llvm-8a13c4180e1a50fd4458ad522e2c271ce8ceb3d6.zip |
[C++11] Use 'nullptr'. CodeGen edition.
llvm-svn: 209272
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 522a0e2d23a..1ee3ce84ce2 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -365,7 +365,7 @@ public: } Value *VisitCXXDeleteExpr(const CXXDeleteExpr *E) { CGF.EmitCXXDeleteExpr(E); - return 0; + return nullptr; } Value *VisitTypeTraitExpr(const TypeTraitExpr *E) { @@ -387,7 +387,7 @@ public: // effect is the evaluation of the postfix-expression before the dot or // arrow. CGF.EmitScalarExpr(E->getBase()); - return 0; + return nullptr; } Value *VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *E) { @@ -396,7 +396,7 @@ public: Value *VisitCXXThrowExpr(const CXXThrowExpr *E) { CGF.EmitCXXThrowExpr(E); - return 0; + return nullptr; } Value *VisitCXXNoexceptExpr(const CXXNoexceptExpr *E) { @@ -559,7 +559,7 @@ void ScalarExprEmitter::EmitFloatConversionCheck(Value *OrigSrc, llvm::Type *SrcTy = Src->getType(); - llvm::Value *Check = 0; + llvm::Value *Check = nullptr; if (llvm::IntegerType *IntTy = dyn_cast<llvm::IntegerType>(SrcTy)) { // Integer to floating-point. This can fail for unsigned short -> __half // or unsigned __int128 -> float. @@ -693,7 +693,7 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType, DstType = CGF.getContext().getCanonicalType(DstType); if (SrcType == DstType) return Src; - if (DstType->isVoidType()) return 0; + if (DstType->isVoidType()) return nullptr; llvm::Value *OrigSrc = Src; QualType OrigSrcType = SrcType; @@ -758,7 +758,7 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType, return Builder.CreateBitCast(Src, DstTy, "conv"); // Finally, we have the arithmetic types: real int/float. - Value *Res = NULL; + Value *Res = nullptr; llvm::Type *ResTy = DstTy; // An overflowing conversion has undefined behavior if either the source type @@ -887,7 +887,7 @@ void ScalarExprEmitter::EmitBinOpCheck(Value *Check, const BinOpInfo &Info) { Value *ScalarExprEmitter::VisitExpr(Expr *E) { CGF.ErrorUnsupported(E, "scalar expression"); if (E->getType()->isVoidType()) - return 0; + return nullptr; return llvm::UndefValue::get(CGF.ConvertType(E->getType())); } @@ -1013,7 +1013,7 @@ Value *ScalarExprEmitter::VisitConvertVectorExpr(ConvertVectorExpr *E) { } // We have the arithmetic types: real int/float. - Value *Res = NULL; + Value *Res = nullptr; if (isa<llvm::IntegerType>(SrcEltTy)) { bool InputSigned = SrcEltType->isSignedIntegerOrEnumerationType(); @@ -1133,7 +1133,7 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { if (EI->getVectorOperandType()->getNumElements() == ResElts) { llvm::ConstantInt *C = cast<llvm::ConstantInt>(EI->getIndexOperand()); - Value *LHS = 0, *RHS = 0; + Value *LHS = nullptr, *RHS = nullptr; if (CurIdx == 0) { // insert into undef -> shuffle (src, undef) Args.push_back(C); @@ -1450,7 +1450,7 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { case CK_ToVoid: { CGF.EmitIgnoredExpr(E); - return 0; + return nullptr; } case CK_VectorSplat: { llvm::Type *DstTy = ConvertType(DestTy); @@ -1507,7 +1507,7 @@ Value *ScalarExprEmitter::VisitStmtExpr(const StmtExpr *E) { llvm::Value *RetAlloca = CGF.EmitCompoundStmt(*E->getSubStmt(), !E->getType()->isVoidType()); if (!RetAlloca) - return 0; + return nullptr; return CGF.EmitLoadOfScalar(CGF.MakeAddrLValue(RetAlloca, E->getType()), E->getExprLoc()); } @@ -1545,7 +1545,7 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV, bool isInc, bool isPre) { QualType type = E->getSubExpr()->getType(); - llvm::PHINode *atomicPHI = 0; + llvm::PHINode *atomicPHI = nullptr; llvm::Value *value; llvm::Value *input; @@ -1819,7 +1819,7 @@ Value *ScalarExprEmitter::VisitOffsetOfExpr(OffsetOfExpr *E) { QualType CurrentType = E->getTypeSourceInfo()->getType(); for (unsigned i = 0; i != n; ++i) { OffsetOfExpr::OffsetOfNode ON = E->getComponent(i); - llvm::Value *Offset = 0; + llvm::Value *Offset = nullptr; switch (ON.getKind()) { case OffsetOfExpr::OffsetOfNode::Array: { // Compute the index @@ -2009,7 +2009,7 @@ LValue ScalarExprEmitter::EmitCompoundAssignLValue( // Load/convert the LHS. LValue LHSLV = EmitCheckedLValue(E->getLHS(), CodeGenFunction::TCK_Store); - llvm::PHINode *atomicPHI = 0; + llvm::PHINode *atomicPHI = nullptr; if (const AtomicType *atomicTy = LHSTy->getAs<AtomicType>()) { QualType type = atomicTy->getValueType(); if (!type->isBooleanType() && type->isIntegerType() && @@ -2108,7 +2108,7 @@ Value *ScalarExprEmitter::EmitCompoundAssign(const CompoundAssignOperator *E, // If the result is clearly ignored, return now. if (Ignore) - return 0; + return nullptr; // The result of an assignment in C is the assigned r-value. if (!CGF.getLangOpts().CPlusPlus) @@ -2124,7 +2124,7 @@ Value *ScalarExprEmitter::EmitCompoundAssign(const CompoundAssignOperator *E, void ScalarExprEmitter::EmitUndefinedBehaviorIntegerDivAndRemCheck( const BinOpInfo &Ops, llvm::Value *Zero, bool isDiv) { - llvm::Value *Cond = 0; + llvm::Value *Cond = nullptr; if (CGF.SanOpts->IntegerDivideByZero) Cond = Builder.CreateICmpNE(Ops.RHS, Zero); @@ -2428,12 +2428,12 @@ static Value* tryEmitFMulAdd(const BinOpInfo &op, // Check whether this op is marked as fusable. if (!op.FPContractable) - return 0; + return nullptr; // Check whether -ffp-contract=on. (If -ffp-contract=off/fast, fusing is // either disabled, or handled entirely by the LLVM backend). if (CGF.CGM.getCodeGenOpts().getFPContractMode() != CodeGenOptions::FPC_On) - return 0; + return nullptr; // We have a potentially fusable op. Look for a mul on one of the operands. if (llvm::BinaryOperator* LHSBinOp = dyn_cast<llvm::BinaryOperator>(op.LHS)) { @@ -2451,7 +2451,7 @@ static Value* tryEmitFMulAdd(const BinOpInfo &op, } } - return 0; + return nullptr; } Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &op) { @@ -2533,7 +2533,7 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &op) { const BinaryOperator *expr = cast<BinaryOperator>(op.E); QualType elementType = expr->getLHS()->getType()->getPointeeType(); - llvm::Value *divisor = 0; + llvm::Value *divisor = nullptr; // For a variable-length array, this is going to be non-constant. if (const VariableArrayType *vla @@ -2861,7 +2861,7 @@ Value *ScalarExprEmitter::VisitBinAssign(const BinaryOperator *E) { // If the result is clearly ignored, return now. if (Ignore) - return 0; + return nullptr; // The result of an assignment in C is the assigned r-value. if (!CGF.getLangOpts().CPlusPlus) @@ -3152,7 +3152,7 @@ VisitAbstractConditionalOperator(const AbstractConditionalOperator *E) { if (!LHS) { // If the conditional has void type, make sure we return a null Value*. assert(!RHS && "LHS and RHS types must match"); - return 0; + return nullptr; } return Builder.CreateSelect(CondV, LHS, RHS, "cond"); } @@ -3349,7 +3349,7 @@ LValue CodeGenFunction::EmitObjCIsaExpr(const ObjCIsaExpr *E) { LValue CodeGenFunction::EmitCompoundAssignmentLValue( const CompoundAssignOperator *E) { ScalarExprEmitter Scalar(*this); - Value *Result = 0; + Value *Result = nullptr; switch (E->getOpcode()) { #define COMPOUND_OP(Op) \ case BO_##Op##Assign: \ |