[clang] [OpenACC] Implement 'routine' construct parsing (PR #73143)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 22 09:12:44 PST 2023


================
@@ -232,32 +235,87 @@ void ParseOpenACCClauseList(Parser &P) {
     P.Diag(P.getCurToken(), diag::warn_pragma_acc_unimplemented_clause_parsing);
 }
 
-void ParseOpenACCDirective(Parser &P) {
-  OpenACCDirectiveKind DirKind = ParseOpenACCDirectiveKind(P);
+} // namespace
+
+// Routine has an optional paren-wrapped name of a function in the local scope.
+// We parse the name, emitting any diagnostics
+ExprResult Parser::ParseOpenACCRoutineName() {
+
+  ExprResult Res;
+  if (getLangOpts().CPlusPlus)
+    Res = ParseCXXIdExpression(/*isAddressOfOperand=*/false);
+  else {
----------------
erichkeane wrote:

Interestingly, when I was rewriting our brace policy a few years ago, nearly this exact case was one that people wanted to preserve, so the rule essentially became "once you start, use it for the rest, but not before you need to".  

I wasn't a huge proponent of it, and don't mind here, so I've added them.

https://github.com/llvm/llvm-project/pull/73143


More information about the cfe-commits mailing list