[PATCH] D56917: [clang] add tests to ExprMutAnalyzer that reproduced a crash in ASTMatchers

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 21 05:27:11 PST 2019


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56917.182781.patch
Type: text/x-patch
Size: 1085 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190121/e0473f77/attachment.bin>


More information about the cfe-commits mailing list