[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:01 PST 2024


================
@@ -385,6 +385,26 @@ void DependentBitIntType::Profile(llvm::FoldingSetNodeID &ID,
   NumBitsExpr->Profile(ID, Context, true);
 }
 
+bool BoundsAttributedType::referencesFieldDecls() const {
+  for (const auto &Decl : dependent_decls())
+    if (isa<FieldDecl>(Decl.getDecl()))
+      return true;
+  return false;
----------------
AaronBallman wrote:

```suggestion
  return llvm::any_of(dependent_decls(), [](const TypeCoupledDeclRefInfo &Info) { return isa<FieldDecl>(Info.getDecl()); });
```
Needs reformatting, but something like this should be a more clear equivalent.

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


More information about the cfe-commits mailing list