================
@@ -7359,6 +7549,150 @@ ExpectedStmt ASTNodeImporter::VisitExpr(Expr *E) {
return make_error<ASTImportError>(ASTImportError::UnsupportedConstruct);
}
+ExpectedStmt ASTNodeImporter::VisitRequiresExpr(RequiresExpr* E) {
+ Error Err = Error::success();
+ auto RequiresKWLoc = importChecked(Err, E->getRequiresKWLoc());
+ auto RParenLoc = importChecked(Err, E->getRParenLoc());
+ auto RBraceLoc = importChecked(Err, E->getRBraceLoc());
+
+ auto Body = importChecked(Err, E->getBody());
+ auto LParenLoc = importChecked(Err, E->getLParenLoc());
+ if (Err)
+ return std::move(Err);
+ SmallVector<ParmVarDecl*, 4> LocalParameters(E->getLocalParameters().size());
+ if (Error Err = ImportArrayChecked(E->getLocalParameters(),
LocalParameters.begin()))
+ return std::move(Err);
+ SmallVector<concepts::Requirement *, 4> Requirements(
+ E->getRequirements().size());
+ if (Error Err = ImportArrayChecked(E->getRequirements(),
Requirements.begin()))
+ return std::move(Err);
+ return RequiresExpr::Create(Importer.getToContext(), RequiresKWLoc, Body,
+ LParenLoc, LocalParameters, RParenLoc,
+ Requirements, RBraceLoc);
+}
+
+ExpectedDecl ASTNodeImporter::VisitRequiresExprBodyDecl(RequiresExprBodyDecl*
D) {
+ DeclContext *DC, *LexicalDC;
+ Error Err = ImportDeclContext(D, DC, LexicalDC);
+ auto RequiresLoc = importChecked(Err, D->getLocation());
+ if (Err)
+ return std::move(Err);
+
+ RequiresExprBodyDecl *To;
+ if (GetImportedOrCreateDecl(To, D, Importer.getToContext(), DC, RequiresLoc))
+ return To;
+ To->setLexicalDeclContext(LexicalDC);
+ LexicalDC->addDeclInternal(To);
+ return To;
+}
----------------
balazske wrote:
There is a section in the file for all of the visit functions for `Decl` types.
The new visit functions with `Decl` should be moved into this place (at the
start or end of it).
https://github.com/llvm/llvm-project/pull/138838
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits