diff options
author | Aleksei Sidorin <a.sidorin@samsung.com> | 2017-11-26 17:04:06 +0000 |
---|---|---|
committer | Aleksei Sidorin <a.sidorin@samsung.com> | 2017-11-26 17:04:06 +0000 |
commit | b05f37afcb9a8d29589c59e9c90dfb516771310d (patch) | |
tree | b3e4ab6d468a7ca628a9622753062024065bde91 /clang/unittests/AST/ASTImporterTest.cpp | |
parent | 7410eead0c4b6c33bc18b0505ad9cbc56edb20ef (diff) | |
download | bcm5719-llvm-b05f37afcb9a8d29589c59e9c90dfb516771310d.tar.gz bcm5719-llvm-b05f37afcb9a8d29589c59e9c90dfb516771310d.zip |
[ASTImporter] Support TypeTraitExpr
Patch by Takafumi Kubota!
Differential Revision: https://reviews.llvm.org/D39722
llvm-svn: 318998
Diffstat (limited to 'clang/unittests/AST/ASTImporterTest.cpp')
-rw-r--r-- | clang/unittests/AST/ASTImporterTest.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp index 7b41c5d5793..2a8f70c2143 100644 --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/unittests/AST/ASTImporterTest.cpp @@ -525,6 +525,47 @@ TEST(ImportType, ImportPackExpansion) { declRefExpr())))))))))); } +/// \brief Matches __builtin_types_compatible_p: +/// GNU extension to check equivalent types +/// Given +/// \code +/// __builtin_types_compatible_p(int, int) +/// \endcode +// will generate TypeTraitExpr <...> 'int' +const internal::VariadicDynCastAllOfMatcher<Stmt, TypeTraitExpr> typeTraitExpr; + +TEST(ImportExpr, ImportTypeTraitExpr) { + MatchVerifier<Decl> Verifier; + EXPECT_TRUE(testImport("void declToImport() { " + " __builtin_types_compatible_p(int, int);" + "}", + Lang_C, "", Lang_C, Verifier, + functionDecl( + hasBody( + compoundStmt( + has( + typeTraitExpr(hasType(asString("int"))))))))); +} + +TEST(ImportExpr, ImportTypeTraitExprValDep) { + MatchVerifier<Decl> Verifier; + EXPECT_TRUE(testImport("template<typename T> struct declToImport {" + " void m() { __is_pod(T); }" + "};" + "void f() { declToImport<int>().m(); }", + Lang_CXX11, "", Lang_CXX11, Verifier, + classTemplateDecl( + has( + cxxRecordDecl( + has( + functionDecl( + hasBody( + compoundStmt( + has( + typeTraitExpr( + hasType(booleanType()) + ))))))))))); +} } // end namespace ast_matchers } // end namespace clang |