diff options
author | Daniel Jasper <djasper@google.com> | 2012-08-15 18:52:19 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2012-08-15 18:52:19 +0000 |
commit | 8cc7efa2da2c6be43cbd3d09a9ae01353bb921d2 (patch) | |
tree | 36e49154b0ca387487144f5d3177063a73d44494 /unittests/ASTMatchers/ASTMatchersTest.cpp | |
parent | 4cc83c2b0aed5ab06081ea3250426c3a7e58df93 (diff) |
Add ASTMatcher for matching extern "C" function declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161974 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r-- | unittests/ASTMatchers/ASTMatchersTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp index cf37c7d27a..dba9b7d607 100644 --- a/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -1099,6 +1099,12 @@ TEST(Returns, MatchesReturnTypes) { function(returns(hasDeclaration(record(hasName("Y"))))))); } +TEST(IsExternC, MatchesExternCFunctionDeclarations) { + EXPECT_TRUE(matches("extern \"C\" void f() {}", function(isExternC()))); + EXPECT_TRUE(matches("extern \"C\" { void f() {} }", function(isExternC()))); + EXPECT_TRUE(notMatches("void f() {}", function(isExternC()))); +} + TEST(HasAnyParameter, DoesntMatchIfInnerMatcherDoesntMatch) { EXPECT_TRUE(notMatches("class Y {}; class X { void x(int) {} };", method(hasAnyParameter(hasType(record(hasName("X"))))))); |