aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
diff options
context:
space:
mode:
authorMartin Braenne <mboehme@google.com>2023-07-20 11:12:39 +0000
committerMartin Braenne <mboehme@google.com>2023-07-24 13:20:01 +0000
commit44f98d0101fe82352e7c5fa98f1b2e9dc1159200 (patch)
tree38d53ac3f5a7cae9e1f8160823131044bdf5a6bb /clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
parent4d02b472f1dc290388d8e826d52d4cc5c438612c (diff)
downloadllvm-44f98d0101fe82352e7c5fa98f1b2e9dc1159200.zip
llvm-44f98d0101fe82352e7c5fa98f1b2e9dc1159200.tar.gz
llvm-44f98d0101fe82352e7c5fa98f1b2e9dc1159200.tar.bz2
[clang][dataflow] Eliminate duplication between `AggregateStorageLocation` and `StructValue`.
After this change, `StructValue` is just a wrapper for an `AggregateStorageLocation`. For the wider context, see https://discourse.llvm.org/t/70086. ## How to review - Start by looking at the comments added / changed in Value.h, StorageLocation.h, and DataflowEnvironment.h. This will give you a good overview of the semantic changes. - Look at the corresponding .cpp files that implement the semantic changes. - Transfer.cpp, TypeErasedDataflowAnalysis.cpp, and RecordOps.cpp show how the core of the framework is affected by the semantic changes. - UncheckedOptionalAccessModel.cpp shows how this complex model is affected by the changes. - Many of the changes in the rest of the patch are mechanical in nature. Reviewed By: ymandel, xazax.hun Differential Revision: https://reviews.llvm.org/D155446
Diffstat (limited to 'clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp')
-rw-r--r--clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp b/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
index bb1c2c7..9f72dc8 100644
--- a/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
+++ b/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
@@ -62,7 +62,11 @@ StorageLocation &DataflowAnalysisContext::createStorageLocation(QualType Type) {
if (!Type.isNull() && Type->isRecordType()) {
llvm::DenseMap<const ValueDecl *, StorageLocation *> FieldLocs;
for (const FieldDecl *Field : getModeledFields(Type))
- FieldLocs.insert({Field, &createStorageLocation(Field->getType())});
+ if (Field->getType()->isReferenceType())
+ FieldLocs.insert({Field, nullptr});
+ else
+ FieldLocs.insert({Field, &createStorageLocation(
+ Field->getType().getNonReferenceType())});
return arena().create<AggregateStorageLocation>(Type, std::move(FieldLocs));
}
return arena().create<ScalarStorageLocation>(Type);