[PATCH] D92600: [ASTImporter] Add support for importing GenericSelectionExpr AST nodes.

Raphael Isemann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 01:17:46 PST 2020


teemperor added a comment.

Having the comparison code would be nice. The custom types in the associated types aren't compared by the generic code, so an overload like this in the `StmtComparer` class should be enough:

  bool IsStmtEquivalent(const GenericSelectionExpr *E1, const GenericSelectionExpr *E2) {
    for (auto Pair : zip_longest(E1->getAssocTypeSourceInfos(),
                                 E2->getAssocTypeSourceInfos())) {
      Optional<TypeSourceInfo *> Child1 = std::get<0>(Pair);
      Optional<TypeSourceInfo *> Child2 = std::get<1>(Pair);
      // Different number of associated types.
      if (!Child1 || !Child2)
        return false;
  
      if (!IsStructurallyEquivalent(Context, (*Child1)->getType(),
                                    (*Child2)->getType()))
        return false;
    }
    return true;
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92600/new/

https://reviews.llvm.org/D92600



More information about the cfe-commits mailing list