From 68baaca61dfad1179a61d99cbf0fe23a6894849d Mon Sep 17 00:00:00 2001 From: Martin Braenne Date: Wed, 17 May 2023 13:27:35 +0000 Subject: [PATCH] [clang][dataflow] Use `Strict` accessors in comma operator and no-op cast. This patch is part of the ongoing migration to strict handling of value categories (see https://discourse.llvm.org/t/70086 for details). Depends On D150775 Reviewed By: gribozavr2 Differential Revision: https://reviews.llvm.org/D150776 --- clang/lib/Analysis/FlowSensitive/Transfer.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/clang/lib/Analysis/FlowSensitive/Transfer.cpp b/clang/lib/Analysis/FlowSensitive/Transfer.cpp index 838ad93..9658f5b 100644 --- a/clang/lib/Analysis/FlowSensitive/Transfer.cpp +++ b/clang/lib/Analysis/FlowSensitive/Transfer.cpp @@ -224,8 +224,7 @@ public: break; } case BO_Comma: { - if (auto *Loc = Env.getStorageLocation(*RHS, SkipPast::None)) - Env.setStorageLocation(*S, *Loc); + propagateValueOrStorageLocation(*RHS, *S, Env); break; } default: @@ -397,13 +396,9 @@ public: // CK_ConstructorConversion, and CK_UserDefinedConversion. case CK_NoOp: { // FIXME: Consider making `Environment::getStorageLocation` skip noop - // expressions (this and other similar expressions in the file) instead of - // assigning them storage locations. - auto *SubExprLoc = Env.getStorageLocation(*SubExpr, SkipPast::None); - if (SubExprLoc == nullptr) - break; - - Env.setStorageLocation(*S, *SubExprLoc); + // expressions (this and other similar expressions in the file) instead + // of assigning them storage locations. + propagateValueOrStorageLocation(*SubExpr, *S, Env); break; } case CK_NullToPointer: -- 2.7.4