[clang] [BoundsSafety] Allow 'counted_by' attribute on pointers in structs in C (PR #90786)
Bill Wendling via cfe-commits
cfe-commits at lists.llvm.org
Fri May 3 12:06:33 PDT 2024
================
@@ -631,6 +631,18 @@ bool Type::isStructureType() const {
return false;
}
+bool Type::isStructureTypeWithFlexibleArrayMember() const {
+ const auto *RT = getAs<RecordType>();
+ if (!RT)
+ return false;
+ const auto *Decl = RT->getDecl();
+ if (!Decl->isStruct())
+ return false;
+ if (!Decl->hasFlexibleArrayMember())
+ return false;
+ return true;
----------------
bwendling wrote:
The last three lines could be simplified as:
```c
return Decl->hasFlexibleArrayMember();
```
https://github.com/llvm/llvm-project/pull/90786
More information about the cfe-commits
mailing list