mboehme created this revision. Herald added subscribers: martong, xazax.hun. Herald added a reviewer: NoQ. Herald added a project: All. mboehme requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Repository: rG LLVM Github Monorepo 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()) {
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()) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits