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

2023-12-04 Thread via cfe-commits
https://github.com/martinboehme closed https://github.com/llvm/llvm-project/pull/73860 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2023-12-04 Thread via cfe-commits
martinboehme wrote: > Overall, I love it! I have some comments on some features in the future, but > those are probably not going to be addressed any time soon. First of all, I > think in the future when we reason about the values of the pointers, > synthetic fields might need to have offsets

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

2023-12-03 Thread via cfe-commits
@@ -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 , +const

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

2023-12-03 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/73860 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2023-12-03 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. Overall, I love it! I have some comments on some features in the future, but those are probably not going to be addressed any time soon. First of all, I think in the future when we reason about the values of the pointers, synthetic

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

2023-12-03 Thread Gábor Horváth via cfe-commits
@@ -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 , +const

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

2023-12-03 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/73860 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2023-12-01 Thread via cfe-commits
@@ -88,12 +94,12 @@ class ScalarStorageLocation final : public StorageLocation { class RecordStorageLocation final : public StorageLocation { public: using FieldToLoc = llvm::DenseMap; + using SyntheticFieldMap = llvm::StringMap; martinboehme wrote: This

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

2023-12-01 Thread via cfe-commits
@@ -92,11 +96,39 @@ class DataflowAnalysisContext { /*Logger=*/nullptr}); ~DataflowAnalysisContext(); + /// Sets a callback that returns the names and types of the synthetic fields + /// to add to a `RecordStorageLocation` of a given type. +

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

2023-12-01 Thread via cfe-commits
@@ -54,6 +54,18 @@ void clang::dataflow::copyRecord(RecordStorageLocation , } } + for (const auto &[Name, PropLocSrc] : Src.synthetic_fields()) { +if (PropLocSrc->getType()->isRecordType()) { + copyRecord(*cast(PropLocSrc), +

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

2023-12-01 Thread via cfe-commits
@@ -73,7 +73,13 @@ class ScalarStorageLocation final : public StorageLocation { /// /// Contains storage locations for all modeled fields of the record (also /// referred to as "children"). The child map is flat, so accessible members of -/// the base class are directly

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

2023-12-01 Thread via cfe-commits
@@ -92,11 +96,39 @@ class DataflowAnalysisContext { /*Logger=*/nullptr}); ~DataflowAnalysisContext(); + /// Sets a callback that returns the names and types of the synthetic fields + /// to add to a `RecordStorageLocation` of a given type. +

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

2023-12-01 Thread via cfe-commits
@@ -92,11 +96,39 @@ class DataflowAnalysisContext { /*Logger=*/nullptr}); ~DataflowAnalysisContext(); + /// Sets a callback that returns the names and types of the synthetic fields + /// to add to a `RecordStorageLocation` of a given type. +

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

2023-12-01 Thread via cfe-commits
@@ -492,6 +492,56 @@ transferCFGBlock(const CFGBlock , AnalysisContext , return State; } +static Environment initializeEnvironment(const Environment ) { + Environment ResultEnv = InitEnv.fork(); martinboehme wrote: Now that this code has been moved to

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

2023-12-01 Thread via cfe-commits
@@ -492,6 +492,56 @@ transferCFGBlock(const CFGBlock , AnalysisContext , return State; } +static Environment initializeEnvironment(const Environment ) { martinboehme wrote: > Why not include this function as part of the Environment API? Good point --

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

2023-12-01 Thread via cfe-commits
https://github.com/martinboehme updated https://github.com/llvm/llvm-project/pull/73860 >From a7138289989afaa1348185e52469d670c316eb45 Mon Sep 17 00:00:00 2001 From: Martin Braenne Date: Wed, 29 Nov 2023 21:32:55 + Subject: [PATCH 1/4] [clang][dataflow] Defer initialization of

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

2023-11-30 Thread Gábor Horváth via cfe-commits
@@ -92,11 +96,39 @@ class DataflowAnalysisContext { /*Logger=*/nullptr}); ~DataflowAnalysisContext(); + /// Sets a callback that returns the names and types of the synthetic fields + /// to add to a `RecordStorageLocation` of a given type. +

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

2023-11-30 Thread Gábor Horváth via cfe-commits
@@ -92,11 +96,39 @@ class DataflowAnalysisContext { /*Logger=*/nullptr}); ~DataflowAnalysisContext(); + /// Sets a callback that returns the names and types of the synthetic fields + /// to add to a `RecordStorageLocation` of a given type. +

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

2023-11-30 Thread Gábor Horváth via cfe-commits
@@ -88,12 +94,12 @@ class ScalarStorageLocation final : public StorageLocation { class RecordStorageLocation final : public StorageLocation { public: using FieldToLoc = llvm::DenseMap; + using SyntheticFieldMap = llvm::StringMap; Xazax-hun wrote: I was

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

2023-11-30 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun commented: I generally love this direction, this was just a first pass, not a full review. I plan to take a second look but wanted to familiarize myself with the PR and start some conversations. https://github.com/llvm/llvm-project/pull/73860

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

2023-11-30 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/73860 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2023-11-30 Thread Yitzhak Mandelbaum via cfe-commits
@@ -92,11 +96,39 @@ class DataflowAnalysisContext { /*Logger=*/nullptr}); ~DataflowAnalysisContext(); + /// Sets a callback that returns the names and types of the synthetic fields + /// to add to a `RecordStorageLocation` of a given type. +

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

2023-11-30 Thread Yitzhak Mandelbaum via cfe-commits
@@ -492,6 +492,56 @@ transferCFGBlock(const CFGBlock , AnalysisContext , return State; } +static Environment initializeEnvironment(const Environment ) { + Environment ResultEnv = InitEnv.fork(); ymand wrote: Why `fork`? The function name implies that the

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

2023-11-30 Thread Yitzhak Mandelbaum via cfe-commits
@@ -492,6 +492,56 @@ transferCFGBlock(const CFGBlock , AnalysisContext , return State; } +static Environment initializeEnvironment(const Environment ) { ymand wrote: Why not include this function as part of the Environment API? At the least, please

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

2023-11-30 Thread Yitzhak Mandelbaum via cfe-commits
@@ -54,6 +54,18 @@ void clang::dataflow::copyRecord(RecordStorageLocation , } } + for (const auto &[Name, PropLocSrc] : Src.synthetic_fields()) { +if (PropLocSrc->getType()->isRecordType()) { + copyRecord(*cast(PropLocSrc), +

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

2023-11-30 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand edited https://github.com/llvm/llvm-project/pull/73860 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2023-11-30 Thread Yitzhak Mandelbaum via cfe-commits
@@ -73,7 +73,13 @@ class ScalarStorageLocation final : public StorageLocation { /// /// Contains storage locations for all modeled fields of the record (also /// referred to as "children"). The child map is flat, so accessible members of -/// the base class are directly

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

2023-11-30 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. This is amazing! I spent a while searching for changes to join/widen to account for synthetic fields and then realized that (of course!) no special handling is needed! I also love that we now have the hooks we've wanted since the beginning.