diff options
| author | Tom Roeder <tmroeder@google.com> | 2019-02-25 23:24:58 +0000 |
|---|---|---|
| committer | Tom Roeder <tmroeder@google.com> | 2019-02-25 23:24:58 +0000 |
| commit | 9a72870122394dbdfde5b93555e4409f81a4024e (patch) | |
| tree | 7c4c8d9e9ddc17fee7b632191552c70ee7e1efa6 /clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp | |
| parent | 17aec7bd369be14626102a59dff9d88380fd367a (diff) | |
| download | bcm5719-llvm-9a72870122394dbdfde5b93555e4409f81a4024e.tar.gz bcm5719-llvm-9a72870122394dbdfde5b93555e4409f81a4024e.zip | |
[ASTImporter] Add support for importing ChooseExpr AST nodes.
Summary:
This allows ASTs to be merged when they contain ChooseExpr (the GNU
__builtin_choose_expr construction). This is needed, for example, for
cross-CTU analysis of C code that makes use of __builtin_choose_expr.
The node is already supported in the AST, but it didn't have a matcher
in ASTMatchers. So, this change adds the matcher and adds support to
ASTImporter.
Reviewers: shafik, a_sidorin, martong, aaron.ballman
Subscribers: aaron.ballman, rnkovacs, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58292
llvm-svn: 354832
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp')
| -rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp index fd5b112fae9..3f9981cd6db 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp @@ -754,6 +754,11 @@ TEST(Matcher, NullPtrLiteral) { EXPECT_TRUE(matches("int* i = nullptr;", cxxNullPtrLiteralExpr())); } +TEST(Matcher, ChooseExpr) { + EXPECT_TRUE(matchesC("void f() { (void)__builtin_choose_expr(1, 2, 3); }", + chooseExpr())); +} + TEST(Matcher, GNUNullExpr) { EXPECT_TRUE(matches("int* i = __null;", gnuNullExpr())); } |

