This revision was automatically updated to reflect the committed changes. Closed by commit rL351743: [clang] add tests to ExprMutAnalyzer that reproduced a crash in ASTMatchers (authored by JonasToth, committed by ). Herald added a subscriber: llvm-commits.
Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56917/new/ https://reviews.llvm.org/D56917 Files: cfe/trunk/unittests/Analysis/ExprMutationAnalyzerTest.cpp Index: cfe/trunk/unittests/Analysis/ExprMutationAnalyzerTest.cpp =================================================================== --- cfe/trunk/unittests/Analysis/ExprMutationAnalyzerTest.cpp +++ cfe/trunk/unittests/Analysis/ExprMutationAnalyzerTest.cpp @@ -1108,4 +1108,23 @@ EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x->mf()")); } +TEST(ExprMutationAnalyzerTest, ReproduceFailureMinimal) { + const std::string Reproducer = + "namespace std {" + "template <class T> T forward(T & A) { return static_cast<T&&>(A); }" + "template <class T> struct __bind {" + " T f;" + " template <class V> __bind(T v, V &&) : f(forward(v)) {}" + "};" + "}" + "void f() {" + " int x = 42;" + " auto Lambda = [] {};" + " std::__bind<decltype(Lambda)>(Lambda, x);" + "}"; + auto AST11 = buildASTFromCodeWithArgs(Reproducer, {"-std=c++11"}); + auto Results11 = + match(withEnclosingCompound(declRefTo("x")), AST11->getASTContext()); + EXPECT_FALSE(isMutated(Results11, AST11.get())); +} } // namespace clang
Index: cfe/trunk/unittests/Analysis/ExprMutationAnalyzerTest.cpp =================================================================== --- cfe/trunk/unittests/Analysis/ExprMutationAnalyzerTest.cpp +++ cfe/trunk/unittests/Analysis/ExprMutationAnalyzerTest.cpp @@ -1108,4 +1108,23 @@ EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x->mf()")); } +TEST(ExprMutationAnalyzerTest, ReproduceFailureMinimal) { + const std::string Reproducer = + "namespace std {" + "template <class T> T forward(T & A) { return static_cast<T&&>(A); }" + "template <class T> struct __bind {" + " T f;" + " template <class V> __bind(T v, V &&) : f(forward(v)) {}" + "};" + "}" + "void f() {" + " int x = 42;" + " auto Lambda = [] {};" + " std::__bind<decltype(Lambda)>(Lambda, x);" + "}"; + auto AST11 = buildASTFromCodeWithArgs(Reproducer, {"-std=c++11"}); + auto Results11 = + match(withEnclosingCompound(declRefTo("x")), AST11->getASTContext()); + EXPECT_FALSE(isMutated(Results11, AST11.get())); +} } // namespace clang
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits