@@ -647,26 +647,26 @@ TEST(TransferTest, SelfReferentialPointerVarDecl) {
647
647
const auto &FooLoc =
648
648
*cast<ScalarStorageLocation>(Env.getStorageLocation (*FooDecl));
649
649
const auto &FooVal = *cast<PointerValue>(Env.getValue (FooLoc));
650
- const auto &FooPointeeVal =
651
- * cast<RecordValue>(Env. getValue ( FooVal.getPointeeLoc () ));
650
+ const auto &FooPointeeLoc =
651
+ cast<RecordStorageLocation>( FooVal.getPointeeLoc ());
652
652
653
653
const auto &BarVal =
654
- *cast<PointerValue>(getFieldValue (&FooPointeeVal , *BarDecl, Env));
655
- const auto &BarPointeeVal =
656
- * cast<RecordValue>(Env. getValue ( BarVal.getPointeeLoc () ));
654
+ *cast<PointerValue>(getFieldValue (&FooPointeeLoc , *BarDecl, Env));
655
+ const auto &BarPointeeLoc =
656
+ cast<RecordStorageLocation>( BarVal.getPointeeLoc ());
657
657
658
- EXPECT_THAT (getFieldValue (&BarPointeeVal , *FooRefDecl, Env), NotNull ());
658
+ EXPECT_THAT (getFieldValue (&BarPointeeLoc , *FooRefDecl, Env), NotNull ());
659
659
660
660
const auto &FooPtrVal = *cast<PointerValue>(
661
- getFieldValue (&BarPointeeVal , *FooPtrDecl, Env));
661
+ getFieldValue (&BarPointeeLoc , *FooPtrDecl, Env));
662
662
const auto &FooPtrPointeeLoc =
663
663
cast<RecordStorageLocation>(FooPtrVal.getPointeeLoc ());
664
664
EXPECT_THAT (Env.getValue (FooPtrPointeeLoc), IsNull ());
665
665
666
- EXPECT_THAT (getFieldValue (&BarPointeeVal , *BazRefDecl, Env), NotNull ());
666
+ EXPECT_THAT (getFieldValue (&BarPointeeLoc , *BazRefDecl, Env), NotNull ());
667
667
668
668
const auto &BazPtrVal = *cast<PointerValue>(
669
- getFieldValue (&BarPointeeVal , *BazPtrDecl, Env));
669
+ getFieldValue (&BarPointeeLoc , *BazPtrDecl, Env));
670
670
const StorageLocation &BazPtrPointeeLoc = BazPtrVal.getPointeeLoc ();
671
671
EXPECT_THAT (Env.getValue (BazPtrPointeeLoc), NotNull ());
672
672
});
@@ -2478,9 +2478,10 @@ TEST(TransferTest, BindTemporary) {
2478
2478
const ValueDecl *BazDecl = findValueDecl (ASTCtx, " Baz" );
2479
2479
ASSERT_THAT (BazDecl, NotNull ());
2480
2480
2481
- const auto &FooVal = *cast<RecordValue>(Env.getValue (*FooDecl));
2481
+ const auto &FooLoc =
2482
+ *cast<RecordStorageLocation>(Env.getStorageLocation (*FooDecl));
2482
2483
const auto *BarVal = cast<IntegerValue>(Env.getValue (*BarDecl));
2483
- EXPECT_EQ (BarVal, getFieldValue (&FooVal , *BazDecl, Env));
2484
+ EXPECT_EQ (BarVal, getFieldValue (&FooLoc , *BazDecl, Env));
2484
2485
});
2485
2486
}
2486
2487
@@ -2970,16 +2971,14 @@ TEST(TransferTest, AggregateInitialization) {
2970
2971
const auto *BarArgVal = cast<IntegerValue>(Env.getValue (*BarArgDecl));
2971
2972
const auto *QuxArgVal = cast<IntegerValue>(Env.getValue (*QuxArgDecl));
2972
2973
2973
- const auto *QuuxVal = cast<RecordValue>(Env.getValue (*QuuxDecl));
2974
- ASSERT_THAT (QuuxVal, NotNull ());
2975
-
2976
- const auto *BazVal =
2977
- cast<RecordValue>(getFieldValue (QuuxVal, *BazDecl, Env));
2978
- ASSERT_THAT (BazVal, NotNull ());
2974
+ const auto &QuuxLoc =
2975
+ *cast<RecordStorageLocation>(Env.getStorageLocation (*QuuxDecl));
2976
+ const auto &BazLoc =
2977
+ *cast<RecordStorageLocation>(QuuxLoc.getChild (*BazDecl));
2979
2978
2980
- EXPECT_EQ (getFieldValue (QuuxVal , *BarDecl, Env), BarArgVal);
2981
- EXPECT_EQ (getFieldValue (BazVal , *FooDecl, Env), FooArgVal);
2982
- EXPECT_EQ (getFieldValue (QuuxVal , *QuxDecl, Env), QuxArgVal);
2979
+ EXPECT_EQ (getFieldValue (&QuuxLoc , *BarDecl, Env), BarArgVal);
2980
+ EXPECT_EQ (getFieldValue (&BazLoc , *FooDecl, Env), FooArgVal);
2981
+ EXPECT_EQ (getFieldValue (&QuuxLoc , *QuxDecl, Env), QuxArgVal);
2983
2982
2984
2983
// Check that fields initialized in an initializer list are always
2985
2984
// modeled in other instances of the same type.
@@ -3653,8 +3652,9 @@ TEST(TransferTest, AssignMemberBeforeCopy) {
3653
3652
3654
3653
const auto *BarVal = cast<IntegerValue>(Env.getValue (*BarDecl));
3655
3654
3656
- const auto *A2Val = cast<RecordValue>(Env.getValue (*A2Decl));
3657
- EXPECT_EQ (getFieldValue (A2Val, *FooDecl, Env), BarVal);
3655
+ const auto &A2Loc =
3656
+ *cast<RecordStorageLocation>(Env.getStorageLocation (*A2Decl));
3657
+ EXPECT_EQ (getFieldValue (&A2Loc, *FooDecl, Env), BarVal);
3658
3658
});
3659
3659
}
3660
3660
0 commit comments