summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorTom Roeder <tmroeder@google.com>2019-02-25 23:24:58 +0000
committerTom Roeder <tmroeder@google.com>2019-02-25 23:24:58 +0000
commit9a72870122394dbdfde5b93555e4409f81a4024e (patch)
tree7c4c8d9e9ddc17fee7b632191552c70ee7e1efa6 /clang/test
parent17aec7bd369be14626102a59dff9d88380fd367a (diff)
downloadbcm5719-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/test')
-rw-r--r--clang/test/ASTMerge/choose-expr/Inputs/choose.c2
-rw-r--r--clang/test/ASTMerge/choose-expr/test.c4
2 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/ASTMerge/choose-expr/Inputs/choose.c b/clang/test/ASTMerge/choose-expr/Inputs/choose.c
new file mode 100644
index 00000000000..0b413a65544
--- /dev/null
+++ b/clang/test/ASTMerge/choose-expr/Inputs/choose.c
@@ -0,0 +1,2 @@
+_Static_assert(__builtin_choose_expr(1, 1, 0), "Incorrect semantics of __builtin_choose_expr");
+_Static_assert(__builtin_choose_expr(0, 0, 1), "Incorrect semantics of __builtin_choose_expr");
diff --git a/clang/test/ASTMerge/choose-expr/test.c b/clang/test/ASTMerge/choose-expr/test.c
new file mode 100644
index 00000000000..0f95cd59681
--- /dev/null
+++ b/clang/test/ASTMerge/choose-expr/test.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -std=c11 -emit-pch -o %t.ast %S/Inputs/choose.c
+// RUN: %clang_cc1 -std=c11 -ast-merge %t.ast -fsyntax-only -verify %s
+// expected-no-diagnostics
+
OpenPOWER on IntegriCloud