[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

Sergei Barannikov via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 26 03:05:41 PDT 2024


================
@@ -137,6 +137,16 @@ bool isEmptyField(ASTContext &Context, const FieldDecl *FD, bool AllowArrays,
 bool isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays,
                    bool AsIfNoUniqueAddr = false);
 
+/// isEmptyFieldForLayout - Return true iff the field is "empty", that is,
+/// either a zero-width bit-field or an \ref isEmptyRecordForLayout.
+bool isEmptyFieldForLayout(const ASTContext &Context, const FieldDecl *FD);
+
+/// isEmptyRecordForLayout - Return true iff a structure contains only empty
+/// base classes (per \ref isEmptyRecordForLayout) and fields (per
+/// \ref isEmptyFieldForLayout). Note, C++ record fields are considered empty
+/// if the [[no_unique_address]] attribute would have made them empty.
+bool isEmptyRecordForLayout(const ASTContext &Context, QualType T);
----------------
s-barannikov wrote:

These functions don't belong here. This file contains helper functions for use in implementations of ABIInfo class.
I guess CGRecordLayout* could be a better place for them.


https://github.com/llvm/llvm-project/pull/96422


More information about the cfe-commits mailing list