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
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
differenceses in template expansion between versions of clang on different
in the behavior of -fms-compatibility between Linux and MSVC buildsOSes. InThe version of clang built with MSVC and running on Windows never
MSVC builds, -fms-compatibility delays template evaluation for the C++expands the template in the C++ test in ImportExpr.ImportChooseExpr in
test case in clang/unittests/AST/ASTImporter.cpp, and that causes thebut the version on Linux does for
matcher to fail to match chooseExpr()the empty arguments and -fms-compatibility.
The only difference between this patch and r354839 is that the unit testSo, 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
now checks for "-fms-compatibility" and treats it likeASTImporterOptionSpecificTestBase.ImportChooseExpr, which does work on
"-fdelayed-template-parsing": it doesn't try to match chooseExpr()Windows.