[all-commits] [llvm/llvm-project] edff73: [LLVMABI] Fix build for GCC < 8 (#190974)
Mészáros Gergely via All-commits
all-commits at lists.llvm.org
Wed Apr 8 21:18:56 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: edff73e19e4448541086431b325df75de62817ba
https://github.com/llvm/llvm-project/commit/edff73e19e4448541086431b325df75de62817ba
Author: Mészáros Gergely <gergely.meszaros at intel.com>
Date: 2026-04-09 (Thu, 09 Apr 2026)
Changed paths:
M llvm/include/llvm/ABI/FunctionInfo.h
Log Message:
-----------
[LLVMABI] Fix build for GCC < 8 (#190974)
`llvm::abi::ArgInfo::get*` functions return `llvm::abi::ArgInfo` by
value, so we need the type to be copyable. It is not though, because of
the non trivially copyable member `MaybeAlign` (`std::optional<Align>`)
in a union, which deletes the implicit copy/move constructors and
assignment operators.
For modern GCC versions and for clang this does not present as a problem
due to named return value optimization (NRVO). It is however not a bug
in old GCC versions, because NRVO is not guaranteed. Similary
`std::optional`
could be trivially copyable, but that is also not guaranteed by the
standard.
Instead of depending on these details of the C++ implementation, move
the `MaybeAlign` member out of the union, and make it a separate member
of `abi::ArgInfo`. We lose the expressiveness from the type system that
`IndirectAttrInfo` always has a defined alignment, but we can get that
back in practice by placing asserts in the code that uses it. Therefore
`llvm::abi::ArgInfo` can still maintain this invariant.
Fixes: #190972
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list