[clang] [clang-tools-extra] [clang] Complete fields in __builtin_offsetof designators (PR #195126)

Jakob Linke via cfe-commits cfe-commits at lists.llvm.org
Thu May 7 04:01:05 PDT 2026


================
@@ -1670,6 +1675,11 @@ bool ResultBuilder::IsMember(const NamedDecl *ND) const {
          isa<ObjCPropertyDecl>(ND);
 }
 
+bool ResultBuilder::IsField(const NamedDecl *ND) const {
+  ND = ND->getUnderlyingDecl();
+  return isa<FieldDecl>(ND) || isa<IndirectFieldDecl>(ND);
----------------
schuay wrote:

Good suggestion. After adding the bit-field filter (the other review comment), the function needs to inspect the cast result to call `isBitField()`, so I switched it to `dyn_cast` instead. Let me know if you'd prefer a different shape.

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


More information about the cfe-commits mailing list