@@ -128,33 +128,6 @@ TEST_F(CachedConstAccessorsLatticeTest, SameLocBeforeClearOrDiffAfterClear) {
128
128
RecordStorageLocation Loc (Inputs.SType , RecordStorageLocation::FieldToLoc (),
129
129
{});
130
130
131
- LatticeT Lattice;
132
- auto NopInit = [](StorageLocation &) {};
133
- StorageLocation *Loc1 = Lattice.getOrCreateConstMethodReturnStorageLocation (
134
- Loc, CE, Env, NopInit);
135
- auto NotCalled = [](StorageLocation &) {
136
- ASSERT_TRUE (false ) << " Not reached" ;
137
- };
138
- StorageLocation *Loc2 = Lattice.getOrCreateConstMethodReturnStorageLocation (
139
- Loc, CE, Env, NotCalled);
140
-
141
- EXPECT_EQ (Loc1, Loc2);
142
-
143
- Lattice.clearConstMethodReturnStorageLocations (Loc);
144
- StorageLocation *Loc3 = Lattice.getOrCreateConstMethodReturnStorageLocation (
145
- Loc, CE, Env, NopInit);
146
-
147
- EXPECT_NE (Loc3, Loc1);
148
- EXPECT_NE (Loc3, Loc2);
149
- }
150
-
151
- TEST_F (CachedConstAccessorsLatticeTest,
152
- SameLocBeforeClearOrDiffAfterClearWithCallee) {
153
- CommonTestInputs Inputs;
154
- auto *CE = Inputs.CallRef ;
155
- RecordStorageLocation Loc (Inputs.SType , RecordStorageLocation::FieldToLoc (),
156
- {});
157
-
158
131
LatticeT Lattice;
159
132
auto NopInit = [](StorageLocation &) {};
160
133
const FunctionDecl *Callee = CE->getDirectCallee ();
@@ -204,22 +177,24 @@ TEST_F(CachedConstAccessorsLatticeTest,
204
177
// Accessors that return a record by value are modeled by a record storage
205
178
// location (instead of a Value).
206
179
auto NopInit = [](StorageLocation &) {};
207
- StorageLocation *Loc1 = Lattice.getOrCreateConstMethodReturnStorageLocation (
208
- Loc, CE, Env, NopInit);
180
+ const FunctionDecl *Callee = CE->getDirectCallee ();
181
+ ASSERT_NE (Callee, nullptr );
182
+ StorageLocation &Loc1 = Lattice.getOrCreateConstMethodReturnStorageLocation (
183
+ Loc, Callee, Env, NopInit);
209
184
auto NotCalled = [](StorageLocation &) {
210
185
ASSERT_TRUE (false ) << " Not reached" ;
211
186
};
212
- StorageLocation * Loc2 = Lattice.getOrCreateConstMethodReturnStorageLocation (
213
- Loc, CE , Env, NotCalled);
187
+ StorageLocation & Loc2 = Lattice.getOrCreateConstMethodReturnStorageLocation (
188
+ Loc, Callee , Env, NotCalled);
214
189
215
- EXPECT_EQ (Loc1, Loc2);
190
+ EXPECT_EQ (& Loc1, & Loc2);
216
191
217
192
Lattice.clearConstMethodReturnStorageLocations (Loc);
218
- StorageLocation * Loc3 = Lattice.getOrCreateConstMethodReturnStorageLocation (
219
- Loc, CE , Env, NopInit);
193
+ StorageLocation & Loc3 = Lattice.getOrCreateConstMethodReturnStorageLocation (
194
+ Loc, Callee , Env, NopInit);
220
195
221
- EXPECT_NE (Loc3, Loc1);
222
- EXPECT_NE (Loc3, Loc1);
196
+ EXPECT_NE (& Loc3, & Loc1);
197
+ EXPECT_NE (& Loc3, & Loc1);
223
198
}
224
199
225
200
TEST_F (CachedConstAccessorsLatticeTest, ClearDifferentLocs) {
@@ -232,18 +207,20 @@ TEST_F(CachedConstAccessorsLatticeTest, ClearDifferentLocs) {
232
207
233
208
LatticeT Lattice;
234
209
auto NopInit = [](StorageLocation &) {};
235
- StorageLocation *RetLoc1 =
236
- Lattice.getOrCreateConstMethodReturnStorageLocation (LocS1, CE, Env,
210
+ const FunctionDecl *Callee = CE->getDirectCallee ();
211
+ ASSERT_NE (Callee, nullptr );
212
+ StorageLocation &RetLoc1 =
213
+ Lattice.getOrCreateConstMethodReturnStorageLocation (LocS1, Callee, Env,
237
214
NopInit);
238
215
Lattice.clearConstMethodReturnStorageLocations (LocS2);
239
216
auto NotCalled = [](StorageLocation &) {
240
217
ASSERT_TRUE (false ) << " Not reached" ;
241
218
};
242
- StorageLocation * RetLoc2 =
243
- Lattice.getOrCreateConstMethodReturnStorageLocation (LocS1, CE , Env,
219
+ StorageLocation & RetLoc2 =
220
+ Lattice.getOrCreateConstMethodReturnStorageLocation (LocS1, Callee , Env,
244
221
NotCalled);
245
222
246
- EXPECT_EQ (RetLoc1, RetLoc2);
223
+ EXPECT_EQ (& RetLoc1, & RetLoc2);
247
224
}
248
225
249
226
TEST_F (CachedConstAccessorsLatticeTest, DifferentValsFromDifferentLocs) {
0 commit comments