[clang] [OpenACC] Implement Sema work for OpenACC Clauses (PR #87821)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 5 12:31:59 PDT 2024


================
@@ -3594,11 +3595,26 @@ class Parser : public CodeCompletionHandler {
     OpenACCDirectiveKind DirKind;
     SourceLocation StartLoc;
     SourceLocation EndLoc;
-    // TODO OpenACC: Add Clause list here once we have a type for that.
+    SmallVector<OpenACCClause *> Clauses;
     // TODO OpenACC: As we implement support for the Atomic, Routine, Cache, and
     // Wait constructs, we likely want to put that information in here as well.
   };
 
+  /// Represents the 'error' state of parsing an OpenACC Clause, and stores
+  /// whether we can continue parsing, or should give up on the directive.
+  enum class OpenACCParseCanContinue { Cannot = 0, Can = 1 };
+
+  /// A type to represent the state of parsing an OpenACC Clause. Situations
+  /// that result in an OpenACCClause pointer are a success and can continue
+  /// parsing, however some other situations can also continue.
+  /// FIXME: This is better represented as a std::expected when we get C++23.
----------------
Endilll wrote:

C++23 is not even on the horizon for us. Have you considered using `llvm::Expected` today?

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


More information about the cfe-commits mailing list