From: Craig Topper Date: Fri, 26 Jul 2013 05:59:26 +0000 (+0000) Subject: Remove trailing whitespace. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1cc87df9747f31d1b300a29920aa8b62144b7bb2;p=clang Remove trailing whitespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187189 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index d6ff93f5fb..ad80afd8ba 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -664,12 +664,12 @@ CodeGenFunction::ComplexPairTy CodeGenFunction:: EmitComplexPrePostIncDec(const UnaryOperator *E, LValue LV, bool isInc, bool isPre) { ComplexPairTy InVal = EmitLoadOfComplex(LV); - + llvm::Value *NextVal; if (isa(InVal.first->getType())) { uint64_t AmountVal = isInc ? 1 : -1; NextVal = llvm::ConstantInt::get(InVal.first->getType(), AmountVal, true); - + // Add the inc/dec to the real part. NextVal = Builder.CreateAdd(InVal.first, NextVal, isInc ? "inc" : "dec"); } else { @@ -678,16 +678,16 @@ EmitComplexPrePostIncDec(const UnaryOperator *E, LValue LV, if (!isInc) FVal.changeSign(); NextVal = llvm::ConstantFP::get(getLLVMContext(), FVal); - + // Add the inc/dec to the real part. NextVal = Builder.CreateFAdd(InVal.first, NextVal, isInc ? "inc" : "dec"); } - + ComplexPairTy IncVal(NextVal, InVal.second); - + // Store the updated result through the lvalue. EmitStoreOfComplex(IncVal, LV, /*init*/ false); - + // If this is a postinc, return the value read from memory, otherwise use the // updated value. return isPre ? IncVal : InVal; @@ -709,7 +709,7 @@ RValue CodeGenFunction::GetUndefRValue(QualType Ty) { llvm::Value *U = llvm::UndefValue::get(EltTy); return RValue::getComplex(std::make_pair(U, U)); } - + // If this is a use of an undefined aggregate type, the aggregate must have an // identifiable address. Just because the contents of the value are undefined // doesn't mean that the address can't be taken and compared. @@ -967,7 +967,7 @@ CodeGenFunction::tryEmitAsConstant(DeclRefExpr *refExpr) { llvm::Constant *C = CGM.EmitConstantValue(result.Val, resultType, this); // Make sure we emit a debug reference to the global variable. - // This should probably fire even for + // This should probably fire even for if (isa(value)) { if (!getContext().DeclMustBeEmitted(cast(value))) EmitDeclRefExprDbgValue(refExpr, C); @@ -1057,12 +1057,12 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(llvm::Value *Addr, bool Volatile, llvm::Value *V; const llvm::Type *EltTy = cast(Addr->getType())->getElementType(); - + const llvm::VectorType *VTy = cast(EltTy); - + // Handle vectors of size 3, like size 4 for better performance. if (VTy->getNumElements() == 3) { - + // Bitcast to vec4 type. llvm::VectorType *vec4Ty = llvm::VectorType::get(VTy->getElementType(), 4); @@ -1097,7 +1097,7 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(llvm::Value *Addr, bool Volatile, getContext(), TBAAInfo); return EmitAtomicLoad(lvalue).getScalarVal(); } - + llvm::LoadInst *Load = Builder.CreateLoad(Addr); if (Volatile) Load->setVolatile(true); @@ -1167,7 +1167,7 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, llvm::Value *Addr, llvm::MDNode *TBAAInfo, bool isInit, QualType TBAABaseType, uint64_t TBAAOffset) { - + // Handle vectors differently to get better performance. if (Ty->isVectorType()) { llvm::Type *SrcTy = Value->getType(); @@ -1175,7 +1175,7 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, llvm::Value *Addr, // Handle vec3 special. if (VecTy->getNumElements() == 3) { llvm::LLVMContext &VMContext = getLLVMContext(); - + // Our source is a vec3, do a shuffle vector to make it a vec4. SmallVector Mask; Mask.push_back(llvm::ConstantInt::get( @@ -1188,7 +1188,7 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, llvm::Value *Addr, llvm::Type::getInt32Ty(VMContext), 2)); Mask.push_back(llvm::UndefValue::get(llvm::Type::getInt32Ty(VMContext))); - + llvm::Value *MaskV = llvm::ConstantVector::get(Mask); Value = Builder.CreateShuffleVector(Value, llvm::UndefValue::get(VecTy), @@ -1202,7 +1202,7 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, llvm::Value *Addr, Addr = Builder.CreateBitCast(Addr, MemTy, "storetmp"); } } - + Value = EmitToMemory(Value, Ty); if (Ty->isAtomicType()) { @@ -1409,7 +1409,7 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit llvm::Value *RHS = EmitScalarExpr(Dst.getBaseIvarExp()); llvm::Value *dst = RHS; RHS = Builder.CreatePtrToInt(RHS, ResultType, "sub.ptr.rhs.cast"); - llvm::Value *LHS = + llvm::Value *LHS = Builder.CreatePtrToInt(LvalueDst, ResultType, "sub.ptr.lhs.cast"); llvm::Value *BytesBetween = Builder.CreateSub(LHS, RHS, "ivar.offset"); CGM.getObjCRuntime().EmitObjCIvarAssign(*this, src, dst, @@ -1574,12 +1574,12 @@ static void setObjCGCLValueClass(const ASTContext &Ctx, const Expr *E, bool IsMemberAccess=false) { if (Ctx.getLangOpts().getGC() == LangOptions::NonGC) return; - + if (isa(E)) { QualType ExpTy = E->getType(); if (IsMemberAccess && ExpTy->isPointerType()) { // If ivar is a structure pointer, assigning to field of - // this struct follows gcc's behavior and makes it a non-ivar + // this struct follows gcc's behavior and makes it a non-ivar // writer-barrier conservatively. ExpTy = ExpTy->getAs()->getPointeeType(); if (ExpTy->isRecordType()) { @@ -1593,7 +1593,7 @@ static void setObjCGCLValueClass(const ASTContext &Ctx, const Expr *E, LV.setObjCArray(E->getType()->isArrayType()); return; } - + if (const DeclRefExpr *Exp = dyn_cast(E)) { if (const VarDecl *VD = dyn_cast(Exp->getDecl())) { if (VD->hasGlobalStorage()) { @@ -1604,12 +1604,12 @@ static void setObjCGCLValueClass(const ASTContext &Ctx, const Expr *E, LV.setObjCArray(E->getType()->isArrayType()); return; } - + if (const UnaryOperator *Exp = dyn_cast(E)) { setObjCGCLValueClass(Ctx, Exp->getSubExpr(), LV, IsMemberAccess); return; } - + if (const ParenExpr *Exp = dyn_cast(E)) { setObjCGCLValueClass(Ctx, Exp->getSubExpr(), LV, IsMemberAccess); if (LV.isObjCIvar()) { @@ -1619,7 +1619,7 @@ static void setObjCGCLValueClass(const ASTContext &Ctx, const Expr *E, if (ExpTy->isPointerType()) ExpTy = ExpTy->getAs()->getPointeeType(); if (ExpTy->isRecordType()) - LV.setObjCIvar(false); + LV.setObjCIvar(false); } return; } @@ -1633,7 +1633,7 @@ static void setObjCGCLValueClass(const ASTContext &Ctx, const Expr *E, setObjCGCLValueClass(Ctx, Exp->getSubExpr(), LV, IsMemberAccess); return; } - + if (const CStyleCastExpr *Exp = dyn_cast(E)) { setObjCGCLValueClass(Ctx, Exp->getSubExpr(), LV, IsMemberAccess); return; @@ -1646,12 +1646,12 @@ static void setObjCGCLValueClass(const ASTContext &Ctx, const Expr *E, if (const ArraySubscriptExpr *Exp = dyn_cast(E)) { setObjCGCLValueClass(Ctx, Exp->getBase(), LV); - if (LV.isObjCIvar() && !LV.isObjCArray()) - // Using array syntax to assigning to what an ivar points to is not + if (LV.isObjCIvar() && !LV.isObjCArray()) + // Using array syntax to assigning to what an ivar points to is not // same as assigning to the ivar itself. {id *Names;} Names[i] = 0; - LV.setObjCIvar(false); + LV.setObjCIvar(false); else if (LV.isGlobalObjCRef() && !LV.isObjCArray()) - // Using array syntax to assigning to what global points to is not + // Using array syntax to assigning to what global points to is not // same as assigning to the global itself. {id *G;} G[i] = 0; LV.setGlobalObjCRef(false); return; @@ -1765,7 +1765,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { bool isBlockVariable = VD->hasAttr(); llvm::Value *V = LocalDeclMap.lookup(VD); - if (!V && VD->isStaticLocal()) + if (!V && VD->isStaticLocal()) V = CGM.getStaticLocalDeclAddress(VD); // Use special handling for lambdas. @@ -1873,7 +1873,7 @@ LValue CodeGenFunction::EmitUnaryOpLValue(const UnaryOperator *E) { case UO_PreDec: { LValue LV = EmitLValue(E->getSubExpr()); bool isInc = E->getOpcode() == UO_PreInc; - + if (E->getType()->isAnyComplexType()) EmitComplexPrePostIncDec(E, LV, isInc, true/*isPre*/); else @@ -2199,12 +2199,12 @@ static const Expr *isSimpleArrayDecayOperand(const Expr *E) { const CastExpr *CE = dyn_cast(E); if (CE == 0 || CE->getCastKind() != CK_ArrayToPointerDecay) return 0; - + // If this is a decay from variable width array, bail out. const Expr *SubExpr = CE->getSubExpr(); if (SubExpr->getType()->isVariableArrayType()) return 0; - + return SubExpr; } @@ -2288,7 +2288,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, llvm::Value *ArrayPtr = ArrayLV.getAddress(); llvm::Value *Zero = llvm::ConstantInt::get(Int32Ty, 0); llvm::Value *Args[] = { Zero, Idx }; - + // Propagate the alignment from the array itself to the result. ArrayAlignment = ArrayLV.getAlignment(); @@ -2309,7 +2309,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, assert(!T.isNull() && "CodeGenFunction::EmitArraySubscriptExpr(): Illegal base type"); - + // Limit the alignment to that of the result type. LValue LV; if (!ArrayAlignment.isZero()) { @@ -2363,7 +2363,7 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) { assert(E->getBase()->getType()->isVectorType() && "Result must be a vector"); llvm::Value *Vec = EmitScalarExpr(E->getBase()); - + // Store the vector to memory (because LValue wants an address). llvm::Value *VecMem = CreateMemTemp(E->getBase()->getType()); Builder.CreateStore(Vec, VecMem); @@ -2372,7 +2372,7 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) { QualType type = E->getType().withCVRQualifiers(Base.getQuals().getCVRQualifiers()); - + // Encode the element access list into a vector of unsigned indices. SmallVector Indices; E->getEncodedElementAccess(Indices); @@ -2413,7 +2413,7 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) { setObjCGCLValueClass(getContext(), E, LV); return LV; } - + if (VarDecl *VD = dyn_cast(ND)) return EmitGlobalVarDeclLValue(*this, E, VD); @@ -2508,7 +2508,7 @@ LValue CodeGenFunction::EmitLValueForField(LValue base, cvr = 0; // qualifiers don't recursively apply to referencee } } - + // Make sure that the address is pointing to the right type. This is critical // for both unions and structs. A union needs a bitcast, a struct element // will need a bitcast if the LLVM type laid out doesn't match the desired @@ -2546,11 +2546,11 @@ LValue CodeGenFunction::EmitLValueForField(LValue base, return LV; } -LValue -CodeGenFunction::EmitLValueForFieldInitialization(LValue Base, +LValue +CodeGenFunction::EmitLValueForFieldInitialization(LValue Base, const FieldDecl *Field) { QualType FieldType = Field->getType(); - + if (!FieldType->isReferenceType()) return EmitLValueForField(Base, Field); @@ -2585,7 +2585,7 @@ LValue CodeGenFunction::EmitCompoundLiteralLValue(const CompoundLiteralExpr *E){ if (E->getType()->isVariablyModifiedType()) // make sure to emit the VLA size. EmitVariablyModifiedType(E->getType()); - + llvm::Value *DeclPtr = CreateMemTemp(E->getType(), ".compoundliteral"); const Expr *InitExpr = E->getInitializer(); LValue Result = MakeAddrLValue(DeclPtr, E->getType()); @@ -2633,19 +2633,19 @@ EmitConditionalOperatorLValue(const AbstractConditionalOperator *expr) { ConditionalEvaluation eval(*this); EmitBranchOnBoolExpr(condExpr, lhsBlock, rhsBlock); - + // Any temporaries created here are conditional. EmitBlock(lhsBlock); eval.begin(*this); LValue lhs = EmitLValue(expr->getTrueExpr()); eval.end(*this); - + if (!lhs.isSimple()) return EmitUnsupportedLValue(expr, "conditional operator"); lhsBlock = Builder.GetInsertBlock(); Builder.CreateBr(contBlock); - + // Any temporaries created here are conditional. EmitBlock(rhsBlock); eval.begin(*this); @@ -2707,7 +2707,7 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { case CK_ARCProduceObject: case CK_ARCConsumeObject: case CK_ARCReclaimReturnedObject: - case CK_ARCExtendBlockObject: + case CK_ARCExtendBlockObject: case CK_CopyAndAutoreleaseBlockObject: return EmitUnsupportedLValue(E, "unexpected cast lvalue"); @@ -2736,32 +2736,32 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { case CK_NoOp: case CK_LValueToRValue: return EmitLValue(E->getSubExpr()); - + case CK_UncheckedDerivedToBase: case CK_DerivedToBase: { - const RecordType *DerivedClassTy = + const RecordType *DerivedClassTy = E->getSubExpr()->getType()->getAs(); - CXXRecordDecl *DerivedClassDecl = + CXXRecordDecl *DerivedClassDecl = cast(DerivedClassTy->getDecl()); - + LValue LV = EmitLValue(E->getSubExpr()); llvm::Value *This = LV.getAddress(); - + // Perform the derived-to-base conversion - llvm::Value *Base = - GetAddressOfBaseClass(This, DerivedClassDecl, + llvm::Value *Base = + GetAddressOfBaseClass(This, DerivedClassDecl, E->path_begin(), E->path_end(), /*NullCheckValue=*/false); - + return MakeAddrLValue(Base, E->getType()); } case CK_ToUnion: return EmitAggExprToLValue(E); case CK_BaseToDerived: { const RecordType *DerivedClassTy = E->getType()->getAs(); - CXXRecordDecl *DerivedClassDecl = + CXXRecordDecl *DerivedClassDecl = cast(DerivedClassTy->getDecl()); - + LValue LV = EmitLValue(E->getSubExpr()); // C++11 [expr.static.cast]p2: Behavior is undefined if a downcast is @@ -2771,17 +2771,17 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { LV.getAddress(), E->getType()); // Perform the base-to-derived conversion - llvm::Value *Derived = - GetAddressOfDerivedClass(LV.getAddress(), DerivedClassDecl, + llvm::Value *Derived = + GetAddressOfDerivedClass(LV.getAddress(), DerivedClassDecl, E->path_begin(), E->path_end(), /*NullCheckValue=*/false); - + return MakeAddrLValue(Derived, E->getType()); } case CK_LValueBitCast: { // This must be a reinterpret_cast (or c-style equivalent). const ExplicitCastExpr *CE = cast(E); - + LValue LV = EmitLValue(E->getSubExpr()); llvm::Value *V = Builder.CreateBitCast(LV.getAddress(), ConvertType(CE->getTypeAsWritten())); @@ -2790,14 +2790,14 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { case CK_ObjCObjectLValueCast: { LValue LV = EmitLValue(E->getSubExpr()); QualType ToType = getContext().getLValueReferenceType(E->getType()); - llvm::Value *V = Builder.CreateBitCast(LV.getAddress(), + llvm::Value *V = Builder.CreateBitCast(LV.getAddress(), ConvertType(ToType)); return MakeAddrLValue(V, E->getType()); } case CK_ZeroToOCLEvent: llvm_unreachable("NULL to OpenCL event lvalue cast is not valid"); } - + llvm_unreachable("Unhandled lvalue cast kind?"); } @@ -2825,7 +2825,7 @@ RValue CodeGenFunction::EmitRValueForField(LValue LV, // Expression Emission //===--------------------------------------------------------------------===// -RValue CodeGenFunction::EmitCallExpr(const CallExpr *E, +RValue CodeGenFunction::EmitCallExpr(const CallExpr *E, ReturnValueSlot ReturnValue) { if (CGDebugInfo *DI = getDebugInfo()) { SourceLocation Loc = E->getLocStart(); @@ -2856,7 +2856,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E, if (const CXXMethodDecl *MD = dyn_cast_or_null(TargetDecl)) return EmitCXXOperatorMemberCallExpr(CE, MD, ReturnValue); - if (const CXXPseudoDestructorExpr *PseudoDtor + if (const CXXPseudoDestructorExpr *PseudoDtor = dyn_cast(E->getCallee()->IgnoreParens())) { QualType DestroyedType = PseudoDtor->getDestroyedType(); if (getLangOpts().ObjCAutoRefCount && @@ -2869,7 +2869,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E, Expr *BaseExpr = PseudoDtor->getBase(); llvm::Value *BaseValue = NULL; Qualifiers BaseQuals; - + // If this is s.x, emit s as an lvalue. If it is s->x, emit s as a scalar. if (PseudoDtor->isArrow()) { BaseValue = EmitScalarExpr(BaseExpr); @@ -2881,15 +2881,15 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E, QualType BaseTy = BaseExpr->getType(); BaseQuals = BaseTy.getQualifiers(); } - + switch (PseudoDtor->getDestroyedType().getObjCLifetime()) { case Qualifiers::OCL_None: case Qualifiers::OCL_ExplicitNone: case Qualifiers::OCL_Autoreleasing: break; - + case Qualifiers::OCL_Strong: - EmitARCRelease(Builder.CreateLoad(BaseValue, + EmitARCRelease(Builder.CreateLoad(BaseValue, PseudoDtor->getDestroyedType().isVolatileQualified()), ARCPreciseLifetime); break; @@ -2903,10 +2903,10 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E, // The result shall only be used as the operand for the function call // operator (), and the result of such a call has type void. The only // effect is the evaluation of the postfix-expression before the dot or - // arrow. + // arrow. EmitScalarExpr(E->getCallee()); } - + return RValue::get(0); } @@ -2968,7 +2968,7 @@ LValue CodeGenFunction::EmitCallExprLValue(const CallExpr *E) { if (!RV.isScalar()) return MakeAddrLValue(RV.getAggregateAddr(), E->getType()); - + assert(E->getCallReturnType()->isReferenceType() && "Can't have a scalar return unless the return type is a " "reference type!"); @@ -3020,19 +3020,19 @@ CodeGenFunction::EmitLambdaLValue(const LambdaExpr *E) { LValue CodeGenFunction::EmitObjCMessageExprLValue(const ObjCMessageExpr *E) { RValue RV = EmitObjCMessageExpr(E); - + if (!RV.isScalar()) return MakeAddrLValue(RV.getAggregateAddr(), E->getType()); - + assert(E->getMethodDecl()->getResultType()->isReferenceType() && "Can't have a scalar return unless the return type is a " "reference type!"); - + return MakeAddrLValue(RV.getScalarVal(), E->getType()); } LValue CodeGenFunction::EmitObjCSelectorLValue(const ObjCSelectorExpr *E) { - llvm::Value *V = + llvm::Value *V = CGM.getObjCRuntime().GetSelector(*this, E->getSelector(), true); return MakeAddrLValue(V, E->getType()); } @@ -3068,7 +3068,7 @@ LValue CodeGenFunction::EmitObjCIvarRefLValue(const ObjCIvarRefExpr *E) { BaseQuals = ObjectTy.getQualifiers(); } - LValue LV = + LValue LV = EmitLValueForIvar(ObjectTy, BaseValue, E->getDecl(), BaseQuals.getCVRQualifiers()); setObjCGCLValueClass(getContext(), E, LV);