[clang] [clang][dataflow] Eliminate uses of `RecordValue::getChild()`. (PR #65329)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 5 07:13:29 PDT 2023


https://github.com/martinboehme created https://github.com/llvm/llvm-project/pull/65329:

We want to work towards eliminating the `RecordStorageLocation` from
`RecordValue`. These particular uses of `RecordValue::getChild()` can simply
be replaced with `RecordStorageLocation::getChild()`.


>From 6f03364c053e70a19fdefdb6dd38ce8a3cd0941b Mon Sep 17 00:00:00 2001
From: Martin Braenne <mboehme at google.com>
Date: Tue, 5 Sep 2023 14:12:38 +0000
Subject: [PATCH] [clang][dataflow] Eliminate uses of
 `RecordValue::getChild()`.

We want to work towards eliminating the `RecordStorageLocation` from
`RecordValue`. These particular uses of `RecordValue::getChild()` can simply
be replaced with `RecordStorageLocation::getChild()`.
---
 .../unittests/Analysis/FlowSensitive/TransferTest.cpp  | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp b/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
index 0a5cf62e5ea233..ff3618e999f004 100644
--- a/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
@@ -2860,11 +2860,11 @@ TEST(TransferTest, AggregateInitialization) {
 
           // Check that fields initialized in an initializer list are always
           // modeled in other instances of the same type.
-          const auto &OtherBVal =
-              getValueForDecl<RecordValue>(ASTCtx, Env, "OtherB");
-          EXPECT_THAT(OtherBVal.getChild(*BarDecl), NotNull());
-          EXPECT_THAT(OtherBVal.getChild(*BazDecl), NotNull());
-          EXPECT_THAT(OtherBVal.getChild(*QuxDecl), NotNull());
+          const auto &OtherBLoc =
+              getLocForDecl<RecordStorageLocation>(ASTCtx, Env, "OtherB");
+          EXPECT_THAT(OtherBLoc.getChild(*BarDecl), NotNull());
+          EXPECT_THAT(OtherBLoc.getChild(*BazDecl), NotNull());
+          EXPECT_THAT(OtherBLoc.getChild(*QuxDecl), NotNull());
         });
   }
 }



More information about the cfe-commits mailing list