@@ -62,7 +62,7 @@ namespace trailing_objects_internal {
62
62
template <typename First, typename ... Rest> class AlignmentCalcHelper {
63
63
private:
64
64
enum {
65
- FirstAlignment = AlignOf< First>::Alignment ,
65
+ FirstAlignment = alignof ( First) ,
66
66
RestAlignment = AlignmentCalcHelper<Rest...>::Alignment,
67
67
};
68
68
@@ -74,7 +74,7 @@ template <typename First, typename... Rest> class AlignmentCalcHelper {
74
74
75
75
template <typename First> class AlignmentCalcHelper <First> {
76
76
public:
77
- enum { Alignment = AlignOf< First>::Alignment };
77
+ enum { Alignment = alignof ( First) };
78
78
};
79
79
80
80
// / The base class for TrailingObjects* classes.
@@ -143,8 +143,7 @@ class TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, PrevTy, NextTy,
143
143
ParentType;
144
144
145
145
struct RequiresRealignment {
146
- static const bool value =
147
- llvm::AlignOf<PrevTy>::Alignment < llvm::AlignOf<NextTy>::Alignment;
146
+ static const bool value = alignof(PrevTy) < alignof(NextTy);
148
147
};
149
148
150
149
static LLVM_CONSTEXPR bool requiresRealignment () {
@@ -174,7 +173,7 @@ class TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, PrevTy, NextTy,
174
173
175
174
if (requiresRealignment ())
176
175
return reinterpret_cast <const NextTy *>(
177
- llvm::alignAddr (Ptr , llvm::alignOf<NextTy>( )));
176
+ llvm::alignAddr (Ptr , alignof (NextTy )));
178
177
else
179
178
return reinterpret_cast <const NextTy *>(Ptr );
180
179
}
@@ -188,8 +187,7 @@ class TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, PrevTy, NextTy,
188
187
Obj, TrailingObjectsBase::OverloadToken<PrevTy>());
189
188
190
189
if (requiresRealignment ())
191
- return reinterpret_cast <NextTy *>(
192
- llvm::alignAddr (Ptr , llvm::alignOf<NextTy>()));
190
+ return reinterpret_cast <NextTy *>(llvm::alignAddr (Ptr , alignof (NextTy)));
193
191
else
194
192
return reinterpret_cast <NextTy *>(Ptr );
195
193
}
@@ -201,9 +199,8 @@ class TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, PrevTy, NextTy,
201
199
size_t SizeSoFar, size_t Count1,
202
200
typename ExtractSecondType<MoreTys, size_t >::type... MoreCounts) {
203
201
return ParentType::additionalSizeToAllocImpl (
204
- (requiresRealignment ()
205
- ? llvm::alignTo<llvm::AlignOf<NextTy>::Alignment>(SizeSoFar)
206
- : SizeSoFar) +
202
+ (requiresRealignment () ? llvm::alignTo<alignof (NextTy)>(SizeSoFar)
203
+ : SizeSoFar) +
207
204
sizeof (NextTy) * Count1,
208
205
MoreCounts...);
209
206
}
@@ -216,10 +213,9 @@ class TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, PrevTy, NextTy,
216
213
static_assert (sizeof ...(MoreTys) == sizeof ...(MoreCounts),
217
214
" Number of counts do not match number of types" );
218
215
static const size_t value = ParentType::template AdditionalSizeToAllocImpl<
219
- (RequiresRealignment::value
220
- ? llvm::AlignTo<llvm::AlignOf<NextTy>::Alignment>::
221
- template from_value<SizeSoFar>::value
222
- : SizeSoFar) +
216
+ (RequiresRealignment::value ? llvm::AlignTo<alignof(NextTy)>::
217
+ template from_value<SizeSoFar>::value
218
+ : SizeSoFar) +
223
219
sizeof (NextTy) * Count1,
224
220
MoreCounts...>::value;
225
221
};
@@ -407,9 +403,7 @@ class TrailingObjects : private trailing_objects_internal::TrailingObjectsImpl<
407
403
enum {
408
404
Size = TotalSizeToAlloc<Tys...>::template with_counts<Counts...>::value
409
405
};
410
- typedef llvm::AlignedCharArray<
411
- llvm::AlignOf<BaseTy>::Alignment, Size
412
- > type;
406
+ typedef llvm::AlignedCharArray<alignof(BaseTy), Size > type;
413
407
};
414
408
};
415
409
0 commit comments