[ASTImporter] Add support for importing GenericSelectionExpr AST nodes.
authorTom Roeder <tmroeder@google.com>
Wed, 2 Dec 2020 01:23:55 +0000 (17:23 -0800)
committerTom Roeder <tmroeder@google.com>
Wed, 16 Dec 2020 23:39:50 +0000 (15:39 -0800)
commit1844ab770cb9380a1896d83b1863b93766ffdf22
treeb4ad1c3d576fc92f9c52e0385d314194dc61e78e
parentf31e9bcd73eb5f99256a19ae8ed958140ba58a42
[ASTImporter] Add support for importing GenericSelectionExpr AST nodes.

This allows ASTs to be merged when they contain GenericSelectionExpr
nodes (this is _Generic from C11). This is needed, for example, for
CTU analysis of C code that makes use of _Generic, like the Linux
kernel.

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. Additionally, this change adds support for structural
equivalence of _Generic in the AST.

Reviewed By: martong, aaron.ballman

Differential Revision: https://reviews.llvm.org/D92600
14 files changed:
clang/docs/LibASTMatchersReference.html
clang/include/clang/ASTMatchers/ASTMatchers.h
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/ASTStructuralEquivalence.cpp
clang/lib/ASTMatchers/ASTMatchersInternal.cpp
clang/lib/ASTMatchers/Dynamic/Registry.cpp
clang/lib/Analysis/ExprMutationAnalyzer.cpp
clang/test/ASTMerge/generic-selection-expr/Inputs/generic.c [new file with mode: 0644]
clang/test/ASTMerge/generic-selection-expr/Inputs/generic.cpp [new file with mode: 0644]
clang/test/ASTMerge/generic-selection-expr/test.c [new file with mode: 0644]
clang/test/ASTMerge/generic-selection-expr/test.cpp [new file with mode: 0644]
clang/unittests/AST/ASTImporterTest.cpp
clang/unittests/AST/StructuralEquivalenceTest.cpp
clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp