diff options
author | Rui Ueyama <ruiu@google.com> | 2016-01-14 21:00:27 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-01-14 21:00:27 +0000 |
commit | 83aa97941f75421901c90e7fdb95d45f0f14a3e7 (patch) | |
tree | df328ff43765c82ef7b3fa9e9cb7f63d867dba59 /clang/lib | |
parent | 489a806965a0e0d599246c688538eb20c5bf58a2 (diff) | |
download | bcm5719-llvm-83aa97941f75421901c90e7fdb95d45f0f14a3e7.tar.gz bcm5719-llvm-83aa97941f75421901c90e7fdb95d45f0f14a3e7.zip |
Update for LLVM function name change.
llvm-svn: 257802
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 6 | ||||
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/Mangle.cpp | 6 | ||||
-rw-r--r-- | clang/lib/AST/MicrosoftCXXABI.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/RecordLayoutBuilder.cpp | 78 | ||||
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 7 | ||||
-rw-r--r-- | clang/lib/AST/StmtOpenMP.cpp | 210 | ||||
-rw-r--r-- | clang/lib/AST/TypeLoc.cpp | 16 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGAtomic.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGCleanup.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGCleanup.h | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 23 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCRuntime.cpp | 5 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGRecordLayoutBuilder.cpp | 8 | ||||
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 36 | ||||
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp | 4 |
19 files changed, 205 insertions, 215 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 64386967b22..e70bf2ffed0 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1480,7 +1480,7 @@ static getConstantArrayInfoInChars(const ASTContext &Context, unsigned Align = EltInfo.second.getQuantity(); if (!Context.getTargetInfo().getCXXABI().isMicrosoft() || Context.getTargetInfo().getPointerWidth(0) == 64) - Width = llvm::RoundUpToAlignment(Width, Align); + Width = llvm::alignTo(Width, Align); return std::make_pair(CharUnits::fromQuantity(Width), CharUnits::fromQuantity(Align)); } @@ -1564,7 +1564,7 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const { Align = EltInfo.Align; if (!getTargetInfo().getCXXABI().isMicrosoft() || getTargetInfo().getPointerWidth(0) == 64) - Width = llvm::RoundUpToAlignment(Width, Align); + Width = llvm::alignTo(Width, Align); break; } case Type::ExtVector: @@ -1577,7 +1577,7 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const { // This happens for non-power-of-2 length vectors. if (Align & (Align-1)) { Align = llvm::NextPowerOf2(Align); - Width = llvm::RoundUpToAlignment(Width, Align); + Width = llvm::alignTo(Width, Align); } // Adjust the alignment based on the target max. uint64_t TargetVectorAlign = Target->getMaxVectorAlign(); diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index fa652ba1b0a..eaa61ea5c4f 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -5135,7 +5135,7 @@ bool PointerExprEvaluator::VisitCallExpr(const CallExpr *E) { } // The offset must also have the correct alignment. - if (OffsetResult.Offset.RoundUpToAlignment(Align) != OffsetResult.Offset) { + if (OffsetResult.Offset.alignTo(Align) != OffsetResult.Offset) { Result.Designator.setInvalid(); APSInt Offset(64, false); Offset = OffsetResult.Offset.getQuantity(); diff --git a/clang/lib/AST/Mangle.cpp b/clang/lib/AST/Mangle.cpp index 014338f0490..b1193ca2d23 100644 --- a/clang/lib/AST/Mangle.cpp +++ b/clang/lib/AST/Mangle.cpp @@ -177,9 +177,9 @@ void MangleContext::mangleName(const NamedDecl *D, raw_ostream &Out) { ++ArgWords; for (const auto &AT : Proto->param_types()) // Size should be aligned to pointer size. - ArgWords += llvm::RoundUpToAlignment(ASTContext.getTypeSize(AT), - TI.getPointerWidth(0)) / - TI.getPointerWidth(0); + ArgWords += + llvm::alignTo(ASTContext.getTypeSize(AT), TI.getPointerWidth(0)) / + TI.getPointerWidth(0); Out << ((TI.getPointerWidth(0) / 8) * ArgWords); } diff --git a/clang/lib/AST/MicrosoftCXXABI.cpp b/clang/lib/AST/MicrosoftCXXABI.cpp index 6ba31ccf1e3..3ae04538d62 100644 --- a/clang/lib/AST/MicrosoftCXXABI.cpp +++ b/clang/lib/AST/MicrosoftCXXABI.cpp @@ -262,7 +262,7 @@ std::pair<uint64_t, unsigned> MicrosoftCXXABI::getMemberPointerWidthAndAlign( Align = Target.getIntAlign(); if (Target.getTriple().isArch64Bit()) - Width = llvm::RoundUpToAlignment(Width, Align); + Width = llvm::alignTo(Width, Align); return std::make_pair(Width, Align); } diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index bc5ae0ffc46..0572ff6b134 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -973,7 +973,7 @@ void ItaniumRecordLayoutBuilder::EnsureVTablePointerAlignment( } // Round up the current record size to pointer alignment. - setSize(getSize().RoundUpToAlignment(BaseAlign)); + setSize(getSize().alignTo(BaseAlign)); setDataSize(getSize()); // Update the alignment. @@ -1194,7 +1194,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) { if (!HasExternalLayout) { // Round up the current record size to the base's alignment boundary. - Offset = getDataSize().RoundUpToAlignment(BaseAlign); + Offset = getDataSize().alignTo(BaseAlign); // Try to place the base. while (!EmptySubobjects->CanPlaceBaseAtOffset(Base, Offset)) @@ -1204,7 +1204,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) { (void)Allowed; assert(Allowed && "Base subobject externally placed at overlapping offset"); - if (InferAlignment && Offset < getDataSize().RoundUpToAlignment(BaseAlign)){ + if (InferAlignment && Offset < getDataSize().alignTo(BaseAlign)) { // The externally-supplied base offset is before the base offset we // computed. Assume that the structure is packed. Alignment = CharUnits::One(); @@ -1292,8 +1292,7 @@ void ItaniumRecordLayoutBuilder::Layout(const CXXRecordDecl *RD) { LayoutFields(RD); NonVirtualSize = Context.toCharUnitsFromBits( - llvm::RoundUpToAlignment(getSizeInBits(), - Context.getTargetInfo().getCharAlign())); + llvm::alignTo(getSizeInBits(), Context.getTargetInfo().getCharAlign())); NonVirtualAlignment = Alignment; // Lay out the virtual bases and add the primary virtual base offsets. @@ -1364,7 +1363,7 @@ static uint64_t roundUpSizeToCharAlignment(uint64_t Size, const ASTContext &Context) { uint64_t CharAlignment = Context.getTargetInfo().getCharAlign(); - return llvm::RoundUpToAlignment(Size, CharAlignment); + return llvm::alignTo(Size, CharAlignment); } void ItaniumRecordLayoutBuilder::LayoutWideBitField(uint64_t FieldSize, @@ -1411,13 +1410,12 @@ void ItaniumRecordLayoutBuilder::LayoutWideBitField(uint64_t FieldSize, } else { // The bitfield is allocated starting at the next offset aligned // appropriately for T', with length n bits. - FieldOffset = llvm::RoundUpToAlignment(getDataSizeInBits(), - Context.toBits(TypeAlign)); + FieldOffset = llvm::alignTo(getDataSizeInBits(), Context.toBits(TypeAlign)); uint64_t NewSizeInBits = FieldOffset + FieldSize; - setDataSize(llvm::RoundUpToAlignment(NewSizeInBits, - Context.getTargetInfo().getCharAlign())); + setDataSize( + llvm::alignTo(NewSizeInBits, Context.getTargetInfo().getCharAlign())); UnfilledBitsInLastUnit = getDataSizeInBits() - NewSizeInBits; } @@ -1587,9 +1585,9 @@ void ItaniumRecordLayoutBuilder::LayoutBitField(const FieldDecl *D) { // start a new storage unit), just do so, regardless of any other // other consideration. Otherwise, round up to the right alignment. if (FieldSize == 0 || FieldSize > UnfilledBitsInLastUnit) { - FieldOffset = llvm::RoundUpToAlignment(FieldOffset, FieldAlign); - UnpackedFieldOffset = llvm::RoundUpToAlignment(UnpackedFieldOffset, - UnpackedFieldAlign); + FieldOffset = llvm::alignTo(FieldOffset, FieldAlign); + UnpackedFieldOffset = + llvm::alignTo(UnpackedFieldOffset, UnpackedFieldAlign); UnfilledBitsInLastUnit = 0; } @@ -1601,22 +1599,22 @@ void ItaniumRecordLayoutBuilder::LayoutBitField(const FieldDecl *D) { if (FieldSize == 0 || (AllowPadding && (FieldOffset & (FieldAlign-1)) + FieldSize > TypeSize)) { - FieldOffset = llvm::RoundUpToAlignment(FieldOffset, FieldAlign); + FieldOffset = llvm::alignTo(FieldOffset, FieldAlign); } else if (ExplicitFieldAlign) { // TODO: figure it out what needs to be done on targets that don't honor // bit-field type alignment like ARM APCS ABI. - FieldOffset = llvm::RoundUpToAlignment(FieldOffset, ExplicitFieldAlign); + FieldOffset = llvm::alignTo(FieldOffset, ExplicitFieldAlign); } // Repeat the computation for diagnostic purposes. if (FieldSize == 0 || (AllowPadding && (UnpackedFieldOffset & (UnpackedFieldAlign-1)) + FieldSize > TypeSize)) - UnpackedFieldOffset = llvm::RoundUpToAlignment(UnpackedFieldOffset, - UnpackedFieldAlign); + UnpackedFieldOffset = + llvm::alignTo(UnpackedFieldOffset, UnpackedFieldAlign); else if (ExplicitFieldAlign) - UnpackedFieldOffset = llvm::RoundUpToAlignment(UnpackedFieldOffset, - ExplicitFieldAlign); + UnpackedFieldOffset = + llvm::alignTo(UnpackedFieldOffset, ExplicitFieldAlign); } // If we're using external layout, give the external layout a chance @@ -1677,7 +1675,7 @@ void ItaniumRecordLayoutBuilder::LayoutBitField(const FieldDecl *D) { } else { uint64_t NewSizeInBits = FieldOffset + FieldSize; uint64_t CharAlignment = Context.getTargetInfo().getCharAlign(); - setDataSize(llvm::RoundUpToAlignment(NewSizeInBits, CharAlignment)); + setDataSize(llvm::alignTo(NewSizeInBits, CharAlignment)); UnfilledBitsInLastUnit = getDataSizeInBits() - NewSizeInBits; // The only time we can get here for an ms_struct is if this is a @@ -1767,9 +1765,8 @@ void ItaniumRecordLayoutBuilder::LayoutField(const FieldDecl *D, } // Round up the current record size to the field's alignment boundary. - FieldOffset = FieldOffset.RoundUpToAlignment(FieldAlign); - UnpackedFieldOffset = - UnpackedFieldOffset.RoundUpToAlignment(UnpackedFieldAlign); + FieldOffset = FieldOffset.alignTo(FieldAlign); + UnpackedFieldOffset = UnpackedFieldOffset.alignTo(UnpackedFieldAlign); if (UseExternalLayout) { FieldOffset = Context.toCharUnitsFromBits( @@ -1840,11 +1837,10 @@ void ItaniumRecordLayoutBuilder::FinishLayout(const NamedDecl *D) { // record itself. uint64_t UnpaddedSize = getSizeInBits() - UnfilledBitsInLastUnit; uint64_t UnpackedSizeInBits = - llvm::RoundUpToAlignment(getSizeInBits(), - Context.toBits(UnpackedAlignment)); + llvm::alignTo(getSizeInBits(), Context.toBits(UnpackedAlignment)); CharUnits UnpackedSize = Context.toCharUnitsFromBits(UnpackedSizeInBits); - uint64_t RoundedSize - = llvm::RoundUpToAlignment(getSizeInBits(), Context.toBits(Alignment)); + uint64_t RoundedSize = + llvm::alignTo(getSizeInBits(), Context.toBits(Alignment)); if (UseExternalLayout) { // If we're inferring alignment, and the external size is smaller than @@ -2385,7 +2381,7 @@ void MicrosoftRecordLayoutBuilder::layout(const RecordDecl *RD) { MinEmptyStructSize = CharUnits::fromQuantity(4); initializeLayout(RD); layoutFields(RD); - DataSize = Size = Size.RoundUpToAlignment(Alignment); + DataSize = Size = Size.alignTo(Alignment); RequiredAlignment = std::max( RequiredAlignment, Context.toCharUnitsFromBits(RD->getMaxAlignment())); finalizeLayout(RD); @@ -2405,7 +2401,7 @@ void MicrosoftRecordLayoutBuilder::cxxLayout(const CXXRecordDecl *RD) { auto RoundingAlignment = Alignment; if (!MaxFieldAlignment.isZero()) RoundingAlignment = std::min(RoundingAlignment, MaxFieldAlignment); - NonVirtualSize = Size = Size.RoundUpToAlignment(RoundingAlignment); + NonVirtualSize = Size = Size.alignTo(RoundingAlignment); RequiredAlignment = std::max( RequiredAlignment, Context.toCharUnitsFromBits(RD->getMaxAlignment())); layoutVirtualBases(RD); @@ -2560,7 +2556,7 @@ void MicrosoftRecordLayoutBuilder::layoutNonVirtualBase( } if (!FoundBase) - BaseOffset = Size.RoundUpToAlignment(Info.Alignment); + BaseOffset = Size.alignTo(Info.Alignment); Bases.insert(std::make_pair(BaseDecl, BaseOffset)); Size = BaseOffset + BaseLayout.getNonVirtualSize(); PreviousBaseLayout = &BaseLayout; @@ -2590,7 +2586,7 @@ void MicrosoftRecordLayoutBuilder::layoutField(const FieldDecl *FD) { Context.toCharUnitsFromBits(External.getExternalFieldOffset(FD)); assert(FieldOffset >= Size && "field offset already allocated"); } else { - FieldOffset = Size.RoundUpToAlignment(Info.Alignment); + FieldOffset = Size.alignTo(Info.Alignment); } placeFieldAtOffset(FieldOffset); Size = FieldOffset + Info.Size; @@ -2625,7 +2621,7 @@ void MicrosoftRecordLayoutBuilder::layoutBitField(const FieldDecl *FD) { // TODO: Add a Sema warning that MS ignores bitfield alignment in unions. } else { // Allocate a new block of memory and place the bitfield in it. - CharUnits FieldOffset = Size.RoundUpToAlignment(Info.Alignment); + CharUnits FieldOffset = Size.alignTo(Info.Alignment); placeFieldAtOffset(FieldOffset); Size = FieldOffset + Info.Size; Alignment = std::max(Alignment, Info.Alignment); @@ -2651,7 +2647,7 @@ MicrosoftRecordLayoutBuilder::layoutZeroWidthBitField(const FieldDecl *FD) { // TODO: Add a Sema warning that MS ignores bitfield alignment in unions. } else { // Round up the current record size to the field's alignment boundary. - CharUnits FieldOffset = Size.RoundUpToAlignment(Info.Alignment); + CharUnits FieldOffset = Size.alignTo(Info.Alignment); placeFieldAtOffset(FieldOffset); Size = FieldOffset; Alignment = std::max(Alignment, Info.Alignment); @@ -2664,7 +2660,7 @@ void MicrosoftRecordLayoutBuilder::injectVBPtr(const CXXRecordDecl *RD) { // Inject the VBPointer at the injection site. CharUnits InjectionSite = VBPtrOffset; // But before we do, make sure it's properly aligned. - VBPtrOffset = VBPtrOffset.RoundUpToAlignment(PointerInfo.Alignment); + VBPtrOffset = VBPtrOffset.alignTo(PointerInfo.Alignment); // Shift everything after the vbptr down, unless we're using an external // layout. if (UseExternalLayout) @@ -2673,8 +2669,8 @@ void MicrosoftRecordLayoutBuilder::injectVBPtr(const CXXRecordDecl *RD) { CharUnits FieldStart = VBPtrOffset + PointerInfo.Size; // Make sure that the amount we push the fields back by is a multiple of the // alignment. - CharUnits Offset = (FieldStart - InjectionSite).RoundUpToAlignment( - std::max(RequiredAlignment, Alignment)); + CharUnits Offset = (FieldStart - InjectionSite) + .alignTo(std::max(RequiredAlignment, Alignment)); Size += Offset; for (uint64_t &FieldOffset : FieldOffsets) FieldOffset += Context.toBits(Offset); @@ -2688,8 +2684,8 @@ void MicrosoftRecordLayoutBuilder::injectVFPtr(const CXXRecordDecl *RD) { return; // Make sure that the amount we push the struct back by is a multiple of the // alignment. - CharUnits Offset = PointerInfo.Size.RoundUpToAlignment( - std::max(RequiredAlignment, Alignment)); + CharUnits Offset = + PointerInfo.Size.alignTo(std::max(RequiredAlignment, Alignment)); // Push back the vbptr, but increase the size of the object and push back // regular fields by the offset only if not using external record layout. if (HasVBPtr) @@ -2743,7 +2739,7 @@ void MicrosoftRecordLayoutBuilder::layoutVirtualBases(const CXXRecordDecl *RD) { // the required alignment, we don't know why. if ((PreviousBaseLayout && PreviousBaseLayout->hasZeroSizedSubObject() && BaseLayout.leadsWithZeroSizedBase()) || HasVtordisp) { - Size = Size.RoundUpToAlignment(VtorDispAlignment) + VtorDispSize; + Size = Size.alignTo(VtorDispAlignment) + VtorDispSize; Alignment = std::max(VtorDispAlignment, Alignment); } // Insert the virtual base. @@ -2758,7 +2754,7 @@ void MicrosoftRecordLayoutBuilder::layoutVirtualBases(const CXXRecordDecl *RD) { assert(BaseOffset >= Size && "base offset already allocated"); } if (!FoundBase) - BaseOffset = Size.RoundUpToAlignment(Info.Alignment); + BaseOffset = Size.alignTo(Info.Alignment); VBases.insert(std::make_pair(BaseDecl, ASTRecordLayout::VBaseInfo(BaseOffset, HasVtordisp))); @@ -2777,7 +2773,7 @@ void MicrosoftRecordLayoutBuilder::finalizeLayout(const RecordDecl *RD) { if (!MaxFieldAlignment.isZero()) RoundingAlignment = std::min(RoundingAlignment, MaxFieldAlignment); RoundingAlignment = std::max(RoundingAlignment, RequiredAlignment); - Size = Size.RoundUpToAlignment(RoundingAlignment); + Size = Size.alignTo(RoundingAlignment); } if (Size.isZero()) { EndsWithZeroSizedObject = true; diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index ca63d8486d8..7dfa3a9df13 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -987,8 +987,7 @@ CapturedStmt::Capture *CapturedStmt::getStoredCaptures() const { unsigned Size = sizeof(CapturedStmt) + sizeof(Stmt *) * (NumCaptures + 1); // Offset of the first Capture object. - unsigned FirstCaptureOffset = - llvm::RoundUpToAlignment(Size, llvm::alignOf<Capture>()); + unsigned FirstCaptureOffset = llvm::alignTo(Size, llvm::alignOf<Capture>()); return reinterpret_cast<Capture *>( reinterpret_cast<char *>(const_cast<CapturedStmt *>(this)) @@ -1045,7 +1044,7 @@ CapturedStmt *CapturedStmt::Create(const ASTContext &Context, Stmt *S, unsigned Size = sizeof(CapturedStmt) + sizeof(Stmt *) * (Captures.size() + 1); if (!Captures.empty()) { // Realign for the following Capture array. - Size = llvm::RoundUpToAlignment(Size, llvm::alignOf<Capture>()); + Size = llvm::alignTo(Size, llvm::alignOf<Capture>()); Size += sizeof(Capture) * Captures.size(); } @@ -1058,7 +1057,7 @@ CapturedStmt *CapturedStmt::CreateDeserialized(const ASTContext &Context, unsigned Size = sizeof(CapturedStmt) + sizeof(Stmt *) * (NumCaptures + 1); if (NumCaptures > 0) { // Realign for the following Capture array. - Size = llvm::RoundUpToAlignment(Size, llvm::alignOf<Capture>()); + Size = llvm::alignTo(Size, llvm::alignOf<Capture>()); Size += sizeof(Capture) * NumCaptures; } diff --git a/clang/lib/AST/StmtOpenMP.cpp b/clang/lib/AST/StmtOpenMP.cpp index 7f923d8a825..72e62b7001d 100644 --- a/clang/lib/AST/StmtOpenMP.cpp +++ b/clang/lib/AST/StmtOpenMP.cpp @@ -57,8 +57,8 @@ void OMPLoopDirective::setFinals(ArrayRef<Expr *> A) { OMPParallelDirective *OMPParallelDirective::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPParallelDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); OMPParallelDirective *Dir = @@ -72,8 +72,8 @@ OMPParallelDirective *OMPParallelDirective::Create( OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPParallelDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); return new (Mem) OMPParallelDirective(NumClauses); @@ -84,8 +84,8 @@ OMPSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSimdDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPSimdDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_simd)); @@ -112,8 +112,8 @@ OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSimdDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPSimdDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_simd)); @@ -125,8 +125,8 @@ OMPForDirective::Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPForDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPForDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for)); @@ -161,8 +161,8 @@ OMPForDirective *OMPForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPForDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPForDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for)); @@ -174,8 +174,8 @@ OMPForSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPForSimdDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPForSimdDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd)); @@ -209,8 +209,8 @@ OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPForSimdDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPForSimdDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd)); @@ -220,8 +220,8 @@ OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C, OMPSectionsDirective *OMPSectionsDirective::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSectionsDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPSectionsDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); OMPSectionsDirective *Dir = @@ -235,8 +235,8 @@ OMPSectionsDirective *OMPSectionsDirective::Create( OMPSectionsDirective *OMPSectionsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSectionsDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPSectionsDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); return new (Mem) OMPSectionsDirective(NumClauses); @@ -247,8 +247,8 @@ OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C, SourceLocation EndLoc, Stmt *AssociatedStmt, bool HasCancel) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSectionDirective), - llvm::alignOf<Stmt *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPSectionDirective), llvm::alignOf<Stmt *>()); void *Mem = C.Allocate(Size + sizeof(Stmt *)); OMPSectionDirective *Dir = new (Mem) OMPSectionDirective(StartLoc, EndLoc); Dir->setAssociatedStmt(AssociatedStmt); @@ -258,8 +258,8 @@ OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C, OMPSectionDirective *OMPSectionDirective::CreateEmpty(const ASTContext &C, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSectionDirective), - llvm::alignOf<Stmt *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPSectionDirective), llvm::alignOf<Stmt *>()); void *Mem = C.Allocate(Size + sizeof(Stmt *)); return new (Mem) OMPSectionDirective(); } @@ -269,8 +269,8 @@ OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSingleDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPSingleDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); OMPSingleDirective *Dir = @@ -283,8 +283,8 @@ OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C, OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSingleDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPSingleDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); return new (Mem) OMPSingleDirective(NumClauses); @@ -294,8 +294,8 @@ OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AssociatedStmt) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPMasterDirective), - llvm::alignOf<Stmt *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPMasterDirective), llvm::alignOf<Stmt *>()); void *Mem = C.Allocate(Size + sizeof(Stmt *)); OMPMasterDirective *Dir = new (Mem) OMPMasterDirective(StartLoc, EndLoc); Dir->setAssociatedStmt(AssociatedStmt); @@ -304,8 +304,8 @@ OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C, OMPMasterDirective *OMPMasterDirective::CreateEmpty(const ASTContext &C, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPMasterDirective), - llvm::alignOf<Stmt *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPMasterDirective), llvm::alignOf<Stmt *>()); void *Mem = C.Allocate(Size + sizeof(Stmt *)); return new (Mem) OMPMasterDirective(); } @@ -314,8 +314,8 @@ OMPCriticalDirective *OMPCriticalDirective::Create( const ASTContext &C, const DeclarationNameInfo &Name, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPCriticalDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPCriticalDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); OMPCriticalDirective *Dir = @@ -328,8 +328,8 @@ OMPCriticalDirective *OMPCriticalDirective::Create( OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPCriticalDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPCriticalDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); return new (Mem) OMPCriticalDirective(NumClauses); @@ -339,8 +339,8 @@ OMPParallelForDirective *OMPParallelForDirective::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs, bool HasCancel) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelForDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = llvm::alignTo(sizeof(OMPParallelForDirective), + llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for)); @@ -374,8 +374,8 @@ OMPParallelForDirective *OMPParallelForDirective::Create( OMPParallelForDirective * OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelForDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = llvm::alignTo(sizeof(OMPParallelForDirective), + llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for)); @@ -386,8 +386,8 @@ OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelForSimdDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = llvm::alignTo(sizeof(OMPParallelForSimdDirective), + llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate( Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd)); @@ -421,8 +421,8 @@ OMPParallelForSimdDirective * OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelForSimdDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = llvm::alignTo(sizeof(OMPParallelForSimdDirective), + llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate( Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd)); @@ -432,8 +432,8 @@ OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C, OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelSectionsDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = llvm::alignTo(sizeof(OMPParallelSectionsDirective), + llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); OMPParallelSectionsDirective *Dir = @@ -447,8 +447,8 @@ OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create( OMPParallelSectionsDirective * OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelSectionsDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = llvm::alignTo(sizeof(OMPParallelSectionsDirective), + llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); return new (Mem) OMPParallelSectionsDirective(NumClauses); @@ -458,8 +458,8 @@ OMPTaskDirective * OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, bool HasCancel) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTaskDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPTaskDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); OMPTaskDirective *Dir = @@ -473,8 +473,8 @@ OMPTaskDirective::Create(const ASTContext &C, SourceLocation StartLoc, OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTaskDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPTaskDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); return new (Mem) OMPTaskDirective(NumClauses); @@ -527,8 +527,8 @@ OMPTaskgroupDirective *OMPTaskgroupDirective::Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AssociatedStmt) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTaskgroupDirective), - llvm::alignOf<Stmt *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPTaskgroupDirective), llvm::alignOf<Stmt *>()); void *Mem = C.Allocate(Size + sizeof(Stmt *)); OMPTaskgroupDirective *Dir = new (Mem) OMPTaskgroupDirective(StartLoc, EndLoc); @@ -538,8 +538,8 @@ OMPTaskgroupDirective *OMPTaskgroupDirective::Create(const ASTContext &C, OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTaskgroupDirective), - llvm::alignOf<Stmt *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPTaskgroupDirective), llvm::alignOf<Stmt *>()); void *Mem = C.Allocate(Size + sizeof(Stmt *)); return new (Mem) OMPTaskgroupDirective(); } @@ -547,8 +547,8 @@ OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C, OMPCancellationPointDirective *OMPCancellationPointDirective::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion) { - unsigned Size = llvm::RoundUpToAlignment( - sizeof(OMPCancellationPointDirective), llvm::alignOf<Stmt *>()); + unsigned Size = llvm::alignTo(sizeof(OMPCancellationPointDirective), + llvm::alignOf<Stmt *>()); void *Mem = C.Allocate(Size); OMPCancellationPointDirective *Dir = new (Mem) OMPCancellationPointDirective(StartLoc, EndLoc); @@ -558,8 +558,8 @@ OMPCancellationPointDirective *OMPCancellationPointDirective::Create( OMPCancellationPointDirective * OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment( - sizeof(OMPCancellationPointDirective), llvm::alignOf<Stmt *>()); + unsigned Size = llvm::alignTo(sizeof(OMPCancellationPointDirective), + llvm::alignOf<Stmt *>()); void *Mem = C.Allocate(Size); return new (Mem) OMPCancellationPointDirective(); } @@ -568,9 +568,9 @@ OMPCancelDirective * OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, OpenMPDirectiveKind CancelRegion) { - unsigned Size = llvm::RoundUpToAlignment( - sizeof(OMPCancelDirective) + sizeof(OMPClause *) * Clauses.size(), - llvm::alignOf<Stmt *>()); + unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) + + sizeof(OMPClause *) * Clauses.size(), + llvm::alignOf<Stmt *>()); void *Mem = C.Allocate(Size); OMPCancelDirective *Dir = new (Mem) OMPCancelDirective(StartLoc, EndLoc, Clauses.size()); @@ -582,9 +582,9 @@ OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc, OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPCancelDirective) + - sizeof(OMPClause *) * NumClauses, - llvm::alignOf<Stmt *>()); + unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) + + sizeof(OMPClause *) * NumClauses, + llvm::alignOf<Stmt *>()); void *Mem = C.Allocate(Size); return new (Mem) OMPCancelDirective(NumClauses); } @@ -593,8 +593,8 @@ OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPFlushDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPFlushDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size()); OMPFlushDirective *Dir = new (Mem) OMPFlushDirective(StartLoc, EndLoc, Clauses.size()); @@ -605,8 +605,8 @@ OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C, OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPFlushDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPFlushDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses); return new (Mem) OMPFlushDirective(NumClauses); } @@ -616,8 +616,8 @@ OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPOrderedDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPOrderedDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * Clauses.size()); OMPOrderedDirective *Dir = @@ -630,8 +630,8 @@ OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C, OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPOrderedDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPOrderedDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * NumClauses); return new (Mem) OMPOrderedDirective(NumClauses); @@ -641,8 +641,8 @@ OMPAtomicDirective *OMPAtomicDirective::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V, Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPAtomicDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPAtomicDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + 5 * sizeof(Stmt *)); OMPAtomicDirective *Dir = @@ -661,8 +661,8 @@ OMPAtomicDirective *OMPAtomicDirective::Create( OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPAtomicDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPAtomicDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + 5 * sizeof(Stmt *)); return new (Mem) OMPAtomicDirective(NumClauses); @@ -673,8 +673,8 @@ OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTargetDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPTargetDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); OMPTargetDirective *Dir = @@ -687,8 +687,8 @@ OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C, OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTargetDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPTargetDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); return new (Mem) OMPTargetDirective(NumClauses); @@ -697,10 +697,9 @@ OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C, OMPTargetDataDirective *OMPTargetDataDirective::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { - void *Mem = - C.Allocate(llvm::RoundUpToAlignment(sizeof(OMPTargetDataDirective), - llvm::alignOf<OMPClause *>()) + - sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); + void *Mem = C.Allocate(llvm::alignTo(sizeof(OMPTargetDataDirective), + llvm::alignOf<OMPClause *>()) + + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); OMPTargetDataDirective *Dir = new (Mem) OMPTargetDataDirective(StartLoc, EndLoc, Clauses.size()); Dir->setClauses(Clauses); @@ -711,10 +710,9 @@ OMPTargetDataDirective *OMPTargetDataDirective::Create( OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C, unsigned N, EmptyShell) { - void *Mem = - C.Allocate(llvm::RoundUpToAlignment(sizeof(OMPTargetDataDirective), - llvm::alignOf<OMPClause *>()) + - sizeof(OMPClause *) * N + sizeof(Stmt *)); + void *Mem = C.Allocate(llvm::alignTo(sizeof(OMPTargetDataDirective), + llvm::alignOf<OMPClause *>()) + + sizeof(OMPClause *) * N + sizeof(Stmt *)); return new (Mem) OMPTargetDataDirective(N); } @@ -723,8 +721,8 @@ OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTeamsDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPTeamsDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); OMPTeamsDirective *Dir = @@ -737,8 +735,8 @@ OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C, OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTeamsDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPTeamsDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); return new (Mem) OMPTeamsDirective(NumClauses); @@ -748,8 +746,8 @@ OMPTaskLoopDirective *OMPTaskLoopDirective::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTaskLoopDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPTaskLoopDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop)); @@ -783,8 +781,8 @@ OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTaskLoopDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = + llvm::alignTo(sizeof(OMPTaskLoopDirective), llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop)); @@ -795,8 +793,8 @@ OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTaskLoopSimdDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), + llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop_simd)); @@ -829,8 +827,8 @@ OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create( OMPTaskLoopSimdDirective * OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTaskLoopSimdDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), + llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop_simd)); @@ -841,8 +839,8 @@ OMPDistributeDirective *OMPDistributeDirective::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, const HelperExprs &Exprs) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPDistributeDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = llvm::alignTo(sizeof(OMPDistributeDirective), + llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_distribute)); @@ -875,8 +873,8 @@ OMPDistributeDirective *OMPDistributeDirective::Create( OMPDistributeDirective * OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, unsigned CollapsedNum, EmptyShell) { - unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPDistributeDirective), - llvm::alignOf<OMPClause *>()); + unsigned Size = llvm::alignTo(sizeof(OMPDistributeDirective), + llvm::alignOf<OMPClause *>()); void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_distribute)); diff --git a/clang/lib/AST/TypeLoc.cpp b/clang/lib/AST/TypeLoc.cpp index d08b07b2ccd..565fa5dfda7 100644 --- a/clang/lib/AST/TypeLoc.cpp +++ b/clang/lib/AST/TypeLoc.cpp @@ -80,11 +80,11 @@ unsigned TypeLoc::getFullDataSizeForType(QualType Ty) { while (!TyLoc.isNull()) { unsigned Align = getLocalAlignmentForType(TyLoc.getType()); MaxAlign = std::max(Align, MaxAlign); - Total = llvm::RoundUpToAlignment(Total, Align); + Total = llvm::alignTo(Total, Align); Total += TypeSizer().Visit(TyLoc); TyLoc = TyLoc.getNextTypeLoc(); } - Total = llvm::RoundUpToAlignment(Total, MaxAlign); + Total = llvm::alignTo(Total, MaxAlign); return Total; } @@ -149,12 +149,12 @@ void TypeLoc::copy(TypeLoc other) { // If both data pointers are aligned to the maximum alignment, we // can memcpy because getFullDataSize() accurately reflects the // layout of the data. - if (reinterpret_cast<uintptr_t>(Data) - == llvm::RoundUpToAlignment(reinterpret_cast<uintptr_t>(Data), - TypeLocMaxDataAlign) && - reinterpret_cast<uintptr_t>(other.Data) - == llvm::RoundUpToAlignment(reinterpret_cast<uintptr_t>(other.Data), - TypeLocMaxDataAlign)) { + if (reinterpret_cast<uintptr_t>(Data) == + llvm::alignTo(reinterpret_cast<uintptr_t>(Data), + TypeLocMaxDataAlign) && + reinterpret_cast<uintptr_t>(other.Data) == + llvm::alignTo(reinterpret_cast<uintptr_t>(other.Data), + TypeLocMaxDataAlign)) { memcpy(Data, other.Data, getFullDataSize()); return; } diff --git a/clang/lib/CodeGen/CGAtomic.cpp b/clang/lib/CodeGen/CGAtomic.cpp index 24de30b0b86..1ef5d1035a0 100644 --- a/clang/lib/CodeGen/CGAtomic.cpp +++ b/clang/lib/CodeGen/CGAtomic.cpp @@ -79,7 +79,7 @@ namespace { auto Offset = OrigBFI.Offset % C.toBits(lvalue.getAlignment()); AtomicSizeInBits = C.toBits( C.toCharUnitsFromBits(Offset + OrigBFI.Size + C.getCharWidth() - 1) - .RoundUpToAlignment(lvalue.getAlignment())); + .alignTo(lvalue.getAlignment())); auto VoidPtrAddr = CGF.EmitCastToVoidPtr(lvalue.getBitFieldPointer()); auto OffsetInChars = (C.toCharUnitsFromBits(OrigBFI.Offset) / lvalue.getAlignment()) * diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index ba2941e9df4..742a5236e9f 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -508,7 +508,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CodeGenFunction *CGF, // At this point, we just have to add padding if the end align still // isn't aligned right. if (endAlign < maxFieldAlign) { - CharUnits newBlockSize = blockSize.RoundUpToAlignment(maxFieldAlign); + CharUnits newBlockSize = blockSize.alignTo(maxFieldAlign); CharUnits padding = newBlockSize - blockSize; // If we haven't yet added any fields, remember that there was an @@ -2108,7 +2108,7 @@ const BlockByrefInfo &CodeGenFunction::getBlockByrefInfo(const VarDecl *D) { bool packed = false; CharUnits varAlign = getContext().getDeclAlign(D); - CharUnits varOffset = size.RoundUpToAlignment(varAlign); + CharUnits varOffset = size.alignTo(varAlign); // We may have to insert padding. if (varOffset != size) { diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp index ba7dcf7de6c..2678b33f392 100644 --- a/clang/lib/CodeGen/CGCleanup.cpp +++ b/clang/lib/CodeGen/CGCleanup.cpp @@ -112,7 +112,7 @@ RValue DominatingValue<RValue>::saved_type::restore(CodeGenFunction &CGF) { /// Push an entry of the given size onto this protected-scope stack. char *EHScopeStack::allocate(size_t Size) { - Size = llvm::RoundUpToAlignment(Size, ScopeStackAlignment); + Size = llvm::alignTo(Size, ScopeStackAlignment); if (!StartOfBuffer) { unsigned Capacity = 1024; while (Capacity < Size) Capacity *= 2; @@ -143,7 +143,7 @@ char *EHScopeStack::allocate(size_t Size) { } void EHScopeStack::deallocate(size_t Size) { - StartOfData += llvm::RoundUpToAlignment(Size, ScopeStackAlignment); + StartOfData += llvm::alignTo(Size, ScopeStackAlignment); } bool EHScopeStack::containsOnlyLifetimeMarkers( diff --git a/clang/lib/CodeGen/CGCleanup.h b/clang/lib/CodeGen/CGCleanup.h index 909f00b0592..4823773a43a 100644 --- a/clang/lib/CodeGen/CGCleanup.h +++ b/clang/lib/CodeGen/CGCleanup.h @@ -540,7 +540,7 @@ public: Size = EHPadEndScope::getSize(); break; } - Ptr += llvm::RoundUpToAlignment(Size, ScopeStackAlignment); + Ptr += llvm::alignTo(Size, ScopeStackAlignment); return *this; } diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 5df85194878..2511b249f0f 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -2896,8 +2896,7 @@ llvm::DIType *CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD, CGM.getTarget().getPointerAlign(0))) { CharUnits FieldOffsetInBytes = CGM.getContext().toCharUnitsFromBits(FieldOffset); - CharUnits AlignedOffsetInBytes = - FieldOffsetInBytes.RoundUpToAlignment(Align); + CharUnits AlignedOffsetInBytes = FieldOffsetInBytes.alignTo(Align); CharUnits NumPaddingBytes = AlignedOffsetInBytes - FieldOffsetInBytes; if (NumPaddingBytes.isPositive()) { diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index ee049f1810a..2aed3bb06d9 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -111,7 +111,7 @@ AppendBytes(CharUnits FieldOffsetInChars, llvm::Constant *InitCst) { // Round up the field offset to the alignment of the field type. CharUnits AlignedNextFieldOffsetInChars = - NextFieldOffsetInChars.RoundUpToAlignment(FieldAlignment); + NextFieldOffsetInChars.alignTo(FieldAlignment); if (AlignedNextFieldOffsetInChars < FieldOffsetInChars) { // We need to append padding. @@ -121,7 +121,7 @@ AppendBytes(CharUnits FieldOffsetInChars, llvm::Constant *InitCst) { "Did not add enough padding!"); AlignedNextFieldOffsetInChars = - NextFieldOffsetInChars.RoundUpToAlignment(FieldAlignment); + NextFieldOffsetInChars.alignTo(FieldAlignment); } if (AlignedNextFieldOffsetInChars > FieldOffsetInChars) { @@ -162,8 +162,8 @@ void ConstStructBuilder::AppendBitField(const FieldDecl *Field, if (FieldOffset > NextFieldOffsetInBits) { // We need to add padding. CharUnits PadSize = Context.toCharUnitsFromBits( - llvm::RoundUpToAlignment(FieldOffset - NextFieldOffsetInBits, - Context.getTargetInfo().getCharAlign())); + llvm::alignTo(FieldOffset - NextFieldOffsetInBits, + Context.getTargetInfo().getCharAlign())); AppendPadding(PadSize); } @@ -334,7 +334,7 @@ void ConstStructBuilder::ConvertStructToPacked() { CharUnits ElementAlign = CharUnits::fromQuantity( CGM.getDataLayout().getABITypeAlignment(C->getType())); CharUnits AlignedElementOffsetInChars = - ElementOffsetInChars.RoundUpToAlignment(ElementAlign); + ElementOffsetInChars.alignTo(ElementAlign); if (AlignedElementOffsetInChars > ElementOffsetInChars) { // We need some padding. @@ -508,13 +508,12 @@ llvm::Constant *ConstStructBuilder::Finalize(QualType Ty) { } else { // Append tail padding if necessary. CharUnits LLVMSizeInChars = - NextFieldOffsetInChars.RoundUpToAlignment(LLVMStructAlignment); + NextFieldOffsetInChars.alignTo(LLVMStructAlignment); if (LLVMSizeInChars != LayoutSizeInChars) AppendTailPadding(LayoutSizeInChars); - LLVMSizeInChars = - NextFieldOffsetInChars.RoundUpToAlignment(LLVMStructAlignment); + LLVMSizeInChars = NextFieldOffsetInChars.alignTo(LLVMStructAlignment); // Check if we need to convert the struct to a packed struct. if (NextFieldOffsetInChars <= LayoutSizeInChars && @@ -526,8 +525,7 @@ llvm::Constant *ConstStructBuilder::Finalize(QualType Ty) { "Converting to packed did not help!"); } - LLVMSizeInChars = - NextFieldOffsetInChars.RoundUpToAlignment(LLVMStructAlignment); + LLVMSizeInChars = NextFieldOffsetInChars.alignTo(LLVMStructAlignment); assert(LayoutSizeInChars == LLVMSizeInChars && "Tail padding mismatch!"); @@ -546,8 +544,9 @@ llvm::Constant *ConstStructBuilder::Finalize(QualType Ty) { llvm::Constant *Result = llvm::ConstantStruct::get(STy, Elements); - assert(NextFieldOffsetInChars.RoundUpToAlignment(getAlignment(Result)) == - getSizeInChars(Result) && "Size mismatch!"); + assert(NextFieldOffsetInChars.alignTo(getAlignment(Result)) == + getSizeInChars(Result) && + "Size mismatch!"); return Result; } diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index e30b2875f20..ef0515c36e0 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -4954,7 +4954,7 @@ CGObjCCommonMac::BuildIvarLayout(const ObjCImplementationDecl *OMD, baseOffset = CharUnits::Zero(); } - baseOffset = baseOffset.RoundUpToAlignment(CGM.getPointerAlign()); + baseOffset = baseOffset.alignTo(CGM.getPointerAlign()); } else { CGM.getContext().DeepCollectObjCIvars(OI, true, ivars); diff --git a/clang/lib/CodeGen/CGObjCRuntime.cpp b/clang/lib/CodeGen/CGObjCRuntime.cpp index 7be9ae99604..01042536a52 100644 --- a/clang/lib/CodeGen/CGObjCRuntime.cpp +++ b/clang/lib/CodeGen/CGObjCRuntime.cpp @@ -120,9 +120,8 @@ LValue CGObjCRuntime::EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF, uint64_t BitOffset = FieldBitOffset % CGF.CGM.getContext().getCharWidth(); uint64_t AlignmentBits = CGF.CGM.getTarget().getCharAlign(); uint64_t BitFieldSize = Ivar->getBitWidthValue(CGF.getContext()); - CharUnits StorageSize = - CGF.CGM.getContext().toCharUnitsFromBits( - llvm::RoundUpToAlignment(BitOffset + BitFieldSize, AlignmentBits)); + CharUnits StorageSize = CGF.CGM.getContext().toCharUnitsFromBits( + llvm::alignTo(BitOffset + BitFieldSize, AlignmentBits)); CharUnits Alignment = CGF.CGM.getContext().toCharUnitsFromBits(AlignmentBits); // Allocate a new CGBitFieldInfo object to describe this access. diff --git a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp index 375b59c5cb3..d0381ef82d9 100644 --- a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -121,7 +121,7 @@ struct CGRecordLowering { /// \brief Wraps llvm::Type::getIntNTy with some implicit arguments. llvm::Type *getIntNType(uint64_t NumBits) { return llvm::Type::getIntNTy(Types.getLLVMContext(), - (unsigned)llvm::RoundUpToAlignment(NumBits, 8)); + (unsigned)llvm::alignTo(NumBits, 8)); } /// \brief Gets an llvm type of size NumBytes and alignment 1. llvm::Type *getByteArrayType(CharUnits NumBytes) { @@ -555,7 +555,7 @@ void CGRecordLowering::clipTailPadding() { if (Member->Offset < Tail) { assert(Prior->Kind == MemberInfo::Field && !Prior->FD && "Only storage fields have tail padding!"); - Prior->Data = getByteArrayType(bitsToCharUnits(llvm::RoundUpToAlignment( + Prior->Data = getByteArrayType(bitsToCharUnits(llvm::alignTo( cast<llvm::IntegerType>(Prior->Data)->getIntegerBitWidth(), 8))); } if (Member->Data) @@ -609,8 +609,8 @@ void CGRecordLowering::insertPadding() { CharUnits Offset = Member->Offset; assert(Offset >= Size); // Insert padding if we need to. - if (Offset != Size.RoundUpToAlignment(Packed ? CharUnits::One() : - getAlignment(Member->Data))) + if (Offset != + Size.alignTo(Packed ? CharUnits::One() : getAlignment(Member->Data))) Padding.push_back(std::make_pair(Size, Offset - Size)); Size = Offset + getSize(Member->Data); } diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 4566fdbebf8..f6f8405b0e0 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -217,7 +217,7 @@ static Address emitVoidPtrDirectVAArg(CodeGenFunction &CGF, } // Advance the pointer past the argument, then store that back. - CharUnits FullDirectSize = DirectSize.RoundUpToAlignment(SlotSize); + CharUnits FullDirectSize = DirectSize.alignTo(SlotSize); llvm::Value *NextPtr = CGF.Builder.CreateConstInBoundsByteGEP(Addr.getPointer(), FullDirectSize, "argp.next"); @@ -1474,7 +1474,7 @@ X86_32ABIInfo::addFieldToArgStruct(SmallVector<llvm::Type *, 6> &FrameFields, // Insert padding bytes to respect alignment. CharUnits FieldEnd = StackOffset; - StackOffset = FieldEnd.RoundUpToAlignment(FieldAlign); + StackOffset = FieldEnd.alignTo(FieldAlign); if (StackOffset != FieldEnd) { CharUnits NumBytes = StackOffset - FieldEnd; llvm::Type *Ty = llvm::Type::getInt8Ty(getVMContext()); @@ -2775,7 +2775,7 @@ GetX86_64ByValArgumentPair(llvm::Type *Lo, llvm::Type *Hi, // the second element at offset 8. Check for this: unsigned LoSize = (unsigned)TD.getTypeAllocSize(Lo); unsigned HiAlign = TD.getABITypeAlignment(Hi); - unsigned HiStart = llvm::RoundUpToAlignment(LoSize, HiAlign); + unsigned HiStart = llvm::alignTo(LoSize, HiAlign); assert(HiStart != 0 && HiStart <= 8 && "Invalid x86-64 argument pair!"); // To handle this, we have to increase the size of the low part so that the @@ -3575,7 +3575,7 @@ Address PPC32_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAList, CharUnits Size; if (!isIndirect) { auto TypeInfo = CGF.getContext().getTypeInfoInChars(Ty); - Size = TypeInfo.first.RoundUpToAlignment(OverflowAreaAlign); + Size = TypeInfo.first.alignTo(OverflowAreaAlign); } else { Size = CGF.getPointerSize(); } @@ -4026,13 +4026,13 @@ PPC64_SVR4_ABIInfo::classifyArgumentType(QualType Ty) const { // Types up to 8 bytes are passed as integer type (which will be // properly aligned in the argument save area doubleword). if (Bits <= GPRBits) - CoerceTy = llvm::IntegerType::get(getVMContext(), - llvm::RoundUpToAlignment(Bits, 8)); + CoerceTy = + llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8)); // Larger types are passed as arrays, with the base type selected // according to the required alignment in the save area. else { uint64_t RegBits = ABIAlign * 8; - uint64_t NumRegs = llvm::RoundUpToAlignment(Bits, RegBits) / RegBits; + uint64_t NumRegs = llvm::alignTo(Bits, RegBits) / RegBits; llvm::Type *RegTy = llvm::IntegerType::get(getVMContext(), RegBits); CoerceTy = llvm::ArrayType::get(RegTy, NumRegs); } @@ -4092,8 +4092,8 @@ PPC64_SVR4_ABIInfo::classifyReturnType(QualType RetTy) const { CoerceTy = llvm::IntegerType::get(getVMContext(), GPRBits); CoerceTy = llvm::StructType::get(CoerceTy, CoerceTy, nullptr); } else - CoerceTy = llvm::IntegerType::get(getVMContext(), - llvm::RoundUpToAlignment(Bits, 8)); + CoerceTy = + llvm::IntegerType::get(getVMContext(), llvm::alignTo(Bits, 8)); return ABIArgInfo::getDirect(CoerceTy); } @@ -4486,7 +4486,7 @@ Address AArch64ABIInfo::EmitAAPCSVAArg(Address VAListAddr, reg_offs = CGF.Builder.CreateLoad(reg_offs_p, "gr_offs"); reg_top_index = 1; // field number for __gr_top reg_top_offset = CharUnits::fromQuantity(8); - RegSize = llvm::RoundUpToAlignment(RegSize, 8); + RegSize = llvm::alignTo(RegSize, 8); } else { // 4 is the field number of __vr_offs. reg_offs_p = @@ -4656,7 +4656,7 @@ Address AArch64ABIInfo::EmitAAPCSVAArg(Address VAListAddr, if (IsIndirect) StackSize = StackSlotSize; else - StackSize = TyInfo.first.RoundUpToAlignment(StackSlotSize); + StackSize = TyInfo.first.alignTo(StackSlotSize); llvm::Value *StackSizeC = CGF.Builder.getSize(StackSize); llvm::Value *NewStack = @@ -5269,7 +5269,7 @@ ABIArgInfo ARMABIInfo::classifyReturnType(QualType RetTy, } else if (Size <= 128 && getABIKind() == AAPCS16_VFP) { llvm::Type *Int32Ty = llvm::Type::getInt32Ty(getVMContext()); llvm::Type *CoerceTy = - llvm::ArrayType::get(Int32Ty, llvm::RoundUpToAlignment(Size, 32) / 32); + llvm::ArrayType::get(Int32Ty, llvm::alignTo(Size, 32) / 32); return ABIArgInfo::getDirect(CoerceTy); } @@ -6079,8 +6079,8 @@ MipsABIInfo::classifyArgumentType(QualType Ty, uint64_t &Offset) const { Align = std::min(std::max(Align, (uint64_t)MinABIStackAlignInBytes), (uint64_t)StackAlignInBytes); - unsigned CurrOffset = llvm::RoundUpToAlignment(Offset, Align); - Offset = CurrOffset + llvm::RoundUpToAlignment(TySize, Align * 8) / 8; + unsigned CurrOffset = llvm::alignTo(Offset, Align); + Offset = CurrOffset + llvm::alignTo(TySize, Align * 8) / 8; if (isAggregateTypeForABI(Ty) || Ty->isVectorType()) { // Ignore empty aggregates. @@ -6581,7 +6581,7 @@ private: return; // Finish the current 64-bit word. - uint64_t Aligned = llvm::RoundUpToAlignment(Size, 64); + uint64_t Aligned = llvm::alignTo(Size, 64); if (Aligned > Size && Aligned <= ToSize) { Elems.push_back(llvm::IntegerType::get(Context, Aligned - Size)); Size = Aligned; @@ -6698,7 +6698,7 @@ SparcV9ABIInfo::classifyType(QualType Ty, unsigned SizeLimit) const { CoerceBuilder CB(getVMContext(), getDataLayout()); CB.addStruct(0, StrTy); - CB.pad(llvm::RoundUpToAlignment(CB.DL.getTypeSizeInBits(StrTy), 64)); + CB.pad(llvm::alignTo(CB.DL.getTypeSizeInBits(StrTy), 64)); // Try to use the original type for coercion. llvm::Type *CoerceTy = CB.isUsableType(StrTy) ? StrTy : CB.getType(); @@ -6740,7 +6740,7 @@ Address SparcV9ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, case ABIArgInfo::Direct: { auto AllocSize = getDataLayout().getTypeAllocSize(AI.getCoerceToType()); - Stride = CharUnits::fromQuantity(AllocSize).RoundUpToAlignment(SlotSize); + Stride = CharUnits::fromQuantity(AllocSize).alignTo(SlotSize); ArgAddr = Addr; break; } @@ -6967,7 +6967,7 @@ Address XCoreABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, Val = Builder.CreateBitCast(AP, ArgPtrTy); ArgSize = CharUnits::fromQuantity( getDataLayout().getTypeAllocSize(AI.getCoerceToType())); - ArgSize = ArgSize.RoundUpToAlignment(SlotSize); + ArgSize = ArgSize.alignTo(SlotSize); break; case ABIArgInfo::Indirect: Val = Builder.CreateElementBitCast(AP, ArgPtrTy); diff --git a/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp index 8ce37357fe1..05bb7b71b8a 100644 --- a/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp @@ -260,13 +260,13 @@ public: // We are poorly aligned, and we need to pad in order to layout another // field. Round up to at least the smallest field alignment that we // currently have. - CharUnits NextOffset = NewOffset.RoundUpToAlignment(Fields[0].Align); + CharUnits NextOffset = NewOffset.alignTo(Fields[0].Align); NewPad += NextOffset - NewOffset; NewOffset = NextOffset; } } // Calculate tail padding. - CharUnits NewSize = NewOffset.RoundUpToAlignment(RL.getAlignment()); + CharUnits NewSize = NewOffset.alignTo(RL.getAlignment()); NewPad += NewSize - NewOffset; return NewPad; } |