diff options
Diffstat (limited to 'clang/CodeGen')
-rw-r--r-- | clang/CodeGen/CGExprAgg.cpp | 6 | ||||
-rw-r--r-- | clang/CodeGen/CGExprConstant.cpp | 16 | ||||
-rw-r--r-- | clang/CodeGen/CGExprScalar.cpp | 13 | ||||
-rw-r--r-- | clang/CodeGen/CodeGenFunction.cpp | 3 | ||||
-rw-r--r-- | clang/CodeGen/CodeGenModule.cpp | 6 | ||||
-rw-r--r-- | clang/CodeGen/CodeGenTypes.cpp | 11 |
6 files changed, 24 insertions, 31 deletions
diff --git a/clang/CodeGen/CGExprAgg.cpp b/clang/CodeGen/CGExprAgg.cpp index 493d2790085..325ac2109eb 100644 --- a/clang/CodeGen/CGExprAgg.cpp +++ b/clang/CodeGen/CGExprAgg.cpp @@ -103,8 +103,7 @@ void AggExprEmitter::EmitAggregateClear(llvm::Value *DestPtr, QualType Ty) { DestPtr = Builder.CreateBitCast(DestPtr, BP, "tmp"); // Get size and alignment info for this aggregate. - std::pair<uint64_t, unsigned> TypeInfo = - CGF.getContext().getTypeInfo(Ty, SourceLocation()); + std::pair<uint64_t, unsigned> TypeInfo = CGF.getContext().getTypeInfo(Ty); // FIXME: Handle variable sized types. const llvm::Type *IntPtr = llvm::IntegerType::get(CGF.LLVMPointerWidth); @@ -132,8 +131,7 @@ void AggExprEmitter::EmitAggregateCopy(llvm::Value *DestPtr, SrcPtr = Builder.CreateBitCast(SrcPtr, BP, "tmp"); // Get size and alignment info for this aggregate. - std::pair<uint64_t, unsigned> TypeInfo = - CGF.getContext().getTypeInfo(Ty, SourceLocation()); + std::pair<uint64_t, unsigned> TypeInfo = CGF.getContext().getTypeInfo(Ty); // FIXME: Handle variable sized types. const llvm::Type *IntPtr = llvm::IntegerType::get(CGF.LLVMPointerWidth); diff --git a/clang/CodeGen/CGExprConstant.cpp b/clang/CodeGen/CGExprConstant.cpp index 30180c17744..e2405b88f37 100644 --- a/clang/CodeGen/CGExprConstant.cpp +++ b/clang/CodeGen/CGExprConstant.cpp @@ -37,7 +37,8 @@ public: llvm::Constant *VisitStmt(Stmt *S) { CGM.WarnUnsupported(S, "constant expression"); - return llvm::UndefValue::get(CGM.getTypes().ConvertType(cast<Expr>(S)->getType())); + QualType T = cast<Expr>(S)->getType(); + return llvm::UndefValue::get(CGM.getTypes().ConvertType(T)); } llvm::Constant *VisitParenExpr(ParenExpr *PE) { @@ -314,8 +315,8 @@ public: assert(E->getType()->isIntegerType() && "Result type must be an integer!"); - uint32_t ResultWidth = static_cast<uint32_t>( - CGM.getContext().getTypeSize(E->getType(), SourceLocation())); + uint32_t ResultWidth = + static_cast<uint32_t>(CGM.getContext().getTypeSize(E->getType())); return llvm::ConstantInt::get(llvm::APInt(ResultWidth, Val)); } @@ -504,15 +505,15 @@ public: llvm::Constant *EmitSizeAlignOf(QualType TypeToSize, QualType RetType, bool isSizeOf) { std::pair<uint64_t, unsigned> Info = - CGM.getContext().getTypeInfo(TypeToSize, SourceLocation()); + CGM.getContext().getTypeInfo(TypeToSize); uint64_t Val = isSizeOf ? Info.first : Info.second; Val /= 8; // Return size in bytes, not bits. assert(RetType->isIntegerType() && "Result type must be an integer!"); - uint32_t ResultWidth = static_cast<uint32_t>( - CGM.getContext().getTypeSize(RetType, SourceLocation())); + uint32_t ResultWidth = + static_cast<uint32_t>(CGM.getContext().getTypeSize(RetType)); return llvm::ConstantInt::get(llvm::APInt(ResultWidth, Val)); } @@ -616,8 +617,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E, QualType type = E->getType().getCanonicalType(); if (type->isIntegerType()) { - llvm::APSInt - Value(static_cast<uint32_t>(Context.getTypeSize(type, SourceLocation()))); + llvm::APSInt Value(static_cast<uint32_t>(Context.getTypeSize(type))); if (E->isIntegerConstantExpr(Value, Context)) { return llvm::ConstantInt::get(Value); } diff --git a/clang/CodeGen/CGExprScalar.cpp b/clang/CodeGen/CGExprScalar.cpp index 52b022b6611..892712a0d4c 100644 --- a/clang/CodeGen/CGExprScalar.cpp +++ b/clang/CodeGen/CGExprScalar.cpp @@ -656,16 +656,14 @@ Value *ScalarExprEmitter::EmitSizeAlignOf(QualType TypeToSize, QualType RetType,bool isSizeOf){ assert(RetType->isIntegerType() && "Result type must be an integer!"); uint32_t ResultWidth = - static_cast<uint32_t>(CGF.getContext().getTypeSize(RetType, - SourceLocation())); + static_cast<uint32_t>(CGF.getContext().getTypeSize(RetType)); // sizeof(void) and __alignof__(void) = 1 as a gcc extension. if (TypeToSize->isVoidType()) return llvm::ConstantInt::get(llvm::APInt(ResultWidth, 1)); /// FIXME: This doesn't handle VLAs yet! - std::pair<uint64_t, unsigned> Info = - CGF.getContext().getTypeInfo(TypeToSize, SourceLocation()); + std::pair<uint64_t, unsigned> Info = CGF.getContext().getTypeInfo(TypeToSize); uint64_t Val = isSizeOf ? Info.first : Info.second; Val /= 8; // Return size in bytes, not bits. @@ -696,8 +694,8 @@ Value *ScalarExprEmitter::VisitUnaryOffsetOf(const UnaryOperator *E) assert(E->getType()->isIntegerType() && "Result type must be an integer!"); - uint32_t ResultWidth = static_cast<uint32_t>( - CGF.getContext().getTypeSize(E->getType(), SourceLocation())); + uint32_t ResultWidth = + static_cast<uint32_t>(CGF.getContext().getTypeSize(E->getType())); return llvm::ConstantInt::get(llvm::APInt(ResultWidth, Val)); } @@ -852,8 +850,7 @@ Value *ScalarExprEmitter::VisitBinSub(const BinaryOperator *E) { const QualType LHSType = E->getLHS()->getType().getCanonicalType(); const QualType LHSElementType = cast<PointerType>(LHSType)->getPointeeType(); - uint64_t ElementSize = CGF.getContext().getTypeSize(LHSElementType, - SourceLocation()) / 8; + uint64_t ElementSize = CGF.getContext().getTypeSize(LHSElementType) / 8; const llvm::Type *ResultType = ConvertType(E->getType()); LHS = Builder.CreatePtrToInt(LHS, ResultType, "sub.ptr.lhs.cast"); diff --git a/clang/CodeGen/CodeGenFunction.cpp b/clang/CodeGen/CodeGenFunction.cpp index adbb414cc09..f48d093b25e 100644 --- a/clang/CodeGen/CodeGenFunction.cpp +++ b/clang/CodeGen/CodeGenFunction.cpp @@ -59,8 +59,7 @@ bool CodeGenFunction::hasAggregateLLVMType(QualType T) { void CodeGenFunction::GenerateCode(const FunctionDecl *FD) { LLVMIntTy = ConvertType(getContext().IntTy); LLVMPointerWidth = static_cast<unsigned>( - getContext().getTypeSize(getContext().getPointerType(getContext().VoidTy), - SourceLocation())); + getContext().getTypeSize(getContext().getPointerType(getContext().VoidTy))); CurFuncDecl = FD; CurFn = cast<llvm::Function>(CGM.GetAddrOfFunctionDecl(FD, true)); diff --git a/clang/CodeGen/CodeGenModule.cpp b/clang/CodeGen/CodeGenModule.cpp index 1a697962146..554fc3fbebe 100644 --- a/clang/CodeGen/CodeGenModule.cpp +++ b/clang/CodeGen/CodeGenModule.cpp @@ -231,7 +231,7 @@ void CodeGenModule::EmitGlobalVar(const FileVarDecl *D) { Init = llvm::Constant::getNullValue(GV->getType()->getElementType()); } else if (D->getType()->isIntegerType()) { llvm::APSInt Value(static_cast<uint32_t>( - getContext().getTypeSize(D->getInit()->getType(), SourceLocation()))); + getContext().getTypeSize(D->getInit()->getType()))); if (D->getInit()->isIntegerConstantExpr(Value, Context)) Init = llvm::ConstantInt::get(Value); } @@ -340,7 +340,7 @@ llvm::Function *CodeGenModule::getMemCpyFn() { if (MemCpyFn) return MemCpyFn; llvm::Intrinsic::ID IID; uint64_t Size; unsigned Align; - Context.Target.getPointerInfo(Size, Align, FullSourceLoc()); + Context.Target.getPointerInfo(Size, Align); switch (Size) { default: assert(0 && "Unknown ptr width"); case 32: IID = llvm::Intrinsic::memcpy_i32; break; @@ -353,7 +353,7 @@ llvm::Function *CodeGenModule::getMemSetFn() { if (MemSetFn) return MemSetFn; llvm::Intrinsic::ID IID; uint64_t Size; unsigned Align; - Context.Target.getPointerInfo(Size, Align, FullSourceLoc()); + Context.Target.getPointerInfo(Size, Align); switch (Size) { default: assert(0 && "Unknown ptr width"); case 32: IID = llvm::Intrinsic::memset_i32; break; diff --git a/clang/CodeGen/CodeGenTypes.cpp b/clang/CodeGen/CodeGenTypes.cpp index efdc0e8e5bc..9a669e87056 100644 --- a/clang/CodeGen/CodeGenTypes.cpp +++ b/clang/CodeGen/CodeGenTypes.cpp @@ -118,8 +118,7 @@ const llvm::Type *CodeGenTypes::ConvertTypeForMem(QualType T) { return R; // Otherwise, return an integer of the target-specified size. - unsigned BoolWidth = (unsigned)Context.getTypeSize(T, SourceLocation()); - return llvm::IntegerType::get(BoolWidth); + return llvm::IntegerType::get((unsigned)Context.getTypeSize(T)); } @@ -179,7 +178,7 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) { case BuiltinType::LongLong: case BuiltinType::ULongLong: return llvm::IntegerType::get( - static_cast<unsigned>(Context.getTypeSize(T, SourceLocation()))); + static_cast<unsigned>(Context.getTypeSize(T))); case BuiltinType::Float: return llvm::Type::FloatTy; case BuiltinType::Double: return llvm::Type::DoubleTy; @@ -356,7 +355,7 @@ const llvm::Type *CodeGenTypes::ConvertTagDeclType(const TagDecl *TD) { for (unsigned i = 0, e = RD->getNumMembers(); i != e; ++i) RO.addField(RD->getMember(i)); - RO.layoutStructFields(Context.getASTRecordLayout(RD, SourceLocation())); + RO.layoutStructFields(Context.getASTRecordLayout(RD)); // Get llvm::StructType. CGRecordLayouts[TD] = new CGRecordLayout(RO.getLLVMType(), @@ -514,7 +513,7 @@ void RecordOrganizer::layoutUnionFields() { unsigned PrimaryEltNo = 0; std::pair<uint64_t, unsigned> PrimaryElt = - CGT.getContext().getTypeInfo(FieldDecls[0]->getType(), SourceLocation()); + CGT.getContext().getTypeInfo(FieldDecls[0]->getType()); CGT.addFieldInfo(FieldDecls[0], 0); unsigned Size = FieldDecls.size(); @@ -522,7 +521,7 @@ void RecordOrganizer::layoutUnionFields() { const FieldDecl *FD = FieldDecls[i]; assert (!FD->isBitField() && "Bit fields are not yet supported"); std::pair<uint64_t, unsigned> EltInfo = - CGT.getContext().getTypeInfo(FD->getType(), SourceLocation()); + CGT.getContext().getTypeInfo(FD->getType()); // Use largest element, breaking ties with the hightest aligned member. if (EltInfo.first > PrimaryElt.first || |