diff options
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 555 |
1 files changed, 518 insertions, 37 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 1a8d806e9d246..37adcb70640d4 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -310,7 +310,7 @@ void ASTTypeWriter::VisitFunctionProtoType(const FunctionProtoType *T) { Record.push_back(T->isVariadic()); Record.push_back(T->hasTrailingReturn()); - Record.push_back(T->getTypeQuals()); + Record.push_back(T->getTypeQuals().getAsOpaqueValue()); Record.push_back(static_cast<unsigned>(T->getRefQualifier())); addExceptionSpec(T, Record); @@ -770,19 +770,7 @@ void TypeLocWriter::VisitEnumTypeLoc(EnumTypeLoc TL) { } void TypeLocWriter::VisitAttributedTypeLoc(AttributedTypeLoc TL) { - Record.AddSourceLocation(TL.getAttrNameLoc()); - if (TL.hasAttrOperand()) { - SourceRange range = TL.getAttrOperandParensRange(); - Record.AddSourceLocation(range.getBegin()); - Record.AddSourceLocation(range.getEnd()); - } - if (TL.hasAttrExprOperand()) { - Expr *operand = TL.getAttrExprOperand(); - Record.push_back(operand ? 1 : 0); - if (operand) Record.AddStmt(operand); - } else if (TL.hasAttrEnumOperand()) { - Record.AddSourceLocation(TL.getAttrEnumOperandLoc()); - } + Record.AddAttr(TL.getAttr()); } void TypeLocWriter::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) { @@ -1707,7 +1695,6 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context, // Detailed record is important since it is used for the module cache hash. Record.push_back(PPOpts.DetailedRecord); AddString(PPOpts.ImplicitPCHInclude, Record); - AddString(PPOpts.ImplicitPTHInclude, Record); Record.push_back(static_cast<unsigned>(PPOpts.ObjCXXARCStandardLibrary)); Stream.EmitRecord(PREPROCESSOR_OPTIONS, Record); @@ -2507,8 +2494,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP, bool IsModule) { MacroIdentifiers.push_back(Id.second); // Sort the set of macro definitions that need to be serialized by the // name of the macro, to provide a stable ordering. - llvm::sort(MacroIdentifiers.begin(), MacroIdentifiers.end(), - llvm::less_ptr<IdentifierInfo>()); + llvm::sort(MacroIdentifiers, llvm::less_ptr<IdentifierInfo>()); // Emit the macro directives as a list and associate the offset with the // identifier they belong to. @@ -3242,8 +3228,7 @@ void ASTWriter::WriteFileDeclIDsMap() { SmallVector<std::pair<FileID, DeclIDInFileInfo *>, 64> SortedFileDeclIDs( FileDeclIDs.begin(), FileDeclIDs.end()); - llvm::sort(SortedFileDeclIDs.begin(), SortedFileDeclIDs.end(), - llvm::less_first()); + llvm::sort(SortedFileDeclIDs, llvm::less_first()); // Join the vectors of DeclIDs from all files. SmallVector<DeclID, 256> FileGroupedDeclIDs; @@ -3586,7 +3571,7 @@ class ASTIdentifierTableTrait { II->isPoisoned() || (IsModule ? II->hasRevertedBuiltin() : II->getObjCOrBuiltinID()) || II->hasRevertedTokenIDToIdentifier() || - (NeedDecls && II->getFETokenInfo<void>())) + (NeedDecls && II->getFETokenInfo())) return true; return false; @@ -3749,7 +3734,7 @@ void ASTWriter::WriteIdentifierTable(Preprocessor &PP, IIs.push_back(ID.second); // Sort the identifiers lexicographically before getting them references so // that their order is stable. - llvm::sort(IIs.begin(), IIs.end(), llvm::less_ptr<IdentifierInfo>()); + llvm::sort(IIs, llvm::less_ptr<IdentifierInfo>()); for (const IdentifierInfo *II : IIs) if (Trait.isInterestingNonMacroIdentifier(II)) getIdentifierRef(II); @@ -3960,7 +3945,8 @@ public: bool ASTWriter::isLookupResultExternal(StoredDeclsList &Result, DeclContext *DC) { - return Result.hasExternalDecls() && DC->NeedToReconcileExternalVisibleStorage; + return Result.hasExternalDecls() && + DC->hasNeedToReconcileExternalVisibleStorage(); } bool ASTWriter::isLookupResultEntirelyExternal(StoredDeclsList &Result, @@ -3975,8 +3961,8 @@ bool ASTWriter::isLookupResultEntirelyExternal(StoredDeclsList &Result, void ASTWriter::GenerateNameLookupTable(const DeclContext *ConstDC, llvm::SmallVectorImpl<char> &LookupTable) { - assert(!ConstDC->HasLazyLocalLexicalLookups && - !ConstDC->HasLazyExternalLexicalLookups && + assert(!ConstDC->hasLazyLocalLexicalLookups() && + !ConstDC->hasLazyExternalLexicalLookups() && "must call buildLookups first"); // FIXME: We need to build the lookups table, which is logically const. @@ -4046,7 +4032,7 @@ ASTWriter::GenerateNameLookupTable(const DeclContext *ConstDC, } // Sort the names into a stable order. - llvm::sort(Names.begin(), Names.end()); + llvm::sort(Names); if (auto *D = dyn_cast<CXXRecordDecl>(DC)) { // We need to establish an ordering of constructor and conversion function @@ -4183,7 +4169,7 @@ uint64_t ASTWriter::WriteDeclContextVisibleBlock(ASTContext &Context, std::make_pair(Entry.first, Entry.second.getLookupResult())); } - llvm::sort(LookupResults.begin(), LookupResults.end(), llvm::less_first()); + llvm::sort(LookupResults, llvm::less_first()); for (auto &NameAndResult : LookupResults) { DeclarationName Name = NameAndResult.first; DeclContext::lookup_result Result = NameAndResult.second; @@ -4480,16 +4466,21 @@ void ASTWriter::WriteModuleFileExtension(Sema &SemaRef, // General Serialization Routines //===----------------------------------------------------------------------===// -/// Emit the list of attributes to the specified record. -void ASTRecordWriter::AddAttributes(ArrayRef<const Attr *> Attrs) { +void ASTRecordWriter::AddAttr(const Attr *A) { auto &Record = *this; - Record.push_back(Attrs.size()); - for (const auto *A : Attrs) { - Record.push_back(A->getKind()); // FIXME: stable encoding, target attrs - Record.AddSourceRange(A->getRange()); + if (!A) + return Record.push_back(0); + Record.push_back(A->getKind() + 1); // FIXME: stable encoding, target attrs + Record.AddSourceRange(A->getRange()); #include "clang/Serialization/AttrPCHWrite.inc" - } +} + +/// Emit the list of attributes to the specified record. +void ASTRecordWriter::AddAttributes(ArrayRef<const Attr *> Attrs) { + push_back(Attrs.size()); + for (const auto *A : Attrs) + AddAttr(A); } void ASTWriter::AddToken(const Token &Tok, RecordDataImpl &Record) { @@ -4881,7 +4872,7 @@ ASTFileSignature ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot, IIs.push_back(II); } // Sort the identifiers to visit based on their name. - llvm::sort(IIs.begin(), IIs.end(), llvm::less_ptr<IdentifierInfo>()); + llvm::sort(IIs, llvm::less_ptr<IdentifierInfo>()); for (const IdentifierInfo *II : IIs) { for (IdentifierResolver::iterator D = SemaRef.IdResolver.begin(II), DEnd = SemaRef.IdResolver.end(); @@ -5022,13 +5013,16 @@ ASTFileSignature ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot, WriteFPPragmaOptions(SemaRef.getFPOptions()); WriteOpenCLExtensions(SemaRef); WriteOpenCLExtensionTypes(SemaRef); - WriteOpenCLExtensionDecls(SemaRef); WriteCUDAPragmas(SemaRef); // If we're emitting a module, write out the submodule information. if (WritingModule) WriteSubmodules(WritingModule); + // We need to have information about submodules to correctly deserialize + // decls from OpenCLExtensionDecls block + WriteOpenCLExtensionDecls(SemaRef); + Stream.EmitRecord(SPECIAL_TYPES, SpecialTypes); // Write the record containing external, unnamed definitions. @@ -5118,7 +5112,7 @@ ASTFileSignature ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot, }; // Sort and deduplicate module IDs. - llvm::sort(Imports.begin(), Imports.end(), Cmp); + llvm::sort(Imports, Cmp); Imports.erase(std::unique(Imports.begin(), Imports.end(), Eq), Imports.end()); @@ -5254,7 +5248,7 @@ void ASTWriter::WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord) { } Record.push_back(RD->getTagKind()); Record.AddSourceLocation(RD->getLocation()); - Record.AddSourceLocation(RD->getLocStart()); + Record.AddSourceLocation(RD->getBeginLoc()); Record.AddSourceRange(RD->getBraceRange()); // Instantiation may change attributes; write them all out afresh. @@ -5295,6 +5289,7 @@ void ASTWriter::WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord) { break; case UPD_DECL_MARKED_OPENMP_DECLARETARGET: + Record.push_back(D->getAttr<OMPDeclareTargetDeclAttr>()->getMapType()); Record.AddSourceRange( D->getAttr<OMPDeclareTargetDeclAttr>()->getRange()); break; @@ -6472,3 +6467,489 @@ void ASTWriter::AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, DeclsToEmitEvenIfUnreferenced.push_back(D); } + +//===----------------------------------------------------------------------===// +//// OMPClause Serialization +////===----------------------------------------------------------------------===// + +void OMPClauseWriter::writeClause(OMPClause *C) { + Record.push_back(C->getClauseKind()); + Visit(C); + Record.AddSourceLocation(C->getBeginLoc()); + Record.AddSourceLocation(C->getEndLoc()); +} + +void OMPClauseWriter::VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C) { + Record.push_back(C->getCaptureRegion()); + Record.AddStmt(C->getPreInitStmt()); +} + +void OMPClauseWriter::VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C) { + VisitOMPClauseWithPreInit(C); + Record.AddStmt(C->getPostUpdateExpr()); +} + +void OMPClauseWriter::VisitOMPIfClause(OMPIfClause *C) { + VisitOMPClauseWithPreInit(C); + Record.push_back(C->getNameModifier()); + Record.AddSourceLocation(C->getNameModifierLoc()); + Record.AddSourceLocation(C->getColonLoc()); + Record.AddStmt(C->getCondition()); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPFinalClause(OMPFinalClause *C) { + Record.AddStmt(C->getCondition()); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) { + VisitOMPClauseWithPreInit(C); + Record.AddStmt(C->getNumThreads()); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPSafelenClause(OMPSafelenClause *C) { + Record.AddStmt(C->getSafelen()); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPSimdlenClause(OMPSimdlenClause *C) { + Record.AddStmt(C->getSimdlen()); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPCollapseClause(OMPCollapseClause *C) { + Record.AddStmt(C->getNumForLoops()); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPDefaultClause(OMPDefaultClause *C) { + Record.push_back(C->getDefaultKind()); + Record.AddSourceLocation(C->getLParenLoc()); + Record.AddSourceLocation(C->getDefaultKindKwLoc()); +} + +void OMPClauseWriter::VisitOMPProcBindClause(OMPProcBindClause *C) { + Record.push_back(C->getProcBindKind()); + Record.AddSourceLocation(C->getLParenLoc()); + Record.AddSourceLocation(C->getProcBindKindKwLoc()); +} + +void OMPClauseWriter::VisitOMPScheduleClause(OMPScheduleClause *C) { + VisitOMPClauseWithPreInit(C); + Record.push_back(C->getScheduleKind()); + Record.push_back(C->getFirstScheduleModifier()); + Record.push_back(C->getSecondScheduleModifier()); + Record.AddStmt(C->getChunkSize()); + Record.AddSourceLocation(C->getLParenLoc()); + Record.AddSourceLocation(C->getFirstScheduleModifierLoc()); + Record.AddSourceLocation(C->getSecondScheduleModifierLoc()); + Record.AddSourceLocation(C->getScheduleKindLoc()); + Record.AddSourceLocation(C->getCommaLoc()); +} + +void OMPClauseWriter::VisitOMPOrderedClause(OMPOrderedClause *C) { + Record.push_back(C->getLoopNumIterations().size()); + Record.AddStmt(C->getNumForLoops()); + for (Expr *NumIter : C->getLoopNumIterations()) + Record.AddStmt(NumIter); + for (unsigned I = 0, E = C->getLoopNumIterations().size(); I <E; ++I) + Record.AddStmt(C->getLoopCounter(I)); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPNowaitClause(OMPNowaitClause *) {} + +void OMPClauseWriter::VisitOMPUntiedClause(OMPUntiedClause *) {} + +void OMPClauseWriter::VisitOMPMergeableClause(OMPMergeableClause *) {} + +void OMPClauseWriter::VisitOMPReadClause(OMPReadClause *) {} + +void OMPClauseWriter::VisitOMPWriteClause(OMPWriteClause *) {} + +void OMPClauseWriter::VisitOMPUpdateClause(OMPUpdateClause *) {} + +void OMPClauseWriter::VisitOMPCaptureClause(OMPCaptureClause *) {} + +void OMPClauseWriter::VisitOMPSeqCstClause(OMPSeqCstClause *) {} + +void OMPClauseWriter::VisitOMPThreadsClause(OMPThreadsClause *) {} + +void OMPClauseWriter::VisitOMPSIMDClause(OMPSIMDClause *) {} + +void OMPClauseWriter::VisitOMPNogroupClause(OMPNogroupClause *) {} + +void OMPClauseWriter::VisitOMPPrivateClause(OMPPrivateClause *C) { + Record.push_back(C->varlist_size()); + Record.AddSourceLocation(C->getLParenLoc()); + for (auto *VE : C->varlists()) { + Record.AddStmt(VE); + } + for (auto *VE : C->private_copies()) { + Record.AddStmt(VE); + } +} + +void OMPClauseWriter::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) { + Record.push_back(C->varlist_size()); + VisitOMPClauseWithPreInit(C); + Record.AddSourceLocation(C->getLParenLoc()); + for (auto *VE : C->varlists()) { + Record.AddStmt(VE); + } + for (auto *VE : C->private_copies()) { + Record.AddStmt(VE); + } + for (auto *VE : C->inits()) { + Record.AddStmt(VE); + } +} + +void OMPClauseWriter::VisitOMPLastprivateClause(OMPLastprivateClause *C) { + Record.push_back(C->varlist_size()); + VisitOMPClauseWithPostUpdate(C); + Record.AddSourceLocation(C->getLParenLoc()); + for (auto *VE : C->varlists()) + Record.AddStmt(VE); + for (auto *E : C->private_copies()) + Record.AddStmt(E); + for (auto *E : C->source_exprs()) + Record.AddStmt(E); + for (auto *E : C->destination_exprs()) + Record.AddStmt(E); + for (auto *E : C->assignment_ops()) + Record.AddStmt(E); +} + +void OMPClauseWriter::VisitOMPSharedClause(OMPSharedClause *C) { + Record.push_back(C->varlist_size()); + Record.AddSourceLocation(C->getLParenLoc()); + for (auto *VE : C->varlists()) + Record.AddStmt(VE); +} + +void OMPClauseWriter::VisitOMPReductionClause(OMPReductionClause *C) { + Record.push_back(C->varlist_size()); + VisitOMPClauseWithPostUpdate(C); + Record.AddSourceLocation(C->getLParenLoc()); + Record.AddSourceLocation(C->getColonLoc()); + Record.AddNestedNameSpecifierLoc(C->getQualifierLoc()); + Record.AddDeclarationNameInfo(C->getNameInfo()); + for (auto *VE : C->varlists()) + Record.AddStmt(VE); + for (auto *VE : C->privates()) + Record.AddStmt(VE); + for (auto *E : C->lhs_exprs()) + Record.AddStmt(E); + for (auto *E : C->rhs_exprs()) + Record.AddStmt(E); + for (auto *E : C->reduction_ops()) + Record.AddStmt(E); +} + +void OMPClauseWriter::VisitOMPTaskReductionClause(OMPTaskReductionClause *C) { + Record.push_back(C->varlist_size()); + VisitOMPClauseWithPostUpdate(C); + Record.AddSourceLocation(C->getLParenLoc()); + Record.AddSourceLocation(C->getColonLoc()); + Record.AddNestedNameSpecifierLoc(C->getQualifierLoc()); + Record.AddDeclarationNameInfo(C->getNameInfo()); + for (auto *VE : C->varlists()) + Record.AddStmt(VE); + for (auto *VE : C->privates()) + Record.AddStmt(VE); + for (auto *E : C->lhs_exprs()) + Record.AddStmt(E); + for (auto *E : C->rhs_exprs()) + Record.AddStmt(E); + for (auto *E : C->reduction_ops()) + Record.AddStmt(E); +} + +void OMPClauseWriter::VisitOMPInReductionClause(OMPInReductionClause *C) { + Record.push_back(C->varlist_size()); + VisitOMPClauseWithPostUpdate(C); + Record.AddSourceLocation(C->getLParenLoc()); + Record.AddSourceLocation(C->getColonLoc()); + Record.AddNestedNameSpecifierLoc(C->getQualifierLoc()); + Record.AddDeclarationNameInfo(C->getNameInfo()); + for (auto *VE : C->varlists()) + Record.AddStmt(VE); + for (auto *VE : C->privates()) + Record.AddStmt(VE); + for (auto *E : C->lhs_exprs()) + Record.AddStmt(E); + for (auto *E : C->rhs_exprs()) + Record.AddStmt(E); + for (auto *E : C->reduction_ops()) + Record.AddStmt(E); + for (auto *E : C->taskgroup_descriptors()) + Record.AddStmt(E); +} + +void OMPClauseWriter::VisitOMPLinearClause(OMPLinearClause *C) { + Record.push_back(C->varlist_size()); + VisitOMPClauseWithPostUpdate(C); + Record.AddSourceLocation(C->getLParenLoc()); + Record.AddSourceLocation(C->getColonLoc()); + Record.push_back(C->getModifier()); + Record.AddSourceLocation(C->getModifierLoc()); + for (auto *VE : C->varlists()) { + Record.AddStmt(VE); + } + for (auto *VE : C->privates()) { + Record.AddStmt(VE); + } + for (auto *VE : C->inits()) { + Record.AddStmt(VE); + } + for (auto *VE : C->updates()) { + Record.AddStmt(VE); + } + for (auto *VE : C->finals()) { + Record.AddStmt(VE); + } + Record.AddStmt(C->getStep()); + Record.AddStmt(C->getCalcStep()); +} + +void OMPClauseWriter::VisitOMPAlignedClause(OMPAlignedClause *C) { + Record.push_back(C->varlist_size()); + Record.AddSourceLocation(C->getLParenLoc()); + Record.AddSourceLocation(C->getColonLoc()); + for (auto *VE : C->varlists()) + Record.AddStmt(VE); + Record.AddStmt(C->getAlignment()); +} + +void OMPClauseWriter::VisitOMPCopyinClause(OMPCopyinClause *C) { + Record.push_back(C->varlist_size()); + Record.AddSourceLocation(C->getLParenLoc()); + for (auto *VE : C->varlists()) + Record.AddStmt(VE); + for (auto *E : C->source_exprs()) + Record.AddStmt(E); + for (auto *E : C->destination_exprs()) + Record.AddStmt(E); + for (auto *E : C->assignment_ops()) + Record.AddStmt(E); +} + +void OMPClauseWriter::VisitOMPCopyprivateClause(OMPCopyprivateClause *C) { + Record.push_back(C->varlist_size()); + Record.AddSourceLocation(C->getLParenLoc()); + for (auto *VE : C->varlists()) + Record.AddStmt(VE); + for (auto *E : C->source_exprs()) + Record.AddStmt(E); + for (auto *E : C->destination_exprs()) + Record.AddStmt(E); + for (auto *E : C->assignment_ops()) + Record.AddStmt(E); +} + +void OMPClauseWriter::VisitOMPFlushClause(OMPFlushClause *C) { + Record.push_back(C->varlist_size()); + Record.AddSourceLocation(C->getLParenLoc()); + for (auto *VE : C->varlists()) + Record.AddStmt(VE); +} + +void OMPClauseWriter::VisitOMPDependClause(OMPDependClause *C) { + Record.push_back(C->varlist_size()); + Record.push_back(C->getNumLoops()); + Record.AddSourceLocation(C->getLParenLoc()); + Record.push_back(C->getDependencyKind()); + Record.AddSourceLocation(C->getDependencyLoc()); + Record.AddSourceLocation(C->getColonLoc()); + for (auto *VE : C->varlists()) + Record.AddStmt(VE); + for (unsigned I = 0, E = C->getNumLoops(); I < E; ++I) + Record.AddStmt(C->getLoopData(I)); +} + +void OMPClauseWriter::VisitOMPDeviceClause(OMPDeviceClause *C) { + VisitOMPClauseWithPreInit(C); + Record.AddStmt(C->getDevice()); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPMapClause(OMPMapClause *C) { + Record.push_back(C->varlist_size()); + Record.push_back(C->getUniqueDeclarationsNum()); + Record.push_back(C->getTotalComponentListNum()); + Record.push_back(C->getTotalComponentsNum()); + Record.AddSourceLocation(C->getLParenLoc()); + for (unsigned I = 0; I < OMPMapClause::NumberOfModifiers; ++I) { + Record.push_back(C->getMapTypeModifier(I)); + Record.AddSourceLocation(C->getMapTypeModifierLoc(I)); + } + Record.push_back(C->getMapType()); + Record.AddSourceLocation(C->getMapLoc()); + Record.AddSourceLocation(C->getColonLoc()); + for (auto *E : C->varlists()) + Record.AddStmt(E); + for (auto *D : C->all_decls()) + Record.AddDeclRef(D); + for (auto N : C->all_num_lists()) + Record.push_back(N); + for (auto N : C->all_lists_sizes()) + Record.push_back(N); + for (auto &M : C->all_components()) { + Record.AddStmt(M.getAssociatedExpression()); + Record.AddDeclRef(M.getAssociatedDeclaration()); + } +} + +void OMPClauseWriter::VisitOMPNumTeamsClause(OMPNumTeamsClause *C) { + VisitOMPClauseWithPreInit(C); + Record.AddStmt(C->getNumTeams()); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPThreadLimitClause(OMPThreadLimitClause *C) { + VisitOMPClauseWithPreInit(C); + Record.AddStmt(C->getThreadLimit()); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPPriorityClause(OMPPriorityClause *C) { + Record.AddStmt(C->getPriority()); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPGrainsizeClause(OMPGrainsizeClause *C) { + Record.AddStmt(C->getGrainsize()); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPNumTasksClause(OMPNumTasksClause *C) { + Record.AddStmt(C->getNumTasks()); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPHintClause(OMPHintClause *C) { + Record.AddStmt(C->getHint()); + Record.AddSourceLocation(C->getLParenLoc()); +} + +void OMPClauseWriter::VisitOMPDistScheduleClause(OMPDistScheduleClause *C) { + VisitOMPClauseWithPreInit(C); + Record.push_back(C->getDistScheduleKind()); + Record.AddStmt(C->getChunkSize()); + Record.AddSourceLocation(C->getLParenLoc()); + Record.AddSourceLocation(C->getDistScheduleKindLoc()); + Record.AddSourceLocation(C->getCommaLoc()); +} + +void OMPClauseWriter::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) { + Record.push_back(C->getDefaultmapKind()); + Record.push_back(C->getDefaultmapModifier()); + Record.AddSourceLocation(C->getLParenLoc()); + Record.AddSourceLocation(C->getDefaultmapModifierLoc()); + Record.AddSourceLocation(C->getDefaultmapKindLoc()); +} + +void OMPClauseWriter::VisitOMPToClause(OMPToClause *C) { + Record.push_back(C->varlist_size()); + Record.push_back(C->getUniqueDeclarationsNum()); + Record.push_back(C->getTotalComponentListNum()); + Record.push_back(C->getTotalComponentsNum()); + Record.AddSourceLocation(C->getLParenLoc()); + for (auto *E : C->varlists()) + Record.AddStmt(E); + for (auto *D : C->all_decls()) + Record.AddDeclRef(D); + for (auto N : C->all_num_lists()) + Record.push_back(N); + for (auto N : C->all_lists_sizes()) + Record.push_back(N); + for (auto &M : C->all_components()) { + Record.AddStmt(M.getAssociatedExpression()); + Record.AddDeclRef(M.getAssociatedDeclaration()); + } +} + +void OMPClauseWriter::VisitOMPFromClause(OMPFromClause *C) { + Record.push_back(C->varlist_size()); + Record.push_back(C->getUniqueDeclarationsNum()); + Record.push_back(C->getTotalComponentListNum()); + Record.push_back(C->getTotalComponentsNum()); + Record.AddSourceLocation(C->getLParenLoc()); + for (auto *E : C->varlists()) + Record.AddStmt(E); + for (auto *D : C->all_decls()) + Record.AddDeclRef(D); + for (auto N : C->all_num_lists()) + Record.push_back(N); + for (auto N : C->all_lists_sizes()) + Record.push_back(N); + for (auto &M : C->all_components()) { + Record.AddStmt(M.getAssociatedExpression()); + Record.AddDeclRef(M.getAssociatedDeclaration()); + } +} + +void OMPClauseWriter::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *C) { + Record.push_back(C->varlist_size()); + Record.push_back(C->getUniqueDeclarationsNum()); + Record.push_back(C->getTotalComponentListNum()); + Record.push_back(C->getTotalComponentsNum()); + Record.AddSourceLocation(C->getLParenLoc()); + for (auto *E : C->varlists()) + Record.AddStmt(E); + for (auto *VE : C->private_copies()) + Record.AddStmt(VE); + for (auto *VE : C->inits()) + Record.AddStmt(VE); + for (auto *D : C->all_decls()) + Record.AddDeclRef(D); + for (auto N : C->all_num_lists()) + Record.push_back(N); + for (auto N : C->all_lists_sizes()) + Record.push_back(N); + for (auto &M : C->all_components()) { + Record.AddStmt(M.getAssociatedExpression()); + Record.AddDeclRef(M.getAssociatedDeclaration()); + } +} + +void OMPClauseWriter::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) { + Record.push_back(C->varlist_size()); + Record.push_back(C->getUniqueDeclarationsNum()); + Record.push_back(C->getTotalComponentListNum()); + Record.push_back(C->getTotalComponentsNum()); + Record.AddSourceLocation(C->getLParenLoc()); + for (auto *E : C->varlists()) + Record.AddStmt(E); + for (auto *D : C->all_decls()) + Record.AddDeclRef(D); + for (auto N : C->all_num_lists()) + Record.push_back(N); + for (auto N : C->all_lists_sizes()) + Record.push_back(N); + for (auto &M : C->all_components()) { + Record.AddStmt(M.getAssociatedExpression()); + Record.AddDeclRef(M.getAssociatedDeclaration()); + } +} + +void OMPClauseWriter::VisitOMPUnifiedAddressClause(OMPUnifiedAddressClause *) {} + +void OMPClauseWriter::VisitOMPUnifiedSharedMemoryClause( + OMPUnifiedSharedMemoryClause *) {} + +void OMPClauseWriter::VisitOMPReverseOffloadClause(OMPReverseOffloadClause *) {} + +void +OMPClauseWriter::VisitOMPDynamicAllocatorsClause(OMPDynamicAllocatorsClause *) { +} + +void OMPClauseWriter::VisitOMPAtomicDefaultMemOrderClause( + OMPAtomicDefaultMemOrderClause *C) { + Record.push_back(C->getAtomicDefaultMemOrderKind()); + Record.AddSourceLocation(C->getLParenLoc()); + Record.AddSourceLocation(C->getAtomicDefaultMemOrderKindKwLoc()); +} |