From 0718def197e34c47a44c48592e9ea7b5d210b239 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Thu, 22 Nov 2018 14:26:33 +0000 Subject: [PATCH] Revert rL347462 "[ASTMatchers] Add hasSideEffect() matcher." Breaks some buildbots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347463 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LibASTMatchersReference.html | 18 ----------------- include/clang/ASTMatchers/ASTMatchers.h | 20 ------------------- lib/ASTMatchers/Dynamic/Registry.cpp | 1 - .../ASTMatchers/ASTMatchersNarrowingTest.cpp | 16 --------------- 4 files changed, 55 deletions(-) diff --git a/docs/LibASTMatchersReference.html b/docs/LibASTMatchersReference.html index ce651c282e..b547f7ece6 100644 --- a/docs/LibASTMatchersReference.html +++ b/docs/LibASTMatchersReference.html @@ -2817,24 +2817,6 @@ enum class Y {}; -Matcher<Expr>hasSideEffects -
Matches expressions with potential side effects other than producing
-a value, such as a calling a function, throwing an exception, or reading a
-volatile variable.
-
-Given
-  void f(int& a, int b, volatile int c) {
-    call();
-    a = 0;
-    a;
-    b;
-    c;
-  }
-expr(hasSideEffects())
-  matches 'call()', 'a = 0', 'c', but not '0', 'a', 'b'.
-
- - Matcher<Expr>isInstantiationDependent
Matches expressions that are instantiation-dependent even if it is
 neither type- nor value-dependent.
diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h
index 73ae8fb244..f42ac5b701 100644
--- a/include/clang/ASTMatchers/ASTMatchers.h
+++ b/include/clang/ASTMatchers/ASTMatchers.h
@@ -4118,26 +4118,6 @@ AST_MATCHER_P(IfStmt, hasConditionVariableStatement,
          InnerMatcher.matches(*DeclarationStatement, Finder, Builder);
 }
 
-/// \brief Matches expressions with potential side effects other than producing
-/// a value, such as a calling a function, throwing an exception, or reading a
-/// volatile variable.
-///
-/// Given
-/// \code
-///   void f(int& a, int b, volatile int c) {
-///     call();
-///     a = 0;
-///     a;
-///     b;
-///     c;
-///   }
-/// \endcode
-/// expr(hasSideEffects())
-///   matches 'call()', 'a = 0', 'c', but not '0', 'a', 'b'.
-AST_MATCHER(Expr, hasSideEffects) {
-  return Node.HasSideEffects(Finder->getASTContext());
-}
-
 /// Matches the index expression of an array subscript expression.
 ///
 /// Given
diff --git a/lib/ASTMatchers/Dynamic/Registry.cpp b/lib/ASTMatchers/Dynamic/Registry.cpp
index fb9e110d30..3ed189a524 100644
--- a/lib/ASTMatchers/Dynamic/Registry.cpp
+++ b/lib/ASTMatchers/Dynamic/Registry.cpp
@@ -294,7 +294,6 @@ RegistryMaps::RegistryMaps() {
   REGISTER_MATCHER(hasReturnValue);
   REGISTER_MATCHER(hasRHS);
   REGISTER_MATCHER(hasSelector);
-  REGISTER_MATCHER(hasSideEffects);
   REGISTER_MATCHER(hasSingleDecl);
   REGISTER_MATCHER(hasSize);
   REGISTER_MATCHER(hasSizeExpr);
diff --git a/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp b/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
index 076d21a1f5..e37bcbeec1 100644
--- a/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ b/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -2259,21 +2259,5 @@ TEST(Matcher, isMain) {
     notMatches("int main2() {}", functionDecl(isMain())));
 }
 
-TEST(Matcher, hasSideEffects) {
-  EXPECT_TRUE(matches("void call();"
-                      "void f() { call(); }",
-                      expr(hasSideEffects())));
-  EXPECT_TRUE(matches("void f(int& a) { a = 0; }", expr(hasSideEffects())));
-  EXPECT_TRUE(
-      matches("void f(volatile int a) { (void)a; }", expr(hasSideEffects())));
-
-  EXPECT_TRUE(notMatches("void call();"
-                         "void f() { }",
-                         expr(hasSideEffects())));
-  EXPECT_TRUE(
-      notMatches("void f(int& a) { (void)a; }", expr(hasSideEffects())));
-  EXPECT_TRUE(notMatches("void f(int a) { (void)a; }", expr(hasSideEffects())));
-}
-
 } // namespace ast_matchers
 } // namespace clang
-- 
2.40.0