================
@@ -1155,15 +1159,14 @@ const FieldDecl 
*CodeGenFunction::FindCountedByField(const FieldDecl *FD) {
     return nullptr;
 
   auto GetNonAnonStructOrUnion = [](const RecordDecl *RD) {
-    while (RD && !RD->getDeclName())
-      if (const auto *R = dyn_cast<RecordDecl>(RD->getDeclContext()))
-        RD = R;
-      else
+    while (RD && RD->isAnonymousStructOrUnion()) {
+      const auto *R = dyn_cast<RecordDecl>(RD->getDeclContext());
+      if (!R)
----------------
rapidsna wrote:

Can `!R` condition be actually reachable? IOW, can an anonymous struct or union 
has a parent that is not a RecordDecl?

https://github.com/llvm/llvm-project/pull/76348
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to