[PATCH] D147601: [clang][dataflow] Eliminate code duplication in Environment::createValueUnlessSelfReferential().
Martin Böhme via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 6 00:02:06 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3c8ead2662ac: [clang][dataflow] Eliminate code duplication in Environment… (authored by mboehme).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147601/new/
https://reviews.llvm.org/D147601
Files:
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
Index: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
===================================================================
--- clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
+++ clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
@@ -688,9 +688,9 @@
return &create<IntegerValue>();
}
- if (Type->isReferenceType()) {
+ if (Type->isReferenceType() || Type->isPointerType()) {
CreatedValuesCount++;
- QualType PointeeType = Type->castAs<ReferenceType>()->getPointeeType();
+ QualType PointeeType = Type->getPointeeType();
auto &PointeeLoc = createStorageLocation(PointeeType);
if (Visited.insert(PointeeType.getCanonicalType()).second) {
@@ -702,24 +702,10 @@
setValue(PointeeLoc, *PointeeVal);
}
- return &create<ReferenceValue>(PointeeLoc);
- }
-
- if (Type->isPointerType()) {
- CreatedValuesCount++;
- QualType PointeeType = Type->castAs<PointerType>()->getPointeeType();
- auto &PointeeLoc = createStorageLocation(PointeeType);
-
- if (Visited.insert(PointeeType.getCanonicalType()).second) {
- Value *PointeeVal = createValueUnlessSelfReferential(
- PointeeType, Visited, Depth, CreatedValuesCount);
- Visited.erase(PointeeType.getCanonicalType());
-
- if (PointeeVal != nullptr)
- setValue(PointeeLoc, *PointeeVal);
- }
-
- return &create<PointerValue>(PointeeLoc);
+ if (Type->isReferenceType())
+ return &create<ReferenceValue>(PointeeLoc);
+ else
+ return &create<PointerValue>(PointeeLoc);
}
if (Type->isStructureOrClassType() || Type->isUnionType()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147601.511295.patch
Type: text/x-patch
Size: 1615 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230406/7b33086c/attachment.bin>
More information about the cfe-commits
mailing list