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/CGExprCXX.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/CGExprCXX.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprCXX.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index 3a116062b82..548cd488900 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -95,7 +95,7 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, const Expr *Base = ME->getBase(); bool CanUseVirtualCall = MD->isVirtual() && !ME->hasQualifier(); - const CXXMethodDecl *DevirtualizedMethod = NULL; + const CXXMethodDecl *DevirtualizedMethod = nullptr; if (CanUseVirtualCall && CanDevirtualizeMemberFunctionCall(Base, MD)) { const CXXRecordDecl *BestDynamicDecl = Base->getBestDynamicClassType(); DevirtualizedMethod = MD->getCorrespondingMethodInClass(BestDynamicDecl); @@ -111,7 +111,7 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, // one or the one of the full expression, we would have to build // a derived-to-base cast to compute the correct this pointer, but // we don't have support for that yet, so do a virtual call. - DevirtualizedMethod = NULL; + DevirtualizedMethod = nullptr; } // If the return types are not the same, this might be a case where more // code needs to run to compensate for it. For example, the derived @@ -121,7 +121,7 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, if (DevirtualizedMethod && DevirtualizedMethod->getReturnType().getCanonicalType() != MD->getReturnType().getCanonicalType()) - DevirtualizedMethod = NULL; + DevirtualizedMethod = nullptr; } llvm::Value *This; @@ -132,10 +132,10 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, if (MD->isTrivial()) { - if (isa<CXXDestructorDecl>(MD)) return RValue::get(0); + if (isa<CXXDestructorDecl>(MD)) return RValue::get(nullptr); if (isa<CXXConstructorDecl>(MD) && cast<CXXConstructorDecl>(MD)->isDefaultConstructor()) - return RValue::get(0); + return RValue::get(nullptr); if (MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator()) { // We don't like to generate the trivial copy/move assignment operator @@ -158,7 +158,7 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, // Compute the function type we're calling. const CXXMethodDecl *CalleeDecl = DevirtualizedMethod ? DevirtualizedMethod : MD; - const CGFunctionInfo *FInfo = 0; + const CGFunctionInfo *FInfo = nullptr; if (const CXXDestructorDecl *Dtor = dyn_cast<CXXDestructorDecl>(CalleeDecl)) FInfo = &CGM.getTypes().arrangeCXXDestructor(Dtor, Dtor_Complete); @@ -199,9 +199,9 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, Callee = CGM.GetAddrOfFunction(GlobalDecl(DDtor, Dtor_Complete), Ty); } EmitCXXMemberCall(MD, CE->getExprLoc(), Callee, ReturnValue, This, - /*ImplicitParam=*/0, QualType(), 0, 0); + /*ImplicitParam=*/nullptr, QualType(), nullptr,nullptr); } - return RValue::get(0); + return RValue::get(nullptr); } if (const CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(MD)) { @@ -226,7 +226,7 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, } return EmitCXXMemberCall(MD, CE->getExprLoc(), Callee, ReturnValue, This, - /*ImplicitParam=*/0, QualType(), + /*ImplicitParam=*/nullptr, QualType(), CE->arg_begin(), CE->arg_end()); } @@ -299,7 +299,7 @@ CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E, llvm::Value *Callee = EmitCXXOperatorMemberCallee(E, MD, This); return EmitCXXMemberCall(MD, E->getExprLoc(), Callee, ReturnValue, This, - /*ImplicitParam=*/0, QualType(), + /*ImplicitParam=*/nullptr, QualType(), E->arg_begin() + 1, E->arg_end()); } @@ -586,7 +586,7 @@ static llvm::Value *EmitCXXNewAllocSize(CodeGenFunction &CGF, // size := sizeWithoutCookie + cookieSize // and check whether it overflows. - llvm::Value *hasOverflow = 0; + llvm::Value *hasOverflow = nullptr; // If numElementsWidth > sizeWidth, then one way or another, we're // going to have to do a comparison for (2), and this happens to @@ -726,8 +726,8 @@ static void StoreAnyExprIntoOneUnit(CodeGenFunction &CGF, const Expr *Init, CharUnits Alignment = CGF.getContext().getTypeAlignInChars(AllocType); switch (CGF.getEvaluationKind(AllocType)) { case TEK_Scalar: - CGF.EmitScalarInit(Init, 0, CGF.MakeAddrLValue(NewPtr, AllocType, - Alignment), + CGF.EmitScalarInit(Init, nullptr, CGF.MakeAddrLValue(NewPtr, AllocType, + Alignment), false); return; case TEK_Complex: @@ -764,10 +764,10 @@ CodeGenFunction::EmitNewArrayInitializer(const CXXNewExpr *E, unsigned initializerElements = 0; const Expr *Init = E->getInitializer(); - llvm::AllocaInst *endOfInit = 0; + llvm::AllocaInst *endOfInit = nullptr; QualType::DestructionKind dtorKind = elementType.isDestructedType(); EHScopeStack::stable_iterator cleanup; - llvm::Instruction *cleanupDominator = 0; + llvm::Instruction *cleanupDominator = nullptr; // If the initializer is an initializer list, first do the explicit elements. if (const InitListExpr *ILE = dyn_cast<InitListExpr>(Init)) { @@ -1161,8 +1161,8 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) { minElements = ILE->getNumInits(); } - llvm::Value *numElements = 0; - llvm::Value *allocSizeWithoutCookie = 0; + llvm::Value *numElements = nullptr; + llvm::Value *allocSizeWithoutCookie = nullptr; llvm::Value *allocSize = EmitCXXNewAllocSize(*this, E, minElements, numElements, allocSizeWithoutCookie); @@ -1196,8 +1196,8 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) { bool nullCheck = allocatorType->isNothrow(getContext()) && (!allocType.isPODType(getContext()) || E->hasInitializer()); - llvm::BasicBlock *nullCheckBB = 0; - llvm::BasicBlock *contBB = 0; + llvm::BasicBlock *nullCheckBB = nullptr; + llvm::BasicBlock *contBB = nullptr; llvm::Value *allocation = RV.getScalarVal(); unsigned AS = allocation->getType()->getPointerAddressSpace(); @@ -1221,7 +1221,7 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) { // If there's an operator delete, enter a cleanup to call it if an // exception is thrown. EHScopeStack::stable_iterator operatorDeleteCleanup; - llvm::Instruction *cleanupDominator = 0; + llvm::Instruction *cleanupDominator = nullptr; if (E->getOperatorDelete() && !E->getOperatorDelete()->isReservedGlobalPlacementOperator()) { EnterNewDeleteCleanup(*this, E, allocation, allocSize, allocatorArgs); @@ -1288,7 +1288,7 @@ void CodeGenFunction::EmitDeleteCall(const FunctionDecl *DeleteFD, CallArgList DeleteArgs; // Check if we need to pass the size to the delete operator. - llvm::Value *Size = 0; + llvm::Value *Size = nullptr; QualType SizeTy; if (DeleteFTy->getNumParams() == 2) { SizeTy = DeleteFTy->getParamType(1); @@ -1334,7 +1334,7 @@ static void EmitObjectDelete(CodeGenFunction &CGF, bool UseGlobalDelete) { // Find the destructor for the type, if applicable. If the // destructor is virtual, we'll just emit the vcall and return. - const CXXDestructorDecl *Dtor = 0; + const CXXDestructorDecl *Dtor = nullptr; if (const RecordType *RT = ElementType->getAs<RecordType>()) { CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl()); if (RD->hasDefinition() && !RD->hasTrivialDestructor()) { @@ -1471,8 +1471,8 @@ static void EmitArrayDelete(CodeGenFunction &CGF, const CXXDeleteExpr *E, llvm::Value *deletedPtr, QualType elementType) { - llvm::Value *numElements = 0; - llvm::Value *allocatedPtr = 0; + llvm::Value *numElements = nullptr; + llvm::Value *allocatedPtr = nullptr; CharUnits cookieSize; CGF.CGM.getCXXABI().ReadArrayCookie(CGF, deletedPtr, E, elementType, numElements, allocatedPtr, cookieSize); @@ -1820,9 +1820,9 @@ llvm::Value *CodeGenFunction::EmitDynamicCast(llvm::Value *Value, // If the value of v is a null pointer value in the pointer case, the result // is the null pointer value of type T. bool ShouldNullCheckSrcValue = SrcTy->isPointerType(); - - llvm::BasicBlock *CastNull = 0; - llvm::BasicBlock *CastNotNull = 0; + + llvm::BasicBlock *CastNull = nullptr; + llvm::BasicBlock *CastNotNull = nullptr; llvm::BasicBlock *CastEnd = createBasicBlock("dynamic_cast.end"); if (ShouldNullCheckSrcValue) { |