[clang] [clang][dataflow] Add synthetic fields to `RecordStorageLocation` (PR #73860)

via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 3 23:59:46 PST 2023


================
@@ -367,3 +394,14 @@ clang::dataflow::FieldSet clang::dataflow::getObjectFields(QualType Type) {
   getFieldsFromClassHierarchy(Type, Fields);
   return Fields;
 }
+
+bool clang::dataflow::containsSameFields(
+    const clang::dataflow::FieldSet &Fields,
+    const clang::dataflow::RecordStorageLocation::FieldToLoc &FieldLocs) {
+  if (Fields.size() != FieldLocs.size())
+    return false;
+  for ([[maybe_unused]] auto [Field, Loc] : FieldLocs)
+    if (!Fields.contains(cast_or_null<FieldDecl>(Field)))
----------------
martinboehme wrote:

This can happen for fields of reference type in the cases discussed [here](https://github.com/llvm/llvm-project/blob/c9c1b3c37fa5d5c617068afe67afcafacd58a241/clang/include/clang/Analysis/FlowSensitive/StorageLocation.h#L78).

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


More information about the cfe-commits mailing list