aaron.ballman added inline comments.
================ Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:2366 +/// Matches C11 _Generic expression. +extern const internal::VariadicDynCastAllOfMatcher<Stmt, GenericSelectionExpr> + genericSelectionExpr; ---------------- tmroeder wrote: > aaron.ballman wrote: > > Do we have a use case for adding this as an AST matcher? For instance, one > > of the first things I'd want to do with such a matcher is traverse down to > > the association list, but I don't think that's possible currently. Should > > we add all of the AST functionality or just wait until there's a concrete > > use case and add the AST matchers bits at that point? > I mostly did this because that's what I did in the previous case from Feb > 2019: reviews.llvm.org/D58292, for ChooseExpr, and I was cribbing off my old > code. > > However, on further reflection, I remembered that this patch actually removes > a case that was locally defining this matcher already: see the removed lines > in clang/lib/Analysis/ExprMutationAnalyzer.cpp in this patch. So, I think > that is enough of a case for adding this. Okay, fair enough. Thanks! ================ Comment at: clang/test/ASTMerge/generic-selection-expr/Inputs/generic.c:1 +void f() { + int x; ---------------- Should we also have a C++ test for a result-dependent use of _Generic? (We support use of _Generic in C++ as an extension.) ================ Comment at: clang/unittests/AST/StructuralEquivalenceTest.cpp:1601 +TEST_F(StructuralEquivalenceStmtTest, GenericSelectionExprSame) { + auto t = makeWrappedStmts("_Generic(0u, unsigned int: 0, float: 1)", ---------------- Should we add a structural equivalence test for a dependent result type in C++? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D92600/new/ https://reviews.llvm.org/D92600 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits