forked from OSchip/llvm-project
Revert rL347462 "[ASTMatchers] Add hasSideEffect() matcher."
Breaks some buildbots. llvm-svn: 347463
This commit is contained in:
parent
c022c51f89
commit
a6144db15f
|
@ -2817,24 +2817,6 @@ enum class Y {};
|
|||
</pre></td></tr>
|
||||
|
||||
|
||||
<tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>></td><td class="name" onclick="toggle('hasSideEffects0')"><a name="hasSideEffects0Anchor">hasSideEffects</a></td><td></td></tr>
|
||||
<tr><td colspan="4" class="doc" id="hasSideEffects0"><pre>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'.
|
||||
</pre></td></tr>
|
||||
|
||||
|
||||
<tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>></td><td class="name" onclick="toggle('isInstantiationDependent0')"><a name="isInstantiationDependent0Anchor">isInstantiationDependent</a></td><td></td></tr>
|
||||
<tr><td colspan="4" class="doc" id="isInstantiationDependent0"><pre>Matches expressions that are instantiation-dependent even if it is
|
||||
neither type- nor value-dependent.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue