diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGCleanup.cpp | 7 | ||||
-rw-r--r-- | clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp | 11 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 5 | ||||
-rw-r--r-- | clang/lib/Sema/TypeLocBuilder.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/TypeLocBuilder.h | 12 |
5 files changed, 18 insertions, 19 deletions
diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp index 5594f303022..3cf366e4635 100644 --- a/clang/lib/CodeGen/CGCleanup.cpp +++ b/clang/lib/CodeGen/CGCleanup.cpp @@ -740,14 +740,15 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) { // here. Unfortunately, if you ask for a SmallVector<char>, the // alignment isn't sufficient. auto *CleanupSource = reinterpret_cast<char *>(Scope.getCleanupBuffer()); - llvm::AlignedCharArray<EHScopeStack::ScopeStackAlignment, 8 * sizeof(void *)> CleanupBufferStack; + alignas(EHScopeStack::ScopeStackAlignment) char + CleanupBufferStack[8 * sizeof(void *)]; std::unique_ptr<char[]> CleanupBufferHeap; size_t CleanupSize = Scope.getCleanupSize(); EHScopeStack::Cleanup *Fn; if (CleanupSize <= sizeof(CleanupBufferStack)) { - memcpy(CleanupBufferStack.buffer, CleanupSource, CleanupSize); - Fn = reinterpret_cast<EHScopeStack::Cleanup *>(CleanupBufferStack.buffer); + memcpy(CleanupBufferStack, CleanupSource, CleanupSize); + Fn = reinterpret_cast<EHScopeStack::Cleanup *>(CleanupBufferStack); } else { CleanupBufferHeap.reset(new char[CleanupSize]); memcpy(CleanupBufferHeap.get(), CleanupSource, CleanupSize); diff --git a/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp b/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp index 6d7d69da4db..114d0815ba4 100644 --- a/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp +++ b/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp @@ -184,10 +184,11 @@ void DirectoryWatcherLinux::InotifyPollingLoop() { // the inotify file descriptor should have the same alignment as // struct inotify_event. - auto ManagedBuffer = - llvm::make_unique<llvm::AlignedCharArray<alignof(struct inotify_event), - EventBufferLength>>(); - char *const Buf = ManagedBuffer->buffer; + struct Buffer { + alignas(struct inotify_event) char buffer[EventBufferLength]; + }; + auto ManagedBuffer = llvm::make_unique<Buffer>(); + char *const Buf = ManagedBuffer.buffer; const int EpollFD = epoll_create1(EPOLL_CLOEXEC); if (EpollFD == -1) { @@ -350,4 +351,4 @@ std::unique_ptr<DirectoryWatcher> clang::DirectoryWatcher::create( return llvm::make_unique<DirectoryWatcherLinux>( Path, Receiver, WaitForInitialSync, InotifyFD, InotifyWD, std::move(*InotifyPollingStopper)); -}
\ No newline at end of file +} diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index f632a4d3bd1..3e2657b46c4 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -7052,10 +7052,9 @@ void Sema::AddConversionCandidate( // allocator). QualType CallResultType = ConversionType.getNonLValueExprType(Context); - llvm::AlignedCharArray<alignof(CallExpr), sizeof(CallExpr) + sizeof(Stmt *)> - Buffer; + alignas(CallExpr) char Buffer[sizeof(CallExpr) + sizeof(Stmt *)]; CallExpr *TheTemporaryCall = CallExpr::CreateTemporary( - Buffer.buffer, &ConversionFn, CallResultType, VK, From->getBeginLoc()); + Buffer, &ConversionFn, CallResultType, VK, From->getBeginLoc()); ImplicitConversionSequence ICS = TryCopyInitialization(*this, TheTemporaryCall, ToType, diff --git a/clang/lib/Sema/TypeLocBuilder.cpp b/clang/lib/Sema/TypeLocBuilder.cpp index b451403544e..2dcbbd83c69 100644 --- a/clang/lib/Sema/TypeLocBuilder.cpp +++ b/clang/lib/Sema/TypeLocBuilder.cpp @@ -51,7 +51,7 @@ void TypeLocBuilder::grow(size_t NewCapacity) { &Buffer[Index], Capacity - Index); - if (Buffer != InlineBuffer.buffer) + if (Buffer != InlineBuffer) delete[] Buffer; Buffer = NewBuffer; diff --git a/clang/lib/Sema/TypeLocBuilder.h b/clang/lib/Sema/TypeLocBuilder.h index 1e6883926a8..738f731c9fe 100644 --- a/clang/lib/Sema/TypeLocBuilder.h +++ b/clang/lib/Sema/TypeLocBuilder.h @@ -39,18 +39,16 @@ class TypeLocBuilder { /// The inline buffer. enum { BufferMaxAlignment = alignof(void *) }; - llvm::AlignedCharArray<BufferMaxAlignment, InlineCapacity> InlineBuffer; + alignas(BufferMaxAlignment) char InlineBuffer[InlineCapacity]; unsigned NumBytesAtAlign4, NumBytesAtAlign8; - public: +public: TypeLocBuilder() - : Buffer(InlineBuffer.buffer), Capacity(InlineCapacity), - Index(InlineCapacity), NumBytesAtAlign4(0), NumBytesAtAlign8(0) - { - } + : Buffer(InlineBuffer), Capacity(InlineCapacity), Index(InlineCapacity), + NumBytesAtAlign4(0), NumBytesAtAlign8(0) {} ~TypeLocBuilder() { - if (Buffer != InlineBuffer.buffer) + if (Buffer != InlineBuffer) delete[] Buffer; } |