================
@@ -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;
+}
----------------
cor3ntin wrote:

We should cache those, like we do for override.
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

https://github.com/llvm/llvm-project/pull/221139
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to