Skip to content

Update the EBO static_assert to dheck against APFloat::Storage instead of IEEEFloat. #112589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions llvm/include/llvm/ADT/APFloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -1474,11 +1474,11 @@ class APFloat : public APFloatBase {
friend APFloat frexp(const APFloat &X, int &Exp, roundingMode RM);
friend IEEEFloat;
friend DoubleAPFloat;
// Since Storage is private, friend class APFloatEBOChecker is added to allow
// access to it in APFloat.cpp.
friend class APFloatEBOChecker;
};

static_assert(sizeof(APFloat) == sizeof(detail::IEEEFloat),
"Empty base class optimization is not performed.");

/// See friend declarations above.
///
/// These additional declarations are required in order to compile LLVM with IBM
Expand Down
5 changes: 5 additions & 0 deletions llvm/lib/Support/APFloat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ enum class fltNanEncoding {
NegativeZero,
};

class APFloatEBOChecker {
static_assert(sizeof(APFloat) == sizeof(APFloat::U),
"Empty base class optimization is not performed.");
};

/* Represents floating point arithmetic semantics. */
struct fltSemantics {
/* The largest E such that 2^E is representable; this matches the
Expand Down
Loading