[PATCH] D58663: [ASTImporter] Add support for importing ChooseExpr AST nodes.

Tom Roeder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 25 21:18:16 PST 2019


tmroeder created this revision.
tmroeder added reviewers: shafik, a_sidorin, martong, aaron.ballman, rnk.
tmroeder added a project: clang.
Herald added a reviewer: a.sidorin.

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, caused by differences
in the behavior of -fms-compatibility between Linux and MSVC builds. In
MSVC builds, -fms-compatibility delays template evaluation for the C++
test case in clang/unittests/AST/ASTImporter.cpp, and that causes the
matcher to fail to match chooseExpr().

The only difference between this patch and r354839 is that the unit test
now checks for "-fms-compatibility" and treats it like
"-fdelayed-template-parsing": it doesn't try to match chooseExpr().


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D58663

Files:
  clang/docs/LibASTMatchersReference.html
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/lib/AST/ASTImporter.cpp
  clang/lib/ASTMatchers/ASTMatchersInternal.cpp
  clang/lib/ASTMatchers/Dynamic/Registry.cpp
  clang/test/ASTMerge/choose-expr/Inputs/choose.c
  clang/test/ASTMerge/choose-expr/test.c
  clang/unittests/AST/ASTImporterTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58663.188305.patch
Type: text/x-patch
Size: 8549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190226/a8afe42a/attachment.bin>


More information about the cfe-commits mailing list