Index: clang/lib/AST/ASTImporter.cpp =================================================================== --- clang/lib/AST/ASTImporter.cpp +++ clang/lib/AST/ASTImporter.cpp @@ -601,6 +601,7 @@ ExpectedStmt VisitSourceLocExpr(SourceLocExpr *E); ExpectedStmt VisitVAArgExpr(VAArgExpr *E); ExpectedStmt VisitChooseExpr(ChooseExpr *E); + ExpectedStmt VisitShuffleVectorExpr(ShuffleVectorExpr *E); ExpectedStmt VisitGNUNullExpr(GNUNullExpr *E); ExpectedStmt VisitGenericSelectionExpr(GenericSelectionExpr *E); ExpectedStmt VisitPredefinedExpr(PredefinedExpr *E); @@ -6730,6 +6731,23 @@ ToRParenLoc, CondIsTrue); } +ExpectedStmt ASTNodeImporter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { + Error Err = Error::success(); + auto ToRParenLoc = importChecked(Err, E->getRParenLoc()); + auto ToBeginLoc = importChecked(Err, E->getBeginLoc()); + auto ToType = importChecked(Err, E->getType()); + const unsigned NumSubExprs = E->getNumSubExprs(); + + llvm::SmallVector ToSubExprs; + llvm::ArrayRef FromSubExprs(E->getSubExprs(), NumSubExprs); + ToSubExprs.reserve(NumSubExprs); + if ((Err = ImportContainerChecked(FromSubExprs, ToSubExprs))) + return std::move(Err); + + return new (Importer.getToContext()) ShuffleVectorExpr( + Importer.getToContext(), ToSubExprs, ToType, ToBeginLoc, ToRParenLoc); +} + ExpectedStmt ASTNodeImporter::VisitGNUNullExpr(GNUNullExpr *E) { ExpectedType TypeOrErr = import(E->getType()); if (!TypeOrErr) Index: clang/unittests/AST/ASTImporterTest.cpp =================================================================== --- clang/unittests/AST/ASTImporterTest.cpp +++ clang/unittests/AST/ASTImporterTest.cpp @@ -290,6 +290,21 @@ functionDecl(hasDescendant(chooseExpr()))); } +const internal::VariadicDynCastAllOfMatcher + shuffleVectorExpr; + +TEST_P(ImportExpr, ImportShuffleVectorExpr) { + MatchVerifier Verifier; + constexpr auto Code = R"code( + typedef double vector4double __attribute__((__vector_size__(32))); + vector4double declToImport(vector4double a, vector4double b) { + return __builtin_shufflevector(a, b, 0, 1, 2, 3); + } + )code"; + testImport(Code, Lang_C99, "", Lang_C99, Verifier, + functionDecl(hasDescendant(shuffleVectorExpr()))); +} + TEST_P(ImportExpr, ImportGNUNullExpr) { MatchVerifier Verifier; testImport("void declToImport() { (void)__null; }", Lang_CXX03, "",