[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 27 12:13:02 PST 2024


================
@@ -1136,38 +1136,19 @@ llvm::Value *CodeGenFunction::EmitCountedByFieldExpr(
 }
 
 const FieldDecl *CodeGenFunction::FindCountedByField(const FieldDecl *FD) {
-  if (!FD || !FD->hasAttr<CountedByAttr>())
+  if (!FD)
     return nullptr;
 
-  const auto *CBA = FD->getAttr<CountedByAttr>();
-  if (!CBA)
+  auto *CAT = FD->getType()->getAs<CountAttributedType>();
----------------
AaronBallman wrote:

```suggestion
  const auto *CAT = FD->getType()->getAs<CountAttributedType>();
```
Same edits elsewhere in this function.

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


More information about the cfe-commits mailing list