[clang] [llvm] [Clang] Fix definition of layout-compatible to ignore empty classes (PR #92103)

Mital Ashok via cfe-commits cfe-commits at lists.llvm.org
Tue May 21 04:57:22 PDT 2024


================
@@ -561,6 +561,42 @@ void CXXRecordDecl::addedClassSubobject(CXXRecordDecl *Subobj) {
     data().StructuralIfLiteral = false;
 }
 
+const CXXRecordDecl *CXXRecordDecl::getStandardLayoutBaseWithFields() const {
+#ifndef NDEBUG
+  {
+    assert(
+        isStandardLayout() &&
+        "getStandardLayoutBaseWithFields called on a non-standard-layout type");
+    unsigned NumberOfBasesWithFields = 0;
+    if (!field_empty())
+      ++NumberOfBasesWithFields;
+    std::set<const CXXRecordDecl *> UniqueBases;
----------------
MitalAshok wrote:

@Endilll `llvm::SmallPtrSet` seemed more appropriate here

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


More information about the cfe-commits mailing list