================
@@ -8463,133 +8463,110 @@ static void handleZeroCallUsedRegsAttr(Sema &S, Decl 
*D, const ParsedAttr &AL) {
   D->addAttr(ZeroCallUsedRegsAttr::Create(S.Context, Kind, AL));
 }
 
-static void handleCountedByAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
-  if (!AL.isArgIdent(0)) {
-    S.Diag(AL.getLoc(), diag::err_attribute_argument_type)
-        << AL << AANT_ArgumentIdentifier;
-    return;
+static const RecordDecl *GetEnclosingNamedOrTopAnonRecord(const FieldDecl *FD) 
{
+  const auto *RD = FD->getParent();
+  while (RD && (RD->isAnonymousStructOrUnion() || RD->getName().empty())) {
----------------
rapidsna wrote:

> Are you sure this is processing after it's set?
@bwendling No, it doesn't, but I was initially meant to find the other struct 
that was already parsed like below. 
```
struct Parent {
  struct {
    int count;
  }; // anonymous struct
  int fam[__counted_by(count)]; // Sema is here
} ;
```
But now I'm looking at it, the logic needs to be fixed because it still doesn't 
tell us apart from: 
```
struct Parent {
  struct {
    int count;
  }; p // unnamed but non-anonymous struct
  int fam[__counted_by(count)]; // Sema is here
} ;
```

I'll fix that.

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

Reply via email to