From c3f89253ae359c6a6a043da564892399cf058f01 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 20 Oct 2016 14:27:22 +0000 Subject: Retire llvm::alignOf in favor of C++11 alignof. No functionality change intended. llvm-svn: 284730 --- clang/lib/AST/DeclBase.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'clang/lib/AST/DeclBase.cpp') diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 77e74b044fd..7e790cec68a 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -45,8 +45,7 @@ void Decl::updateOutOfDate(IdentifierInfo &II) const { } #define DECL(DERIVED, BASE) \ - static_assert(llvm::AlignOf::Alignment >= \ - llvm::AlignOf::Alignment, \ + static_assert(alignof(Decl) >= alignof(DERIVED##Decl), \ "Alignment sufficient after objects prepended to " #DERIVED); #define ABSTRACT_DECL(DECL) #include "clang/AST/DeclNodes.inc" @@ -55,7 +54,7 @@ void *Decl::operator new(std::size_t Size, const ASTContext &Context, unsigned ID, std::size_t Extra) { // Allocate an extra 8 bytes worth of storage, which ensures that the // resulting pointer will still be 8-byte aligned. - static_assert(sizeof(unsigned) * 2 >= llvm::AlignOf::Alignment, + static_assert(sizeof(unsigned) * 2 >= alignof(Decl), "Decl won't be misaligned"); void *Start = Context.Allocate(Size + Extra + 8); void *Result = (char*)Start + 8; @@ -80,8 +79,7 @@ void *Decl::operator new(std::size_t Size, const ASTContext &Ctx, // Ensure required alignment of the resulting object by adding extra // padding at the start if required. size_t ExtraAlign = - llvm::OffsetToAlignment(sizeof(Module *), - llvm::AlignOf::Alignment); + llvm::OffsetToAlignment(sizeof(Module *), alignof(Decl)); char *Buffer = reinterpret_cast( ::operator new(ExtraAlign + sizeof(Module *) + Size + Extra, Ctx)); Buffer += ExtraAlign; -- cgit v1.2.3