[clang] [OpenACC][NFC] Add OpenACC Clause AST Nodes/infrastructure (PR #87675)
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 5 06:45:42 PDT 2024
================
@@ -101,24 +113,45 @@ class OpenACCAssociatedStmtConstruct : public OpenACCConstructStmt {
/// those three, as they are semantically identical, and have only minor
/// differences in the permitted list of clauses, which can be differentiated by
/// the 'Kind'.
-class OpenACCComputeConstruct : public OpenACCAssociatedStmtConstruct {
+class OpenACCComputeConstruct final
+ : public OpenACCAssociatedStmtConstruct,
+ public llvm::TrailingObjects<OpenACCComputeConstruct,
+ const OpenACCClause *> {
friend class ASTStmtWriter;
friend class ASTStmtReader;
friend class ASTContext;
- OpenACCComputeConstruct()
- : OpenACCAssociatedStmtConstruct(
- OpenACCComputeConstructClass, OpenACCDirectiveKind::Invalid,
- SourceLocation{}, SourceLocation{}, /*AssociatedStmt=*/nullptr) {}
+ OpenACCComputeConstruct(unsigned NumClauses)
+ : OpenACCAssociatedStmtConstruct(OpenACCComputeConstructClass,
+ OpenACCDirectiveKind::Invalid,
+ SourceLocation{}, SourceLocation{},
+ /*AssociatedStmt=*/nullptr) {
+ // We cannot send the TrailingObjects storage to the base class (which holds
+ // a reference to the data) until it is constructed, so we have to set it
+ // separately here.
+ memset(getTrailingObjects<const OpenACCClause *>(), 0,
+ NumClauses * sizeof(const OpenACCClause *));
----------------
alexey-bataev wrote:
I meant something like std::unitialized_copy
https://github.com/llvm/llvm-project/pull/87675
More information about the cfe-commits
mailing list