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

via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 1 06:15:35 PST 2023


================
@@ -54,6 +54,18 @@ void clang::dataflow::copyRecord(RecordStorageLocation &Src,
     }
   }
 
+  for (const auto &[Name, PropLocSrc] : Src.synthetic_fields()) {
+    if (PropLocSrc->getType()->isRecordType()) {
+      copyRecord(*cast<RecordStorageLocation>(PropLocSrc),
+                 cast<RecordStorageLocation>(Dst.getSyntheticField(Name)), Env);
+    } else {
+      if (Value *Val = Env.getValue(*PropLocSrc))
----------------
martinboehme wrote:

`else if` would reduce indentation, but it would also lose the grouping that we currently have: The outer `else` block handles the case where the synthetic field isn't a record type. Having this indented within its own block makes it clearer which parts of the code handle which case -- so unless you feel strongly, I'd like to keep this as is.

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


More information about the cfe-commits mailing list