]> granicus.if.org Git - clang/commit
[ASTImporter] Add support for importing ChooseExpr AST nodes.
authorTom Roeder <tmroeder@google.com>
Tue, 26 Feb 2019 19:26:41 +0000 (19:26 +0000)
committerTom Roeder <tmroeder@google.com>
Tue, 26 Feb 2019 19:26:41 +0000 (19:26 +0000)
commit5e83a6e0f1daa755caa50c86d410d82c395beb6e
tree82cc1dd42bd86af1cccbae61d7d4cdfbd7a2fee3
parent1245e82a91861a23e67c2ffd18cd3a5bcb69aa63
[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.

This was originally reviewed and approved in
https://reviews.llvm.org/D58292 and submitted as r354832. It was
reverted in r354839 due to failures on the Windows CI builds.

This version fixes the test failures on Windows, which were caused by
differences in template expansion between versions of clang on different
OSes. The version of clang built with MSVC and running on Windows never
expands the template in the C++ test in ImportExpr.ImportChooseExpr in
clang/unittests/AST/ASTImporter.cpp, but the version on Linux does for
the empty arguments and -fms-compatibility.

So, this version of the patch drops the C++ test for
__builtin_choose_expr, since that version was written to catch
regressions of the logic for isConditionTrue() in the AST import code
for ChooseExpr, and those regressions are also caught by
ASTImporterOptionSpecificTestBase.ImportChooseExpr, which does work on
Windows.

Reviewers: shafik, a_sidorin, martong, aaron.ballman, rnk, a.sidorin

Subscribers: cfe-commits, jdoerfert, rnkovacs, aaron.ballman

Tags: #clang

Differential Revision: https://reviews.llvm.org/D58663

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354916 91177308-0d34-0410-b5e6-96231b3b80d8
docs/LibASTMatchersReference.html
include/clang/ASTMatchers/ASTMatchers.h
lib/AST/ASTImporter.cpp
lib/ASTMatchers/ASTMatchersInternal.cpp
lib/ASTMatchers/Dynamic/Registry.cpp
test/ASTMerge/choose-expr/Inputs/choose.c [new file with mode: 0644]
test/ASTMerge/choose-expr/test.c [new file with mode: 0644]
unittests/AST/ASTImporterTest.cpp
unittests/ASTMatchers/ASTMatchersNodeTest.cpp