================
@@ -4244,6 +4254,134 @@ void Parser::ParseTrailingRequiresClause(Declarator &D)
{
}
}
+std::optional<Parser::ContractSpecifierKind>
+Parser::getContractSpecifierKind() {
+ if (!getLangOpts().Contracts || Tok.isNot(tok::identifier))
+ return std::nullopt;
+
+ IdentifierInfo *II = Tok.getIdentifierInfo();
+ if (II->isStr("pre"))
+ return ContractSpecifierKind::Pre;
+ if (II->isStr("post"))
+ return ContractSpecifierKind::Post;
+ return std::nullopt;
+}
----------------
ChuanqiXu9 wrote:
> We should cache those, like we do for override.
Done
> I'm also not sure we should gate at the parsing level - we might as well emit
> a proper diagnostic (contracts are a c++26 feature) - which can be an error
> for now
It is emitted in ParseContractSpecifiers now
https://github.com/llvm/llvm-project/pull/221139
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits