Lines Matching defs:AST

10 #include "clang/AST/TypeLoc.h"
36 auto AST =
38 EXPECT_FALSE(AST->getDiagnostics().hasErrorOccurred());
39 return AST;
54 bool isMutated(const SmallVectorImpl<BoundNodes> &Results, ASTUnit *AST) {
57 TraversalKindScope RAII(AST->getASTContext(), TK_AsIs);
58 return ExprMutationAnalyzer(*S, AST->getASTContext()).isMutated(E);
61 bool isDeclMutated(const SmallVectorImpl<BoundNodes> &Results, ASTUnit *AST) {
64 TraversalKindScope RAII(AST->getASTContext(), TK_AsIs);
65 return ExprMutationAnalyzer(*S, AST->getASTContext()).isMutated(D);
69 mutatedBy(const SmallVectorImpl<BoundNodes> &Results, ASTUnit *AST) {
72 ExprMutationAnalyzer Analyzer(*S, AST->getASTContext());
81 By->printPretty(Stream, nullptr, AST->getASTContext().getPrintingPolicy());
117 const auto AST = buildASTFromCode("void f() { int x; x; }");
119 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
120 EXPECT_FALSE(isMutated(Results, AST.get()));
134 const auto AST = buildASTFromCode("void f() { int x; " + ModExpr + "; }");
136 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
137 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre(ModExpr));
143 const auto AST = buildASTFromCode("void f() { int x; " + ModExpr + "; }");
145 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
146 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre(ModExpr));
152 const auto AST = buildASTFromCodeWithArgs(
155 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
156 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre(ModExpr));
163 const auto AST = buildASTFromCodeWithArgs(
166 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
167 EXPECT_FALSE(isMutated(Results, AST.get()));
173 const auto AST =
176 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
177 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre(ModExpr));
185 const auto AST =
188 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
189 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre(ModExpr));
196 const auto AST =
199 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
200 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre(ModExpr));
206 const auto AST =
209 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
210 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre(ModExpr));
219 const auto AST = buildASTFromCode("struct Base {void nonconst(); };"
227 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
228 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("b", "b.nonconst()"));
235 const auto AST = buildASTFromCode("void f() { int x; " + ModExpr + "; }");
237 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
238 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre(ModExpr));
248 const auto AST = buildASTFromCode(
251 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
252 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.mf()"));
256 auto AST = buildASTFromCodeWithArgs(
261 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
262 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.mf<T>()"));
264 AST = buildASTFromCodeWithArgs("template <class T> void f() { T x; x.mf(); }",
266 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
267 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.mf()"));
269 AST = buildASTFromCodeWithArgs(
273 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
274 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.mf()"));
278 const auto AST = buildASTFromCode(
281 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
282 EXPECT_FALSE(isMutated(Results, AST.get()));
286 const auto AST = buildASTFromCodeWithArgs(
291 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
292 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.push_back(T())"));
297 const auto AST =
302 match(withEnclosingCompound(declRefTo("ref")), AST->getASTContext());
303 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("(ref .* m)()"));
306 const auto AST =
311 match(withEnclosingCompound(declRefTo("ref")), AST->getASTContext());
312 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("(ref .* m)()"));
315 const auto AST =
320 match(withEnclosingCompound(declRefTo("ref")), AST->getASTContext());
321 EXPECT_FALSE(isMutated(Results, AST.get()));
328 const auto AST = buildASTFromCode(
331 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
332 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x = 10"));
336 const auto AST = buildASTFromCode(
339 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
340 EXPECT_FALSE(isMutated(Results, AST.get()));
344 const auto AST = buildASTFromCodeWithArgs(
350 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
351 EXPECT_TRUE(isMutated(Results, AST.get()));
361 const auto AST = buildASTFromCodeWithArgs(
366 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
367 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x << t"));
375 auto AST = buildASTFromCodeWithArgs(
381 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
382 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("(x << ... << args)"));
384 AST = buildASTFromCodeWithArgs(
389 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
390 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("(args << ... << x)"));
392 AST = buildASTFromCodeWithArgs(
397 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
398 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x << args"));
404 auto AST = buildASTFromCode("void g(int); void f() { int x; g(x); }");
406 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
407 EXPECT_FALSE(isMutated(Results, AST.get()));
409 AST = buildASTFromCode("void g(int*); void f() { int* x; g(x); }");
410 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
411 EXPECT_FALSE(isMutated(Results, AST.get()));
413 AST = buildASTFromCode("typedef int* IntPtr;"
415 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
416 EXPECT_FALSE(isMutated(Results, AST.get()));
418 AST = buildASTFromCode(
420 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
421 EXPECT_FALSE(isMutated(Results, AST.get()));
423 AST = buildASTFromCode("void f() { struct A { A(int); }; int x; A y(x); }");
424 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
425 EXPECT_FALSE(isMutated(Results, AST.get()));
427 AST = buildASTFromCode("struct A { A(); A& operator=(A); };"
429 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
430 EXPECT_FALSE(isMutated(Results, AST.get()));
432 AST = buildASTFromCode(
435 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
436 EXPECT_FALSE(isMutated(Results, AST.get()));
440 auto AST = buildASTFromCode("void g(const int); void f() { int x; g(x); }");
442 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
443 EXPECT_FALSE(isMutated(Results, AST.get()));
445 AST = buildASTFromCode("void g(int* const); void f() { int* x; g(x); }");
446 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
447 EXPECT_FALSE(isMutated(Results, AST.get()));
449 AST = buildASTFromCode("typedef int* const CIntPtr;"
451 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
452 EXPECT_FALSE(isMutated(Results, AST.get()));
454 AST = buildASTFromCode(
456 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
457 EXPECT_FALSE(isMutated(Results, AST.get()));
459 AST = buildASTFromCode(
461 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
462 EXPECT_FALSE(isMutated(Results, AST.get()));
464 AST = buildASTFromCode("template <int> struct A { A(); A(const A&);"
467 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
468 EXPECT_FALSE(isMutated(Results, AST.get()));
472 auto AST = buildASTFromCode("void g(int&); void f() { int x; g(x); }");
474 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
475 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)"));
477 AST = buildASTFromCode("typedef int& IntRef;"
479 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
480 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)"));
482 AST = buildASTFromCode("template <class T> using TRef = T&;"
484 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
485 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)"));
487 AST = buildASTFromCode(
491 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
492 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g<int>(x)"));
494 AST = buildASTFromCode("typedef int* IntPtr;"
496 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
497 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)"));
499 AST = buildASTFromCode("typedef int* IntPtr; typedef IntPtr& IntPtrRef;"
501 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
502 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)"));
504 AST = buildASTFromCode(
506 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
507 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x + 1"));
509 AST = buildASTFromCode("void f() { struct A { A(int&); }; int x; A y(x); }");
510 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
511 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x"));
513 AST = buildASTFromCode("void f() { struct A { A(); A(A&); }; A x; A y(x); }");
514 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
515 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x"));
517 AST = buildASTFromCode(
520 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
521 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("A<0>::mf(x)"));
525 auto AST = buildASTFromCodeWithArgs(
536 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
537 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("parser(x)"));
541 auto AST = buildASTFromCode("void g(const int&); void f() { int x; g(x); }");
543 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
544 EXPECT_FALSE(isMutated(Results, AST.get()));
546 AST = buildASTFromCode("typedef const int& CIntRef;"
548 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
549 EXPECT_FALSE(isMutated(Results, AST.get()));
551 AST = buildASTFromCode("template <class T> using CTRef = const T&;"
553 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
554 EXPECT_FALSE(isMutated(Results, AST.get()));
556 AST =
561 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
562 EXPECT_FALSE(isMutated(Results, AST.get()));
564 AST = buildASTFromCode(
566 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
567 EXPECT_FALSE(isMutated(Results, AST.get()));
569 AST = buildASTFromCode(
571 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
572 EXPECT_FALSE(isMutated(Results, AST.get()));
574 AST = buildASTFromCode(
576 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
577 EXPECT_FALSE(isMutated(Results, AST.get()));
581 auto AST = buildASTFromCode(
584 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
585 EXPECT_THAT(mutatedBy(Results, AST.get()),
588 AST = buildASTFromCode("struct A {}; A operator+(A&&, int);"
590 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
591 EXPECT_THAT(mutatedBy(Results, AST.get()),
594 AST = buildASTFromCode("void f() { struct A { A(int&&); }; "
596 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
597 EXPECT_THAT(mutatedBy(Results, AST.get()),
600 AST = buildASTFromCode("void f() { struct A { A(); A(A&&); }; "
602 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
603 EXPECT_THAT(mutatedBy(Results, AST.get()),
608 auto AST = buildASTFromCode(
611 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
612 EXPECT_THAT(mutatedBy(Results, AST.get()),
615 AST = buildASTFromCode("struct A {}; A operator+(const A&&, int);"
617 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
618 EXPECT_THAT(mutatedBy(Results, AST.get()),
621 AST = buildASTFromCode("void f() { struct A { A(const int&&); }; "
623 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
624 EXPECT_THAT(mutatedBy(Results, AST.get()),
627 AST = buildASTFromCode("void f() { struct A { A(); A(const A&&); }; "
629 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
630 EXPECT_THAT(mutatedBy(Results, AST.get()),
637 const auto AST =
642 match(withEnclosingCompound(declRefTo("p")), AST->getASTContext());
643 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x", "mod(x)"));
647 const auto AST = buildASTFromCode("struct Point { int x; int y; };"
650 match(withEnclosingCompound(declRefTo("p")), AST->getASTContext());
651 EXPECT_FALSE(isMutated(Results, AST.get()));
657 auto AST = buildASTFromCode(StdRemoveReference + StdMove +
660 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
661 EXPECT_FALSE(isMutated(Results, AST.get()));
663 AST = buildASTFromCode(StdRemoveReference + StdMove +
665 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
666 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("std::move(x) = y"));
668 AST = buildASTFromCode(StdRemoveReference + StdMove +
670 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
671 EXPECT_FALSE(isMutated(Results, AST.get()));
673 AST =
677 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
678 EXPECT_FALSE(isMutated(Results, AST.get()));
680 AST = buildASTFromCode(StdRemoveReference + StdMove +
683 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
684 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("y = std::move(x)"));
686 AST = buildASTFromCode(StdRemoveReference + StdMove +
690 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
691 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("y = std::move(x)"));
693 AST = buildASTFromCode(StdRemoveReference + StdMove +
697 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
698 EXPECT_FALSE(isMutated(Results, AST.get()));
700 AST = buildASTFromCode(StdRemoveReference + StdMove +
703 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
704 EXPECT_FALSE(isMutated(Results, AST.get()));
706 AST = buildASTFromCode(StdRemoveReference + StdMove +
708 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
709 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("y = std::move(x)"));
711 AST = buildASTFromCode(
714 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
715 EXPECT_FALSE(isMutated(Results, AST.get()));
719 auto AST =
723 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
724 EXPECT_FALSE(isMutated(Results, AST.get()));
726 AST = buildASTFromCode(
729 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
730 EXPECT_THAT(mutatedBy(Results, AST.get()),
738 auto AST =
742 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
743 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)"));
745 AST =
748 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
749 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)"));
751 AST = buildASTFromCodeWithArgs(
754 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
755 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(t, x)"));
757 AST = buildASTFromCodeWithArgs(
760 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
761 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("t.mf(x)"));
763 AST = buildASTFromCodeWithArgs(
767 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
768 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("s.mf(x)"));
770 AST = buildASTFromCodeWithArgs(
774 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
775 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("s.mf<T>(x)"));
777 AST = buildASTFromCodeWithArgs("template <class F>"
780 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
781 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("f(x)"));
783 AST = buildASTFromCodeWithArgs(
786 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
787 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("T(x)"));
793 auto AST = buildASTFromCode("int f() { int x; return x; }");
795 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
796 EXPECT_FALSE(isMutated(Results, AST.get()));
798 AST = buildASTFromCode("int* f() { int* x; return x; }");
799 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
800 EXPECT_FALSE(isMutated(Results, AST.get()));
802 AST = buildASTFromCode("typedef int* IntPtr;"
804 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
805 EXPECT_FALSE(isMutated(Results, AST.get()));
809 const auto AST = buildASTFromCode("int& f() { int x; return x; }");
811 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
812 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("return x;"));
816 const auto AST = buildASTFromCode("const int& f() { int x; return x; }");
818 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
819 EXPECT_FALSE(isMutated(Results, AST.get()));
823 const auto AST =
826 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
827 EXPECT_THAT(mutatedBy(Results, AST.get()),
832 const auto AST = buildASTFromCode(
835 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
836 EXPECT_THAT(mutatedBy(Results, AST.get()),
843 const auto AST = buildASTFromCode("void g(int*); void f() { int x; g(&x); }");
845 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
846 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("&x"));
850 const auto AST =
853 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
854 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x"));
858 const auto AST = buildASTFromCodeWithArgs(
866 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
867 EXPECT_THAT(mutatedBy(ResultsX, AST.get()), ElementsAre("g(x)"));
869 match(withEnclosingCompound(declRefTo("y")), AST->getASTContext());
870 EXPECT_THAT(mutatedBy(ResultsY, AST.get()), ElementsAre("y"));
877 auto AST = buildASTFromCode(
881 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
882 EXPECT_THAT(mutatedBy(Results, AST.get()),
885 AST = buildASTFromCode("typedef int& IntRefX;"
889 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
890 EXPECT_THAT(mutatedBy(Results, AST.get()),
895 auto AST = buildASTFromCode(
899 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
900 EXPECT_FALSE(isMutated(Results, AST.get()));
902 AST = buildASTFromCode("void f() { int x; int& r0 = x; const int& r1 = r0;}");
903 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
904 EXPECT_FALSE(isMutated(Results, AST.get()));
906 AST = buildASTFromCode("typedef const int& CIntRefX;"
910 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
911 EXPECT_FALSE(isMutated(Results, AST.get()));
915 const auto AST = buildASTFromCode(
918 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
919 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("r", "r = 10"));
923 const auto AST =
926 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
927 EXPECT_FALSE(isMutated(Results, AST.get()));
931 auto AST = buildASTFromCode("template <class T> void g(T&& t) { t = 10; }"
934 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
935 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)"));
937 AST = buildASTFromCode(
941 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
942 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)"));
944 AST = buildASTFromCode(
948 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
949 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x, y)"));
950 Results = match(withEnclosingCompound(declRefTo("y")), AST->getASTContext());
951 EXPECT_FALSE(isMutated(Results, AST.get()));
953 AST = buildASTFromCode(
957 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
958 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(y, x)"));
959 Results = match(withEnclosingCompound(declRefTo("y")), AST->getASTContext());
960 EXPECT_FALSE(isMutated(Results, AST.get()));
962 AST = buildASTFromCode("struct S { template <class T> S(T&& t) { t = 10; } };"
964 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
965 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x"));
967 AST = buildASTFromCode(
970 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
971 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x"));
973 AST = buildASTFromCode("template <class U> struct S {"
976 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
977 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x"));
979 AST = buildASTFromCode(StdRemoveReference + StdForward +
986 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
987 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("g(x)"));
989 AST = buildASTFromCode(
996 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
997 EXPECT_FALSE(isMutated(Results, AST.get()));
999 AST = buildASTFromCode(
1006 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1007 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("f1(x)"));
1009 AST = buildASTFromCode(
1016 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1017 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("f1(x)"));
1021 auto AST = buildASTFromCode("template <class T> void g(T&&) {}"
1024 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1025 EXPECT_FALSE(isMutated(Results, AST.get()));
1027 AST = buildASTFromCode("template <class T> void g(T&& t) { t; }"
1029 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1030 EXPECT_FALSE(isMutated(Results, AST.get()));
1032 AST = buildASTFromCode("template <class... Args> void g(Args&&...) {}"
1034 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1035 EXPECT_FALSE(isMutated(Results, AST.get()));
1037 AST = buildASTFromCode("template <class... Args> void g(Args&&...) {}"
1039 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1040 EXPECT_FALSE(isMutated(Results, AST.get()));
1042 AST = buildASTFromCode(
1046 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1047 EXPECT_FALSE(isMutated(Results, AST.get()));
1049 AST = buildASTFromCode("struct S { template <class T> S(T&& t) { t; } };"
1051 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1052 EXPECT_FALSE(isMutated(Results, AST.get()));
1054 AST = buildASTFromCode(
1057 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1058 EXPECT_FALSE(isMutated(Results, AST.get()));
1060 AST = buildASTFromCode("template <class U> struct S {"
1063 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1064 EXPECT_FALSE(isMutated(Results, AST.get()));
1066 AST = buildASTFromCode(StdRemoveReference + StdForward +
1073 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1074 EXPECT_FALSE(isMutated(Results, AST.get()));
1080 const auto AST = buildASTFromCode("void f() { int x[2]; x[0] = 10; }");
1082 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1083 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x[0] = 10"));
1087 const auto AST = buildASTFromCode("void f() { int x[2]; x[0]; }");
1089 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1090 EXPECT_FALSE(isMutated(Results, AST.get()));
1096 auto AST =
1100 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1101 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.vb.va.vi = 10"));
1103 AST = buildASTFromCodeWithArgs(
1106 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1107 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.y.z = 10"));
1109 AST = buildASTFromCodeWithArgs(
1113 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1114 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.y.z = 10"));
1118 auto AST =
1122 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1123 EXPECT_FALSE(isMutated(Results, AST.get()));
1125 AST = buildASTFromCodeWithArgs("template <class T> void f() { T x; x.y.z; }",
1127 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1128 EXPECT_FALSE(isMutated(Results, AST.get()));
1130 AST =
1134 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1135 EXPECT_FALSE(isMutated(Results, AST.get()));
1141 const auto AST =
1144 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1145 EXPECT_FALSE(isMutated(Results, AST.get()));
1149 auto AST =
1152 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1153 EXPECT_THAT(mutatedBy(Results, AST.get()),
1156 AST = buildASTFromCode("typedef int& IntRef;"
1158 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1159 EXPECT_THAT(mutatedBy(Results, AST.get()),
1164 const auto AST =
1167 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1168 EXPECT_THAT(mutatedBy(Results, AST.get()),
1173 auto AST =
1176 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1177 EXPECT_FALSE(isMutated(Results, AST.get()));
1179 AST = buildASTFromCode("typedef const int& CIntRef;"
1181 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1182 EXPECT_FALSE(isMutated(Results, AST.get()));
1188 const auto AST = buildASTFromCodeWithArgs(
1191 match(withEnclosingCompound(declRefTo("y")), AST->getASTContext());
1192 EXPECT_TRUE(isMutated(Results, AST.get()));
1196 const auto AST = buildASTFromCodeWithArgs(
1199 match(withEnclosingCompound(declRefTo("y")), AST->getASTContext());
1200 EXPECT_TRUE(isMutated(Results, AST.get()));
1204 const auto AST = buildASTFromCodeWithArgs(
1209 match(withEnclosingCompound(declRefTo("o2")), AST->getASTContext());
1210 EXPECT_TRUE(isMutated(Results, AST.get()));
1214 const auto AST = buildASTFromCodeWithArgs(
1219 match(withEnclosingCompound(declRefTo("o2")), AST->getASTContext());
1220 EXPECT_FALSE(isMutated(Results, AST.get()));
1224 const auto AST =
1229 match(withEnclosingCompound(declRefTo("o1")), AST->getASTContext());
1230 EXPECT_TRUE(isMutated(Results, AST.get()));
1234 auto AST = buildASTFromCodeWithArgs(
1239 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1240 EXPECT_TRUE(isMutated(Results, AST.get()));
1242 AST = buildASTFromCodeWithArgs(
1245 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1246 EXPECT_TRUE(isMutated(Results, AST.get()));
1250 const auto AST =
1256 match(withEnclosingCompound(declRefTo("o1")), AST->getASTContext());
1257 EXPECT_TRUE(isMutated(Results, AST.get()));
1261 const auto AST = buildASTFromCodeWithArgs("class A { public: int mem;};"
1266 match(withEnclosingCompound(declRefTo("o1")), AST->getASTContext());
1267 EXPECT_TRUE(isMutated(Results, AST.get()));
1271 auto AST = buildASTFromCodeWithArgs("int f() { int x, y; return (x, y); }",
1274 match(withEnclosingCompound(declRefTo("y")), AST->getASTContext());
1275 EXPECT_FALSE(isMutated(Results, AST.get()));
1279 const auto AST = buildASTFromCodeWithArgs(
1282 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1283 EXPECT_TRUE(isMutated(Results, AST.get()));
1287 const auto AST =
1292 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1293 EXPECT_TRUE(isMutated(Results, AST.get()));
1303 const auto AST = buildASTFromCodeWithArgs(
1309 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1310 EXPECT_TRUE(isMutated(Results, AST.get()));
1316 const auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-unused-value"});
1318 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1319 EXPECT_THAT(mutatedBy(Results, AST.get()),
1326 const auto AST = buildASTFromCode("void f() { int x; [=]() { x; }; }");
1328 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1329 EXPECT_FALSE(isMutated(Results, AST.get()));
1333 const auto AST = buildASTFromCode("void f() { int x; [x]() { x; }; }");
1335 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1336 EXPECT_FALSE(isMutated(Results, AST.get()));
1340 const auto AST = buildASTFromCode("void f() { int x; [&]() { x = 10; }; }");
1342 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1343 EXPECT_THAT(mutatedBy(Results, AST.get()),
1348 const auto AST = buildASTFromCode("void f() { int x; [&x]() { x = 10; }; }");
1350 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1351 EXPECT_THAT(mutatedBy(Results, AST.get()),
1358 auto AST =
1361 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1362 EXPECT_THAT(mutatedBy(Results, AST.get()),
1365 AST = buildASTFromCode("typedef int& IntRef;"
1367 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1368 EXPECT_THAT(mutatedBy(Results, AST.get()),
1373 const auto AST =
1376 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1377 EXPECT_TRUE(isMutated(Results, AST.get()));
1381 auto AST = buildASTFromCode("void f() { int x[2]; for (int e : x) e = 10; }");
1383 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1384 EXPECT_FALSE(isMutated(Results, AST.get()));
1386 AST =
1388 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1389 EXPECT_TRUE(isMutated(Results, AST.get()));
1391 AST = buildASTFromCode(
1394 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1395 EXPECT_TRUE(isMutated(Results, AST.get()));
1399 auto AST =
1402 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1403 EXPECT_FALSE(isMutated(Results, AST.get()));
1405 AST = buildASTFromCode("typedef const int& CIntRef;"
1407 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1408 EXPECT_FALSE(isMutated(Results, AST.get()));
1412 const auto AST =
1416 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1417 EXPECT_THAT(mutatedBy(Results, AST.get()),
1422 const auto AST = buildASTFromCode("struct V { int* begin(); int* end(); };"
1425 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1426 EXPECT_TRUE(isMutated(Results, AST.get()));
1430 const auto AST = buildASTFromCode(
1434 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1435 EXPECT_FALSE(isMutated(Results, AST.get()));
1439 const auto AST = buildASTFromCode(
1443 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1444 EXPECT_FALSE(isMutated(Results, AST.get()));
1450 auto AST = buildASTFromCode("void f() { int x, y; decltype(x = 10) z = y; }");
1452 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1453 EXPECT_FALSE(isMutated(Results, AST.get()));
1455 AST = buildASTFromCode("void f() { int x, y; __typeof(x = 10) z = y; }");
1456 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1457 EXPECT_FALSE(isMutated(Results, AST.get()));
1459 AST = buildASTFromCode("void f() { int x, y; __typeof__(x = 10) z = y; }");
1460 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1461 EXPECT_FALSE(isMutated(Results, AST.get()));
1463 AST = buildASTFromCode("void f() { int x; sizeof(x = 10); }");
1464 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1465 EXPECT_FALSE(isMutated(Results, AST.get()));
1467 AST = buildASTFromCode("void f() { int x; alignof(x = 10); }");
1468 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1469 EXPECT_FALSE(isMutated(Results, AST.get()));
1471 AST = buildASTFromCode("void f() { int x; noexcept(x = 10); }");
1472 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1473 EXPECT_FALSE(isMutated(Results, AST.get()));
1475 AST = buildASTFromCodeWithArgs("namespace std { class type_info; }"
1478 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1479 EXPECT_FALSE(isMutated(Results, AST.get()));
1481 AST = buildASTFromCode(
1483 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1484 EXPECT_FALSE(isMutated(Results, AST.get()));
1488 auto AST = buildASTFromCode("void f() { int x; sizeof(int[x++]); }");
1490 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1491 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x++"));
1493 AST = buildASTFromCodeWithArgs(
1498 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1499 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.f()"));
1516 auto AST = buildASTFromCode(UniquePtrDef +
1519 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1520 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("* x = 10"));
1522 AST = buildASTFromCode(UniquePtrDef + "void f() { UniquePtr<int> x; *x; }");
1523 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1524 EXPECT_FALSE(isMutated(Results, AST.get()));
1526 AST = buildASTFromCode(UniquePtrDef +
1528 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1529 EXPECT_FALSE(isMutated(Results, AST.get()));
1531 AST = buildASTFromCode(UniquePtrDef + "struct S { int v; };"
1533 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1534 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x"));
1536 AST = buildASTFromCode(UniquePtrDef +
1539 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1540 EXPECT_FALSE(isMutated(Results, AST.get()));
1542 AST =
1545 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1546 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x"));
1548 AST = buildASTFromCode(UniquePtrDef +
1551 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1552 EXPECT_FALSE(isMutated(Results, AST.get()));
1554 AST = buildASTFromCodeWithArgs(
1557 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1558 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x->mf()"));
1564 std::unique_ptr<ASTUnit> AST{};
1567 AST = buildASTFromCodeWithArgs("void f() { int &x = x; }",
1569 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1570 EXPECT_FALSE(isDeclMutated(Results, AST.get()));
1572 AST = buildASTFromCodeWithArgs("void f() { int &x = x; x = 1; }",
1574 Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1575 EXPECT_TRUE(isDeclMutated(Results, AST.get()));
1586 auto AST =
1589 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1590 EXPECT_TRUE(isMutated(Results, AST.get()));
1591 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("(x)"));
1615 ASTUnit *AST) {
1619 TraversalKindScope RAII(AST->getASTContext(), TK_AsIs);
1620 return ExprMutationAnalyzer(*S, AST->getASTContext()).isPointeeMutated(E);
1624 ASTUnit *AST) {
1628 TraversalKindScope RAII(AST->getASTContext(), TK_AsIs);
1629 return ExprMutationAnalyzer(*S, AST->getASTContext()).isPointeeMutated(D);
1635 auto AST = buildASTFromCodeWithArgs(Code, {});
1637 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1638 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1642 auto AST = buildASTFromCodeWithArgs(Code, {});
1644 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1645 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1649 auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-unused-value"});
1651 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1652 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1660 auto AST = buildASTFromCodeWithArgs(Code, {});
1662 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1663 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1668 auto AST = buildASTFromCodeWithArgs(Code, {});
1670 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1671 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1676 auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-unused-value"});
1678 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1679 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1686 auto AST = buildASTFromCodeWithArgs(Code, {});
1688 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1689 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1694 auto AST = buildASTFromCodeWithArgs(Code, {});
1696 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1697 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1704 auto AST = buildASTFromCodeWithArgs(Code, {});
1706 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1707 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1712 auto AST = buildASTFromCodeWithArgs(Code, {});
1714 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1715 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1722 auto AST = buildASTFromCodeWithArgs(Code, {});
1724 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1725 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1729 auto AST = buildASTFromCodeWithArgs(Code, {});
1731 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1732 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1736 auto AST = buildASTFromCodeWithArgs(Code, {});
1738 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1739 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1747 auto AST = buildASTFromCodeWithArgs(Code, {});
1749 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1750 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1754 auto AST = buildASTFromCodeWithArgs(Code, {});
1756 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1757 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1765 auto AST = buildASTFromCodeWithArgs(Code, {});
1767 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1768 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1773 auto AST = buildASTFromCodeWithArgs(Code, {});
1775 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1776 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1784 auto AST = buildASTFromCodeWithArgs(Code, {});
1786 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1787 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1792 auto AST = buildASTFromCodeWithArgs(Code, {});
1794 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1795 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1800 auto AST = buildASTFromCodeWithArgs(Code, {});
1802 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1803 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1808 auto AST = buildASTFromCodeWithArgs(Code, {});
1810 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1811 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1818 auto AST = buildASTFromCodeWithArgs(Code, {"-fno-delayed-template-parsing"});
1820 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1821 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1832 auto AST =
1835 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1836 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1844 auto AST = buildASTFromCodeWithArgs(Code, {});
1846 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1847 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1852 auto AST = buildASTFromCodeWithArgs(Code, {});
1854 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1855 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1863 auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-everything"});
1865 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1866 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1871 auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-everything"});
1873 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1874 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1883 auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-everything"});
1885 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1886 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1891 auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-everything"});
1893 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1894 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1902 auto AST = buildASTFromCodeWithArgs(
1905 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1906 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1915 auto AST = buildASTFromCodeWithArgs(
1918 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1919 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1926 auto AST = buildASTFromCodeWithArgs(
1929 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1930 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1940 auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-everything"});
1942 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1943 EXPECT_TRUE(isDeclPointeeMutated(Results, AST.get()));
1952 auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-everything"});
1954 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1955 EXPECT_TRUE(isDeclPointeeMutated(Results, AST.get()));
1965 auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-everything"});
1967 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1968 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
1976 auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-everything"});
1978 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1979 EXPECT_FALSE(isPointeeMutated(Results, AST.get()));
1989 auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-everything"});
1991 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
1992 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));
2001 auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-everything"});
2003 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
2004 EXPECT_TRUE(isPointeeMutated(Results, AST.get()));