================
@@ -716,6 +702,72 @@ LValue CIRGenFunction::emitLValueForFieldInitialization(
   return makeAddrLValue(v, fieldType, fieldBaseInfo);
 }
 
+/// Collect the chain of fields leading from \p rd down to \p field, walking
+/// through nested (possibly anonymous) records. The outermost field comes 
first
+/// in \p path. Returns false if \p field isn't reachable from \p rd.
+static bool getFieldPathToField(const RecordDecl *rd, const FieldDecl *field,
+                                SmallVectorImpl<const FieldDecl *> &path) {
+  for (const FieldDecl *fd : rd->fields()) {
+    if (fd == field) {
+      path.push_back(fd);
+      return true;
+    }
+
+    if (const RecordDecl *nestedRD = fd->getType()->getAsRecordDecl()) {
+      path.push_back(fd);
+      if (getFieldPathToField(nestedRD, field, path))
+        return true;
+      path.pop_back();
+    }
+  }
+
+  return false;
+}
+
+Address CIRGenFunction::emitAddrOfCountedByField(const Expr *base,
+                                                 const FieldDecl *countDecl) {
+  assert(!countDecl->isBitField() && "cannot take the address of a bit-field");
----------------
slant14 wrote:

yeah! classic codegen returns nullptr for bitfields here, so I’ll match that 
behavior

https://github.com/llvm/llvm-project/pull/235781
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to