[clang] 68baaca - [clang][dataflow] Use `Strict` accessors in comma operator and no-op cast.

Martin Braenne via cfe-commits cfe-commits at lists.llvm.org
Tue May 23 04:58:09 PDT 2023


Author: Martin Braenne
Date: 2023-05-23T11:58:00Z
New Revision: 68baaca61dfad1179a61d99cbf0fe23a6894849d

URL: https://github.com/llvm/llvm-project/commit/68baaca61dfad1179a61d99cbf0fe23a6894849d
DIFF: https://github.com/llvm/llvm-project/commit/68baaca61dfad1179a61d99cbf0fe23a6894849d.diff

LOG: [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

Added: 
    

Modified: 
    clang/lib/Analysis/FlowSensitive/Transfer.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/FlowSensitive/Transfer.cpp b/clang/lib/Analysis/FlowSensitive/Transfer.cpp
index 838ad934b5fbd..9658f5bcd6a0e 100644
--- a/clang/lib/Analysis/FlowSensitive/Transfer.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Transfer.cpp
@@ -224,8 +224,7 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
       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 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
       // 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:


        


More information about the cfe-commits mailing list