================
@@ -4244,6 +4222,142 @@ void Parser::ParseTrailingRequiresClause(Declarator &D)
{
}
}
+std::optional<Parser::ContractSpecifierKind>
+Parser::getContractSpecifierKind() {
+ if (!getLangOpts().CPlusPlus || Tok.isNot(tok::identifier))
+ return std::nullopt;
+
+ if (!Ident_pre) {
+ Ident_pre = &PP.getIdentifierTable().get("pre");
+ Ident_post = &PP.getIdentifierTable().get("post");
+ }
+
+ const IdentifierInfo *II = Tok.getIdentifierInfo();
+ if (II == Ident_pre)
+ return ContractSpecifierKind::Pre;
+ if (II == Ident_post)
+ return ContractSpecifierKind::Post;
+ return std::nullopt;
+}
+
+void Parser::ParseContractSpecifiers(Declarator &D) {
+ assert(getContractSpecifierKind() && "expected a contract specifier");
+
+ if (!getLangOpts().CPlusPlus26)
+ Diag(Tok, diag::err_contracts_require_cxx26);
----------------
cor3ntin wrote:
I think we should, ultimately (assuming you mean C++) - i just think it's
premature.
https://github.com/llvm/llvm-project/pull/221139
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits