EXPECT_FALSE(isMutated(Results, AST.get()));
AST = buildASTFromCode(
- "struct A {}; A operator+(A, int) {} void f() { A x; x + 1; }");
+ "struct A {}; A operator+(A, int); void f() { A x; x + 1; }");
Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
EXPECT_FALSE(isMutated(Results, AST.get()));
EXPECT_FALSE(isMutated(Results, AST.get()));
AST = buildASTFromCode(
- "struct A {}; A operator+(const A, int) {} void f() { A x; x + 1; }");
+ "struct A {}; A operator+(const A, int); void f() { A x; x + 1; }");
Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
EXPECT_FALSE(isMutated(Results, AST.get()));
EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)"));
AST = buildASTFromCode(
- "struct A {}; A operator+(A&, int) {} void f() { A x; x + 1; }");
+ "struct A {}; A operator+(A&, int); void f() { A x; x + 1; }");
Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x + 1"));
EXPECT_FALSE(isMutated(Results, AST.get()));
AST = buildASTFromCode(
- "struct A {}; A operator+(const A&, int) {} void f() { A x; x + 1; }");
+ "struct A {}; A operator+(const A&, int); void f() { A x; x + 1; }");
Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
EXPECT_FALSE(isMutated(Results, AST.get()));
EXPECT_THAT(mutatedBy(Results, AST.get()),
ElementsAre("g(static_cast<int &&>(x))"));
- AST = buildASTFromCode("struct A {}; A operator+(A&&, int) {}"
+ AST = buildASTFromCode("struct A {}; A operator+(A&&, int);"
"void f() { A x; static_cast<A &&>(x) + 1; }");
Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
EXPECT_THAT(mutatedBy(Results, AST.get()),
match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
EXPECT_FALSE(isMutated(Results, AST.get()));
- AST = buildASTFromCode("struct A {}; A operator+(const A&&, int) {}"
+ AST = buildASTFromCode("struct A {}; A operator+(const A&&, int);"
"void f() { A x; static_cast<A&&>(x) + 1; }");
Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
EXPECT_FALSE(isMutated(Results, AST.get()));