From 3a0edf1ccbe2869fb92e8cda66da6207c80f3c36 Mon Sep 17 00:00:00 2001 From: Kelvin Li Date: Sat, 15 Sep 2018 13:54:15 +0000 Subject: [OPENMP] Move OMPClauseReader/Writer classes to ASTReader/Writer (NFC) Move declarations for OMPClauseReader, OMPClauseWriter to ASTReader.h and ASTWriter.h and move implementation to ASTReader.cpp and ASTWriter.cpp. This change helps generalize the serialization of OpenMP clauses and will be used in the future implementation of new OpenMP directives (e.g. requires). Patch by Patrick Lyster Differential Revision: https://reviews.llvm.org/D52097 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342322 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Serialization/ASTReader.h | 16 ++++++++++++++++ include/clang/Serialization/ASTWriter.h | 13 +++++++++++++ 2 files changed, 29 insertions(+) (limited to 'include/clang/Serialization') diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index 98f8f5af48..f97f545852 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -18,6 +18,7 @@ #include "clang/AST/DeclObjC.h" #include "clang/AST/DeclarationName.h" #include "clang/AST/NestedNameSpecifier.h" +#include "clang/AST/OpenMPClause.h" #include "clang/AST/TemplateBase.h" #include "clang/AST/TemplateName.h" #include "clang/AST/Type.h" @@ -2677,6 +2678,21 @@ inline void PCHValidator::Error(const char *Msg) { Reader.Error(Msg); } +class OMPClauseReader : public OMPClauseVisitor { + ASTRecordReader &Record; + ASTContext &Context; + +public: + OMPClauseReader(ASTRecordReader &Record) + : Record(Record), Context(Record.getContext()) {} + +#define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *C); +#include "clang/Basic/OpenMPKinds.def" + OMPClause *readClause(); + void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C); + void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C); +}; + } // namespace clang #endif // LLVM_CLANG_SERIALIZATION_ASTREADER_H diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h index 1a89a9e14a..da8b10a3f4 100644 --- a/include/clang/Serialization/ASTWriter.h +++ b/include/clang/Serialization/ASTWriter.h @@ -19,6 +19,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/DeclarationName.h" #include "clang/AST/NestedNameSpecifier.h" +#include "clang/AST/OpenMPClause.h" #include "clang/AST/TemplateBase.h" #include "clang/AST/TemplateName.h" #include "clang/AST/Type.h" @@ -993,6 +994,18 @@ public: bool hasEmittedPCH() const { return Buffer->IsComplete; } }; +class OMPClauseWriter : public OMPClauseVisitor { + ASTRecordWriter &Record; + +public: + OMPClauseWriter(ASTRecordWriter &Record) : Record(Record) {} +#define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *S); +#include "clang/Basic/OpenMPKinds.def" + void writeClause(OMPClause *C); + void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C); + void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C); +}; + } // namespace clang #endif // LLVM_CLANG_SERIALIZATION_ASTWRITER_H -- cgit v1.2.3