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

via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 6 00:43:09 PDT 2023


Author: martinboehme
Date: 2023-09-06T09:43:05+02:00
New Revision: f470c361d959ec21dee51f65b53412ff8a63c946

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

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

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

Added: 
    

Modified: 
    clang/unittests/Analysis/FlowSensitive/TransferTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp b/clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
index 0a5cf62e5ea2332..ff3618e999f004a 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