diff options
author | Andrew Browne <browneee@google.com> | 2020-04-30 17:17:23 -0700 |
---|---|---|
committer | Andrew Browne <browneee@google.com> | 2020-04-30 17:18:14 -0700 |
commit | d96c7f413f35ee6f343dfdcd7c5c11ea3e724e16 (patch) | |
tree | 24502b52ba83262427ed61d06de2f082065a733f /llvm/lib/Support/SmallVector.cpp | |
parent | 6a1ad76dab69589bdb2a37e7ad972e7511091065 (diff) | |
download | llvm-d96c7f413f35ee6f343dfdcd7c5c11ea3e724e16.zip llvm-d96c7f413f35ee6f343dfdcd7c5c11ea3e724e16.tar.gz llvm-d96c7f413f35ee6f343dfdcd7c5c11ea3e724e16.tar.bz2 |
Revert "Revert "[ADT] Fix SmallVector unused template instantiation on 32-bit systems.""
This reverts commit ac2635e457d53b80b0a6f73a5041767197643aae.
Revert was too hasty, build was already broken.
Diffstat (limited to 'llvm/lib/Support/SmallVector.cpp')
-rw-r--r-- | llvm/lib/Support/SmallVector.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Support/SmallVector.cpp b/llvm/lib/Support/SmallVector.cpp index 776b098..0c9ac83 100644 --- a/llvm/lib/Support/SmallVector.cpp +++ b/llvm/lib/Support/SmallVector.cpp @@ -78,4 +78,18 @@ void SmallVectorBase<Size_T>::grow_pod(void *FirstEl, size_t MinCapacity, } template class llvm::SmallVectorBase<uint32_t>; + +// Disable the uint64_t instantiation for 32-bit builds. +// Both uint32_t and uint64_t instantations are needed for 64-bit builds. +// This instantiation will never be used in 32-bit builds, and will cause +// warnings when sizeof(Size_T) > sizeof(size_t). +#if SIZE_MAX > UINT32_MAX template class llvm::SmallVectorBase<uint64_t>; + +// Assertions to ensure this #if stays in sync with SmallVectorSizeType. +static_assert(sizeof(SmallVectorSizeType<char>) == sizeof(uint64_t), + "Expected SmallVectorBase<uint64_t> variant to be in use."); +#else +static_assert(sizeof(SmallVectorSizeType<char>) == sizeof(uint32_t), + "Expected SmallVectorBase<uint32_t> variant to be in use."); +#endif |