@@ -25,7 +25,6 @@ namespace {
25
25
using namespace clang ;
26
26
using namespace dataflow ;
27
27
using ::clang::dataflow::test::getFieldValue;
28
- using ::testing::Contains;
29
28
using ::testing::IsNull;
30
29
using ::testing::NotNull;
31
30
@@ -312,56 +311,6 @@ TEST_F(EnvironmentTest, InitGlobalVarsConstructor) {
312
311
EXPECT_THAT (Env.getValue (*Var), NotNull ());
313
312
}
314
313
315
- // Pointers to Members are a tricky case of accessor calls, complicated further
316
- // when using templates where the pointer to the member is a template argument.
317
- // This is a repro of a failure case seen in the wild.
318
- TEST_F (EnvironmentTest,
319
- ModelMemberForAccessorUsingMethodPointerThroughTemplate) {
320
- using namespace ast_matchers ;
321
-
322
- std::string Code = R"cc(
323
- struct S {
324
- int accessor() {return member;}
325
-
326
- int member = 0;
327
- };
328
-
329
- template <auto method>
330
- int Target(S* S) {
331
- return (S->*method)();
332
- }
333
-
334
- // We want to analyze the instantiation of Target for the accessor.
335
- int Instantiator () {S S; return Target<&S::accessor>(&S); }
336
- )cc" ;
337
-
338
- auto Unit =
339
- // C++17 for the simplifying use of auto in the template declaration.
340
- tooling::buildASTFromCodeWithArgs (Code, {" -fsyntax-only" , " -std=c++17" });
341
- auto &Context = Unit->getASTContext ();
342
-
343
- ASSERT_EQ (Context.getDiagnostics ().getClient ()->getNumErrors (), 0U );
344
-
345
- auto Results = match (
346
- decl (anyOf (functionDecl (hasName (" Target" ), isTemplateInstantiation ())
347
- .bind (" target" ),
348
- fieldDecl (hasName (" member" )).bind (" member" ),
349
- recordDecl (hasName (" S" )).bind (" struct" ))),
350
- Context);
351
- const auto *Fun = selectFirst<FunctionDecl>(" target" , Results);
352
- const auto *Struct = selectFirst<RecordDecl>(" struct" , Results);
353
- const auto *Member = selectFirst<FieldDecl>(" member" , Results);
354
- ASSERT_THAT (Fun, NotNull ());
355
- ASSERT_THAT (Struct, NotNull ());
356
- ASSERT_THAT (Member, NotNull ());
357
-
358
- // Verify that `member` is modeled for `S` when we analyze
359
- // `Target<&S::accessor>`.
360
- Environment Env (DAContext, *Fun);
361
- EXPECT_THAT (DAContext.getModeledFields (QualType (Struct->getTypeForDecl (), 0 )),
362
- Contains (Member));
363
- }
364
-
365
314
TEST_F (EnvironmentTest, RefreshRecordValue) {
366
315
using namespace ast_matchers ;
367
316
0 commit comments