Adding new AST matcher: gnuNullExpr

It matches GNU __null expression.

llvm-svn: 236731
This commit is contained in:
Szabolcs Sipos 2015-05-07 14:24:22 +00:00
parent 9c95013e8f
commit 1d068bb254
2 changed files with 9 additions and 0 deletions

View File

@ -1441,6 +1441,11 @@ const internal::VariadicDynCastAllOfMatcher<
Stmt,
CXXNullPtrLiteralExpr> nullPtrLiteralExpr;
/// \brief Matches GNU __null expression.
const internal::VariadicDynCastAllOfMatcher<
Stmt,
GNUNullExpr> gnuNullExpr;
/// \brief Matches binary operator expressions.
///
/// Example matches a || b

View File

@ -2144,6 +2144,10 @@ TEST(Matcher, NullPtrLiteral) {
EXPECT_TRUE(matches("int* i = nullptr;", nullPtrLiteralExpr()));
}
TEST(Matcher, GNUNullExpr) {
EXPECT_TRUE(matches("int* i = __null;", gnuNullExpr()));
}
TEST(Matcher, AsmStatement) {
EXPECT_TRUE(matches("void foo() { __asm(\"mov al, 2\"); }", asmStmt()));
}