diff options
Diffstat (limited to 'lib/Serialization/ASTReader.cpp')
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 1024 |
1 files changed, 974 insertions, 50 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 723839ff62bf3..e0b2b24a0d32a 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -61,7 +61,6 @@ #include "clang/Basic/TargetOptions.h" #include "clang/Basic/TokenKinds.h" #include "clang/Basic/Version.h" -#include "clang/Frontend/PCHContainerOperations.h" #include "clang/Lex/HeaderSearch.h" #include "clang/Lex/HeaderSearchOptions.h" #include "clang/Lex/MacroInfo.h" @@ -81,6 +80,7 @@ #include "clang/Serialization/Module.h" #include "clang/Serialization/ModuleFileExtension.h" #include "clang/Serialization/ModuleManager.h" +#include "clang/Serialization/PCHContainerOperations.h" #include "clang/Serialization/SerializationDiagnostic.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/APInt.h" @@ -396,8 +396,8 @@ static bool checkTargetOptions(const TargetOptions &TargetOpts, ExistingTargetOpts.FeaturesAsWritten.end()); SmallVector<StringRef, 4> ReadFeatures(TargetOpts.FeaturesAsWritten.begin(), TargetOpts.FeaturesAsWritten.end()); - llvm::sort(ExistingFeatures.begin(), ExistingFeatures.end()); - llvm::sort(ReadFeatures.begin(), ReadFeatures.end()); + llvm::sort(ExistingFeatures); + llvm::sort(ReadFeatures); // We compute the set difference in both directions explicitly so that we can // diagnose the differences differently. @@ -908,7 +908,7 @@ static bool isInterestingIdentifier(ASTReader &Reader, IdentifierInfo &II, (IsModule ? II.hasRevertedBuiltin() : II.getObjCOrBuiltinID()) || II.hasRevertedTokenIDToIdentifier() || (!(IsModule && Reader.getPreprocessor().getLangOpts().CPlusPlus) && - II.getFETokenInfo<void>()); + II.getFETokenInfo()); } static bool readBit(unsigned &Bits) { @@ -3780,22 +3780,15 @@ void ASTReader::makeModuleVisible(Module *Mod, /// visible. void ASTReader::mergeDefinitionVisibility(NamedDecl *Def, NamedDecl *MergedDef) { - // FIXME: This doesn't correctly handle the case where MergedDef is visible - // in modules other than its owning module. We should instead give the - // ASTContext a list of merged definitions for Def. if (Def->isHidden()) { // If MergedDef is visible or becomes visible, make the definition visible. if (!MergedDef->isHidden()) Def->setVisibleDespiteOwningModule(); - else if (getContext().getLangOpts().ModulesLocalVisibility) { + else { getContext().mergeDefinitionIntoModule( Def, MergedDef->getImportedOwningModule(), /*NotifyListeners*/ false); PendingMergedDefinitionsToDeduplicate.insert(Def); - } else { - auto SubmoduleID = MergedDef->getOwningModuleID(); - assert(SubmoduleID && "hidden definition in no module"); - HiddenNamesMap[getSubmodule(SubmoduleID)].push_back(Def); } } } @@ -4868,11 +4861,11 @@ bool ASTReader::readASTFileControlBlock( unsigned Idx = 0, N = Record.size(); while (Idx < N) { // Read information about the AST file. - Idx += 5; // ImportLoc, Size, ModTime, Signature - SkipString(Record, Idx); // Module name; FIXME: pass to listener? + Idx += 1+1+1+1+5; // Kind, ImportLoc, Size, ModTime, Signature + std::string ModuleName = ReadString(Record, Idx); std::string Filename = ReadString(Record, Idx); ResolveImportedPath(Filename, ModuleDir); - Listener.visitImport(Filename); + Listener.visitImport(ModuleName, Filename); } break; } @@ -5395,7 +5388,6 @@ bool ASTReader::ParsePreprocessorOptions(const RecordData &Record, PPOpts.UsePredefines = Record[Idx++]; PPOpts.DetailedRecord = Record[Idx++]; PPOpts.ImplicitPCHInclude = ReadString(Record, Idx); - PPOpts.ImplicitPTHInclude = ReadString(Record, Idx); PPOpts.ObjCXXARCStandardLibrary = static_cast<ObjCXXARCStandardLibraryKind>(Record[Idx++]); SuggestedPredefines.clear(); @@ -6058,7 +6050,7 @@ QualType ASTReader::readTypeRecord(unsigned Index) { EPI.Variadic = Record[Idx++]; EPI.HasTrailingReturn = Record[Idx++]; - EPI.TypeQuals = Record[Idx++]; + EPI.TypeQuals = Qualifiers::fromOpaqueValue(Record[Idx++]); EPI.RefQualifier = static_cast<RefQualifierKind>(Record[Idx++]); SmallVector<QualType, 8> ExceptionStorage; readExceptionSpec(*Loc.F, ExceptionStorage, EPI.ExceptionSpec, Record, Idx); @@ -6455,6 +6447,10 @@ class TypeLocReader : public TypeLocVisitor<TypeLocReader> { return Reader->ReadNestedNameSpecifierLoc(*F, Record, Idx); } + Attr *ReadAttr() { + return Reader->ReadAttr(*F, Record, Idx); + } + public: TypeLocReader(ModuleFile &F, ASTReader &Reader, const ASTReader::RecordData &Record, unsigned &Idx) @@ -6646,20 +6642,7 @@ void TypeLocReader::VisitEnumTypeLoc(EnumTypeLoc TL) { } void TypeLocReader::VisitAttributedTypeLoc(AttributedTypeLoc TL) { - TL.setAttrNameLoc(ReadSourceLocation()); - if (TL.hasAttrOperand()) { - SourceRange range; - range.setBegin(ReadSourceLocation()); - range.setEnd(ReadSourceLocation()); - TL.setAttrOperandParensRange(range); - } - if (TL.hasAttrExprOperand()) { - if (Record[Idx++]) - TL.setAttrExprOperand(Reader->ReadExpr(*F)); - else - TL.setAttrExprOperand(nullptr); - } else if (TL.hasAttrEnumOperand()) - TL.setAttrEnumOperandLoc(ReadSourceLocation()); + TL.setAttr(ReadAttr()); } void TypeLocReader::VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) { @@ -6979,6 +6962,11 @@ QualType ASTReader::GetType(TypeID ID) { T = Context.SingletonId; \ break; #include "clang/Basic/OpenCLImageTypes.def" +#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ + case PREDEF_TYPE_##Id##_ID: \ + T = Context.Id##Ty; \ + break; +#include "clang/Basic/OpenCLExtensionTypes.def" case PREDEF_TYPE_SAMPLER_ID: T = Context.OCLSamplerTy; break; @@ -9206,8 +9194,7 @@ void ASTReader::ReadComments() { NextCursor: // De-serialized SourceLocations get negative FileIDs for other modules, // potentially invalidating the original order. Sort it again. - llvm::sort(Comments.begin(), Comments.end(), - BeforeThanCompare<RawComment>(SourceMgr)); + llvm::sort(Comments, BeforeThanCompare<RawComment>(SourceMgr)); Context.Comments.addDeserializedComments(Comments); } } @@ -9254,7 +9241,7 @@ std::string ASTReader::getOwningModuleNameForDiagnostic(const Decl *D) { } void ASTReader::finishPendingActions() { - while (!PendingIdentifierInfos.empty() || + while (!PendingIdentifierInfos.empty() || !PendingFunctionTypes.empty() || !PendingIncompleteDeclChains.empty() || !PendingDeclChains.empty() || !PendingMacroIDs.empty() || !PendingDeclContextInfos.empty() || !PendingUpdateRecords.empty()) { @@ -9273,6 +9260,21 @@ void ASTReader::finishPendingActions() { SetGloballyVisibleDecls(II, DeclIDs, &TopLevelDecls[II]); } + // Load each function type that we deferred loading because it was a + // deduced type that might refer to a local type declared within itself. + for (unsigned I = 0; I != PendingFunctionTypes.size(); ++I) { + auto *FD = PendingFunctionTypes[I].first; + FD->setType(GetType(PendingFunctionTypes[I].second)); + + // If we gave a function a deduced return type, remember that we need to + // propagate that along the redeclaration chain. + auto *DT = FD->getReturnType()->getContainedDeducedType(); + if (DT && DT->isDeduced()) + PendingDeducedTypeUpdates.insert( + {FD->getCanonicalDecl(), FD->getReturnType()}); + } + PendingFunctionTypes.clear(); + // For each decl chain that we wanted to complete while deserializing, mark // it as "still needs to be completed". for (unsigned I = 0; I != PendingIncompleteDeclChains.size(); ++I) { @@ -9282,7 +9284,8 @@ void ASTReader::finishPendingActions() { // Load pending declaration chains. for (unsigned I = 0; I != PendingDeclChains.size(); ++I) - loadPendingDeclChain(PendingDeclChains[I].first, PendingDeclChains[I].second); + loadPendingDeclChain(PendingDeclChains[I].first, + PendingDeclChains[I].second); PendingDeclChains.clear(); // Make the most recent of the top-level declarations visible. @@ -9677,8 +9680,8 @@ void ASTReader::diagnoseOdrViolations() { unsigned NumBases = DD->NumBases; if (NumBases == 0) return SourceRange(); auto bases = DD->bases(); - return SourceRange(bases[0].getLocStart(), - bases[NumBases - 1].getLocEnd()); + return SourceRange(bases[0].getBeginLoc(), + bases[NumBases - 1].getEndLoc()); }; if (FirstNumBases != SecondNumBases) { @@ -10179,10 +10182,10 @@ void ASTReader::diagnoseOdrViolations() { unsigned FirstODRHash = ComputeODRHash(FirstExpr); unsigned SecondODRHash = ComputeODRHash(SecondExpr); if (FirstODRHash != SecondODRHash) { - ODRDiagError(FirstExpr->getLocStart(), FirstExpr->getSourceRange(), + ODRDiagError(FirstExpr->getBeginLoc(), FirstExpr->getSourceRange(), StaticAssertCondition); - ODRDiagNote(SecondExpr->getLocStart(), - SecondExpr->getSourceRange(), StaticAssertCondition); + ODRDiagNote(SecondExpr->getBeginLoc(), SecondExpr->getSourceRange(), + StaticAssertCondition); Diagnosed = true; break; } @@ -10194,17 +10197,17 @@ void ASTReader::diagnoseOdrViolations() { SourceLocation FirstLoc, SecondLoc; SourceRange FirstRange, SecondRange; if (FirstStr) { - FirstLoc = FirstStr->getLocStart(); + FirstLoc = FirstStr->getBeginLoc(); FirstRange = FirstStr->getSourceRange(); } else { - FirstLoc = FirstSA->getLocStart(); + FirstLoc = FirstSA->getBeginLoc(); FirstRange = FirstSA->getSourceRange(); } if (SecondStr) { - SecondLoc = SecondStr->getLocStart(); + SecondLoc = SecondStr->getBeginLoc(); SecondRange = SecondStr->getSourceRange(); } else { - SecondLoc = SecondSA->getLocStart(); + SecondLoc = SecondSA->getBeginLoc(); SecondRange = SecondSA->getSourceRange(); } ODRDiagError(FirstLoc, FirstRange, StaticAssertOnlyMessage) @@ -10217,9 +10220,9 @@ void ASTReader::diagnoseOdrViolations() { if (FirstStr && SecondStr && FirstStr->getString() != SecondStr->getString()) { - ODRDiagError(FirstStr->getLocStart(), FirstStr->getSourceRange(), + ODRDiagError(FirstStr->getBeginLoc(), FirstStr->getSourceRange(), StaticAssertMessage); - ODRDiagNote(SecondStr->getLocStart(), SecondStr->getSourceRange(), + ODRDiagNote(SecondStr->getBeginLoc(), SecondStr->getSourceRange(), StaticAssertMessage); Diagnosed = true; break; @@ -11531,11 +11534,16 @@ void ASTReader::FinishedDeserializing() { --NumCurrentElementsDeserializing; if (NumCurrentElementsDeserializing == 0) { - // Propagate exception specification updates along redeclaration chains. - while (!PendingExceptionSpecUpdates.empty()) { - auto Updates = std::move(PendingExceptionSpecUpdates); + // Propagate exception specification and deduced type updates along + // redeclaration chains. + // + // We do this now rather than in finishPendingActions because we want to + // be able to walk the complete redeclaration chains of the updated decls. + while (!PendingExceptionSpecUpdates.empty() || + !PendingDeducedTypeUpdates.empty()) { + auto ESUpdates = std::move(PendingExceptionSpecUpdates); PendingExceptionSpecUpdates.clear(); - for (auto Update : Updates) { + for (auto Update : ESUpdates) { ProcessingUpdatesRAIIObj ProcessingUpdates(*this); auto *FPT = Update.second->getType()->castAs<FunctionProtoType>(); auto ESI = FPT->getExtProtoInfo().ExceptionSpec; @@ -11544,6 +11552,15 @@ void ASTReader::FinishedDeserializing() { for (auto *Redecl : Update.second->redecls()) getContext().adjustExceptionSpec(cast<FunctionDecl>(Redecl), ESI); } + + auto DTUpdates = std::move(PendingDeducedTypeUpdates); + PendingDeducedTypeUpdates.clear(); + for (auto Update : DTUpdates) { + ProcessingUpdatesRAIIObj ProcessingUpdates(*this); + // FIXME: If the return type is already deduced, check that it matches. + getContext().adjustDeducedFunctionResultType(Update.first, + Update.second); + } } if (ReadTimer) @@ -11637,3 +11654,910 @@ unsigned ASTRecordReader::readRecord(llvm::BitstreamCursor &Cursor, Record.clear(); return Cursor.readRecord(AbbrevID, Record); } +//===----------------------------------------------------------------------===// +//// OMPClauseReader implementation +////===----------------------------------------------------------------------===// + +OMPClause *OMPClauseReader::readClause() { + OMPClause *C; + switch (Record.readInt()) { + case OMPC_if: + C = new (Context) OMPIfClause(); + break; + case OMPC_final: + C = new (Context) OMPFinalClause(); + break; + case OMPC_num_threads: + C = new (Context) OMPNumThreadsClause(); + break; + case OMPC_safelen: + C = new (Context) OMPSafelenClause(); + break; + case OMPC_simdlen: + C = new (Context) OMPSimdlenClause(); + break; + case OMPC_collapse: + C = new (Context) OMPCollapseClause(); + break; + case OMPC_default: + C = new (Context) OMPDefaultClause(); + break; + case OMPC_proc_bind: + C = new (Context) OMPProcBindClause(); + break; + case OMPC_schedule: + C = new (Context) OMPScheduleClause(); + break; + case OMPC_ordered: + C = OMPOrderedClause::CreateEmpty(Context, Record.readInt()); + break; + case OMPC_nowait: + C = new (Context) OMPNowaitClause(); + break; + case OMPC_untied: + C = new (Context) OMPUntiedClause(); + break; + case OMPC_mergeable: + C = new (Context) OMPMergeableClause(); + break; + case OMPC_read: + C = new (Context) OMPReadClause(); + break; + case OMPC_write: + C = new (Context) OMPWriteClause(); + break; + case OMPC_update: + C = new (Context) OMPUpdateClause(); + break; + case OMPC_capture: + C = new (Context) OMPCaptureClause(); + break; + case OMPC_seq_cst: + C = new (Context) OMPSeqCstClause(); + break; + case OMPC_threads: + C = new (Context) OMPThreadsClause(); + break; + case OMPC_simd: + C = new (Context) OMPSIMDClause(); + break; + case OMPC_nogroup: + C = new (Context) OMPNogroupClause(); + break; + case OMPC_unified_address: + C = new (Context) OMPUnifiedAddressClause(); + break; + case OMPC_unified_shared_memory: + C = new (Context) OMPUnifiedSharedMemoryClause(); + break; + case OMPC_reverse_offload: + C = new (Context) OMPReverseOffloadClause(); + break; + case OMPC_dynamic_allocators: + C = new (Context) OMPDynamicAllocatorsClause(); + break; + case OMPC_atomic_default_mem_order: + C = new (Context) OMPAtomicDefaultMemOrderClause(); + break; + case OMPC_private: + C = OMPPrivateClause::CreateEmpty(Context, Record.readInt()); + break; + case OMPC_firstprivate: + C = OMPFirstprivateClause::CreateEmpty(Context, Record.readInt()); + break; + case OMPC_lastprivate: + C = OMPLastprivateClause::CreateEmpty(Context, Record.readInt()); + break; + case OMPC_shared: + C = OMPSharedClause::CreateEmpty(Context, Record.readInt()); + break; + case OMPC_reduction: + C = OMPReductionClause::CreateEmpty(Context, Record.readInt()); + break; + case OMPC_task_reduction: + C = OMPTaskReductionClause::CreateEmpty(Context, Record.readInt()); + break; + case OMPC_in_reduction: + C = OMPInReductionClause::CreateEmpty(Context, Record.readInt()); + break; + case OMPC_linear: + C = OMPLinearClause::CreateEmpty(Context, Record.readInt()); + break; + case OMPC_aligned: + C = OMPAlignedClause::CreateEmpty(Context, Record.readInt()); + break; + case OMPC_copyin: + C = OMPCopyinClause::CreateEmpty(Context, Record.readInt()); + break; + case OMPC_copyprivate: + C = OMPCopyprivateClause::CreateEmpty(Context, Record.readInt()); + break; + case OMPC_flush: + C = OMPFlushClause::CreateEmpty(Context, Record.readInt()); + break; + case OMPC_depend: { + unsigned NumVars = Record.readInt(); + unsigned NumLoops = Record.readInt(); + C = OMPDependClause::CreateEmpty(Context, NumVars, NumLoops); + break; + } + case OMPC_device: + C = new (Context) OMPDeviceClause(); + break; + case OMPC_map: { + unsigned NumVars = Record.readInt(); + unsigned NumDeclarations = Record.readInt(); + unsigned NumLists = Record.readInt(); + unsigned NumComponents = Record.readInt(); + C = OMPMapClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, + NumComponents); + break; + } + case OMPC_num_teams: + C = new (Context) OMPNumTeamsClause(); + break; + case OMPC_thread_limit: + C = new (Context) OMPThreadLimitClause(); + break; + case OMPC_priority: + C = new (Context) OMPPriorityClause(); + break; + case OMPC_grainsize: + C = new (Context) OMPGrainsizeClause(); + break; + case OMPC_num_tasks: + C = new (Context) OMPNumTasksClause(); + break; + case OMPC_hint: + C = new (Context) OMPHintClause(); + break; + case OMPC_dist_schedule: + C = new (Context) OMPDistScheduleClause(); + break; + case OMPC_defaultmap: + C = new (Context) OMPDefaultmapClause(); + break; + case OMPC_to: { + unsigned NumVars = Record.readInt(); + unsigned NumDeclarations = Record.readInt(); + unsigned NumLists = Record.readInt(); + unsigned NumComponents = Record.readInt(); + C = OMPToClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, + NumComponents); + break; + } + case OMPC_from: { + unsigned NumVars = Record.readInt(); + unsigned NumDeclarations = Record.readInt(); + unsigned NumLists = Record.readInt(); + unsigned NumComponents = Record.readInt(); + C = OMPFromClause::CreateEmpty(Context, NumVars, NumDeclarations, NumLists, + NumComponents); + break; + } + case OMPC_use_device_ptr: { + unsigned NumVars = Record.readInt(); + unsigned NumDeclarations = Record.readInt(); + unsigned NumLists = Record.readInt(); + unsigned NumComponents = Record.readInt(); + C = OMPUseDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations, + NumLists, NumComponents); + break; + } + case OMPC_is_device_ptr: { + unsigned NumVars = Record.readInt(); + unsigned NumDeclarations = Record.readInt(); + unsigned NumLists = Record.readInt(); + unsigned NumComponents = Record.readInt(); + C = OMPIsDevicePtrClause::CreateEmpty(Context, NumVars, NumDeclarations, + NumLists, NumComponents); + break; + } + } + Visit(C); + C->setLocStart(Record.readSourceLocation()); + C->setLocEnd(Record.readSourceLocation()); + + return C; +} + +void OMPClauseReader::VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C) { + C->setPreInitStmt(Record.readSubStmt(), + static_cast<OpenMPDirectiveKind>(Record.readInt())); +} + +void OMPClauseReader::VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C) { + VisitOMPClauseWithPreInit(C); + C->setPostUpdateExpr(Record.readSubExpr()); +} + +void OMPClauseReader::VisitOMPIfClause(OMPIfClause *C) { + VisitOMPClauseWithPreInit(C); + C->setNameModifier(static_cast<OpenMPDirectiveKind>(Record.readInt())); + C->setNameModifierLoc(Record.readSourceLocation()); + C->setColonLoc(Record.readSourceLocation()); + C->setCondition(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPFinalClause(OMPFinalClause *C) { + C->setCondition(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPNumThreadsClause(OMPNumThreadsClause *C) { + VisitOMPClauseWithPreInit(C); + C->setNumThreads(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPSafelenClause(OMPSafelenClause *C) { + C->setSafelen(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPSimdlenClause(OMPSimdlenClause *C) { + C->setSimdlen(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPCollapseClause(OMPCollapseClause *C) { + C->setNumForLoops(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPDefaultClause(OMPDefaultClause *C) { + C->setDefaultKind( + static_cast<OpenMPDefaultClauseKind>(Record.readInt())); + C->setLParenLoc(Record.readSourceLocation()); + C->setDefaultKindKwLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPProcBindClause(OMPProcBindClause *C) { + C->setProcBindKind( + static_cast<OpenMPProcBindClauseKind>(Record.readInt())); + C->setLParenLoc(Record.readSourceLocation()); + C->setProcBindKindKwLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPScheduleClause(OMPScheduleClause *C) { + VisitOMPClauseWithPreInit(C); + C->setScheduleKind( + static_cast<OpenMPScheduleClauseKind>(Record.readInt())); + C->setFirstScheduleModifier( + static_cast<OpenMPScheduleClauseModifier>(Record.readInt())); + C->setSecondScheduleModifier( + static_cast<OpenMPScheduleClauseModifier>(Record.readInt())); + C->setChunkSize(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); + C->setFirstScheduleModifierLoc(Record.readSourceLocation()); + C->setSecondScheduleModifierLoc(Record.readSourceLocation()); + C->setScheduleKindLoc(Record.readSourceLocation()); + C->setCommaLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPOrderedClause(OMPOrderedClause *C) { + C->setNumForLoops(Record.readSubExpr()); + for (unsigned I = 0, E = C->NumberOfLoops; I < E; ++I) + C->setLoopNumIterations(I, Record.readSubExpr()); + for (unsigned I = 0, E = C->NumberOfLoops; I < E; ++I) + C->setLoopCounter(I, Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPNowaitClause(OMPNowaitClause *) {} + +void OMPClauseReader::VisitOMPUntiedClause(OMPUntiedClause *) {} + +void OMPClauseReader::VisitOMPMergeableClause(OMPMergeableClause *) {} + +void OMPClauseReader::VisitOMPReadClause(OMPReadClause *) {} + +void OMPClauseReader::VisitOMPWriteClause(OMPWriteClause *) {} + +void OMPClauseReader::VisitOMPUpdateClause(OMPUpdateClause *) {} + +void OMPClauseReader::VisitOMPCaptureClause(OMPCaptureClause *) {} + +void OMPClauseReader::VisitOMPSeqCstClause(OMPSeqCstClause *) {} + +void OMPClauseReader::VisitOMPThreadsClause(OMPThreadsClause *) {} + +void OMPClauseReader::VisitOMPSIMDClause(OMPSIMDClause *) {} + +void OMPClauseReader::VisitOMPNogroupClause(OMPNogroupClause *) {} + +void OMPClauseReader::VisitOMPUnifiedAddressClause(OMPUnifiedAddressClause *) {} + +void OMPClauseReader::VisitOMPUnifiedSharedMemoryClause( + OMPUnifiedSharedMemoryClause *) {} + +void OMPClauseReader::VisitOMPReverseOffloadClause(OMPReverseOffloadClause *) {} + +void +OMPClauseReader::VisitOMPDynamicAllocatorsClause(OMPDynamicAllocatorsClause *) { +} + +void OMPClauseReader::VisitOMPAtomicDefaultMemOrderClause( + OMPAtomicDefaultMemOrderClause *C) { + C->setAtomicDefaultMemOrderKind( + static_cast<OpenMPAtomicDefaultMemOrderClauseKind>(Record.readInt())); + C->setLParenLoc(Record.readSourceLocation()); + C->setAtomicDefaultMemOrderKindKwLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPPrivateClause(OMPPrivateClause *C) { + C->setLParenLoc(Record.readSourceLocation()); + unsigned NumVars = C->varlist_size(); + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setPrivateCopies(Vars); +} + +void OMPClauseReader::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) { + VisitOMPClauseWithPreInit(C); + C->setLParenLoc(Record.readSourceLocation()); + unsigned NumVars = C->varlist_size(); + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setPrivateCopies(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setInits(Vars); +} + +void OMPClauseReader::VisitOMPLastprivateClause(OMPLastprivateClause *C) { + VisitOMPClauseWithPostUpdate(C); + C->setLParenLoc(Record.readSourceLocation()); + unsigned NumVars = C->varlist_size(); + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setPrivateCopies(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setSourceExprs(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setDestinationExprs(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setAssignmentOps(Vars); +} + +void OMPClauseReader::VisitOMPSharedClause(OMPSharedClause *C) { + C->setLParenLoc(Record.readSourceLocation()); + unsigned NumVars = C->varlist_size(); + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); +} + +void OMPClauseReader::VisitOMPReductionClause(OMPReductionClause *C) { + VisitOMPClauseWithPostUpdate(C); + C->setLParenLoc(Record.readSourceLocation()); + C->setColonLoc(Record.readSourceLocation()); + NestedNameSpecifierLoc NNSL = Record.readNestedNameSpecifierLoc(); + DeclarationNameInfo DNI; + Record.readDeclarationNameInfo(DNI); + C->setQualifierLoc(NNSL); + C->setNameInfo(DNI); + + unsigned NumVars = C->varlist_size(); + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setPrivates(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setLHSExprs(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setRHSExprs(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setReductionOps(Vars); +} + +void OMPClauseReader::VisitOMPTaskReductionClause(OMPTaskReductionClause *C) { + VisitOMPClauseWithPostUpdate(C); + C->setLParenLoc(Record.readSourceLocation()); + C->setColonLoc(Record.readSourceLocation()); + NestedNameSpecifierLoc NNSL = Record.readNestedNameSpecifierLoc(); + DeclarationNameInfo DNI; + Record.readDeclarationNameInfo(DNI); + C->setQualifierLoc(NNSL); + C->setNameInfo(DNI); + + unsigned NumVars = C->varlist_size(); + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned I = 0; I != NumVars; ++I) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + Vars.clear(); + for (unsigned I = 0; I != NumVars; ++I) + Vars.push_back(Record.readSubExpr()); + C->setPrivates(Vars); + Vars.clear(); + for (unsigned I = 0; I != NumVars; ++I) + Vars.push_back(Record.readSubExpr()); + C->setLHSExprs(Vars); + Vars.clear(); + for (unsigned I = 0; I != NumVars; ++I) + Vars.push_back(Record.readSubExpr()); + C->setRHSExprs(Vars); + Vars.clear(); + for (unsigned I = 0; I != NumVars; ++I) + Vars.push_back(Record.readSubExpr()); + C->setReductionOps(Vars); +} + +void OMPClauseReader::VisitOMPInReductionClause(OMPInReductionClause *C) { + VisitOMPClauseWithPostUpdate(C); + C->setLParenLoc(Record.readSourceLocation()); + C->setColonLoc(Record.readSourceLocation()); + NestedNameSpecifierLoc NNSL = Record.readNestedNameSpecifierLoc(); + DeclarationNameInfo DNI; + Record.readDeclarationNameInfo(DNI); + C->setQualifierLoc(NNSL); + C->setNameInfo(DNI); + + unsigned NumVars = C->varlist_size(); + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned I = 0; I != NumVars; ++I) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + Vars.clear(); + for (unsigned I = 0; I != NumVars; ++I) + Vars.push_back(Record.readSubExpr()); + C->setPrivates(Vars); + Vars.clear(); + for (unsigned I = 0; I != NumVars; ++I) + Vars.push_back(Record.readSubExpr()); + C->setLHSExprs(Vars); + Vars.clear(); + for (unsigned I = 0; I != NumVars; ++I) + Vars.push_back(Record.readSubExpr()); + C->setRHSExprs(Vars); + Vars.clear(); + for (unsigned I = 0; I != NumVars; ++I) + Vars.push_back(Record.readSubExpr()); + C->setReductionOps(Vars); + Vars.clear(); + for (unsigned I = 0; I != NumVars; ++I) + Vars.push_back(Record.readSubExpr()); + C->setTaskgroupDescriptors(Vars); +} + +void OMPClauseReader::VisitOMPLinearClause(OMPLinearClause *C) { + VisitOMPClauseWithPostUpdate(C); + C->setLParenLoc(Record.readSourceLocation()); + C->setColonLoc(Record.readSourceLocation()); + C->setModifier(static_cast<OpenMPLinearClauseKind>(Record.readInt())); + C->setModifierLoc(Record.readSourceLocation()); + unsigned NumVars = C->varlist_size(); + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setPrivates(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setInits(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setUpdates(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setFinals(Vars); + C->setStep(Record.readSubExpr()); + C->setCalcStep(Record.readSubExpr()); +} + +void OMPClauseReader::VisitOMPAlignedClause(OMPAlignedClause *C) { + C->setLParenLoc(Record.readSourceLocation()); + C->setColonLoc(Record.readSourceLocation()); + unsigned NumVars = C->varlist_size(); + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + C->setAlignment(Record.readSubExpr()); +} + +void OMPClauseReader::VisitOMPCopyinClause(OMPCopyinClause *C) { + C->setLParenLoc(Record.readSourceLocation()); + unsigned NumVars = C->varlist_size(); + SmallVector<Expr *, 16> Exprs; + Exprs.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Exprs.push_back(Record.readSubExpr()); + C->setVarRefs(Exprs); + Exprs.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Exprs.push_back(Record.readSubExpr()); + C->setSourceExprs(Exprs); + Exprs.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Exprs.push_back(Record.readSubExpr()); + C->setDestinationExprs(Exprs); + Exprs.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Exprs.push_back(Record.readSubExpr()); + C->setAssignmentOps(Exprs); +} + +void OMPClauseReader::VisitOMPCopyprivateClause(OMPCopyprivateClause *C) { + C->setLParenLoc(Record.readSourceLocation()); + unsigned NumVars = C->varlist_size(); + SmallVector<Expr *, 16> Exprs; + Exprs.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Exprs.push_back(Record.readSubExpr()); + C->setVarRefs(Exprs); + Exprs.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Exprs.push_back(Record.readSubExpr()); + C->setSourceExprs(Exprs); + Exprs.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Exprs.push_back(Record.readSubExpr()); + C->setDestinationExprs(Exprs); + Exprs.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Exprs.push_back(Record.readSubExpr()); + C->setAssignmentOps(Exprs); +} + +void OMPClauseReader::VisitOMPFlushClause(OMPFlushClause *C) { + C->setLParenLoc(Record.readSourceLocation()); + unsigned NumVars = C->varlist_size(); + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); +} + +void OMPClauseReader::VisitOMPDependClause(OMPDependClause *C) { + C->setLParenLoc(Record.readSourceLocation()); + C->setDependencyKind( + static_cast<OpenMPDependClauseKind>(Record.readInt())); + C->setDependencyLoc(Record.readSourceLocation()); + C->setColonLoc(Record.readSourceLocation()); + unsigned NumVars = C->varlist_size(); + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned I = 0; I != NumVars; ++I) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + for (unsigned I = 0, E = C->getNumLoops(); I < E; ++I) + C->setLoopData(I, Record.readSubExpr()); +} + +void OMPClauseReader::VisitOMPDeviceClause(OMPDeviceClause *C) { + VisitOMPClauseWithPreInit(C); + C->setDevice(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPMapClause(OMPMapClause *C) { + C->setLParenLoc(Record.readSourceLocation()); + for (unsigned I = 0; I < OMPMapClause::NumberOfModifiers; ++I) { + C->setMapTypeModifier( + I, static_cast<OpenMPMapModifierKind>(Record.readInt())); + C->setMapTypeModifierLoc(I, Record.readSourceLocation()); + } + C->setMapType( + static_cast<OpenMPMapClauseKind>(Record.readInt())); + C->setMapLoc(Record.readSourceLocation()); + C->setColonLoc(Record.readSourceLocation()); + auto NumVars = C->varlist_size(); + auto UniqueDecls = C->getUniqueDeclarationsNum(); + auto TotalLists = C->getTotalComponentListNum(); + auto TotalComponents = C->getTotalComponentsNum(); + + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + + SmallVector<ValueDecl *, 16> Decls; + Decls.reserve(UniqueDecls); + for (unsigned i = 0; i < UniqueDecls; ++i) + Decls.push_back(Record.readDeclAs<ValueDecl>()); + C->setUniqueDecls(Decls); + + SmallVector<unsigned, 16> ListsPerDecl; + ListsPerDecl.reserve(UniqueDecls); + for (unsigned i = 0; i < UniqueDecls; ++i) + ListsPerDecl.push_back(Record.readInt()); + C->setDeclNumLists(ListsPerDecl); + + SmallVector<unsigned, 32> ListSizes; + ListSizes.reserve(TotalLists); + for (unsigned i = 0; i < TotalLists; ++i) + ListSizes.push_back(Record.readInt()); + C->setComponentListSizes(ListSizes); + + SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; + Components.reserve(TotalComponents); + for (unsigned i = 0; i < TotalComponents; ++i) { + Expr *AssociatedExpr = Record.readSubExpr(); + auto *AssociatedDecl = Record.readDeclAs<ValueDecl>(); + Components.push_back(OMPClauseMappableExprCommon::MappableComponent( + AssociatedExpr, AssociatedDecl)); + } + C->setComponents(Components, ListSizes); +} + +void OMPClauseReader::VisitOMPNumTeamsClause(OMPNumTeamsClause *C) { + VisitOMPClauseWithPreInit(C); + C->setNumTeams(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPThreadLimitClause(OMPThreadLimitClause *C) { + VisitOMPClauseWithPreInit(C); + C->setThreadLimit(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPPriorityClause(OMPPriorityClause *C) { + C->setPriority(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPGrainsizeClause(OMPGrainsizeClause *C) { + C->setGrainsize(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPNumTasksClause(OMPNumTasksClause *C) { + C->setNumTasks(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPHintClause(OMPHintClause *C) { + C->setHint(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPDistScheduleClause(OMPDistScheduleClause *C) { + VisitOMPClauseWithPreInit(C); + C->setDistScheduleKind( + static_cast<OpenMPDistScheduleClauseKind>(Record.readInt())); + C->setChunkSize(Record.readSubExpr()); + C->setLParenLoc(Record.readSourceLocation()); + C->setDistScheduleKindLoc(Record.readSourceLocation()); + C->setCommaLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) { + C->setDefaultmapKind( + static_cast<OpenMPDefaultmapClauseKind>(Record.readInt())); + C->setDefaultmapModifier( + static_cast<OpenMPDefaultmapClauseModifier>(Record.readInt())); + C->setLParenLoc(Record.readSourceLocation()); + C->setDefaultmapModifierLoc(Record.readSourceLocation()); + C->setDefaultmapKindLoc(Record.readSourceLocation()); +} + +void OMPClauseReader::VisitOMPToClause(OMPToClause *C) { + C->setLParenLoc(Record.readSourceLocation()); + auto NumVars = C->varlist_size(); + auto UniqueDecls = C->getUniqueDeclarationsNum(); + auto TotalLists = C->getTotalComponentListNum(); + auto TotalComponents = C->getTotalComponentsNum(); + + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + + SmallVector<ValueDecl *, 16> Decls; + Decls.reserve(UniqueDecls); + for (unsigned i = 0; i < UniqueDecls; ++i) + Decls.push_back(Record.readDeclAs<ValueDecl>()); + C->setUniqueDecls(Decls); + + SmallVector<unsigned, 16> ListsPerDecl; + ListsPerDecl.reserve(UniqueDecls); + for (unsigned i = 0; i < UniqueDecls; ++i) + ListsPerDecl.push_back(Record.readInt()); + C->setDeclNumLists(ListsPerDecl); + + SmallVector<unsigned, 32> ListSizes; + ListSizes.reserve(TotalLists); + for (unsigned i = 0; i < TotalLists; ++i) + ListSizes.push_back(Record.readInt()); + C->setComponentListSizes(ListSizes); + + SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; + Components.reserve(TotalComponents); + for (unsigned i = 0; i < TotalComponents; ++i) { + Expr *AssociatedExpr = Record.readSubExpr(); + auto *AssociatedDecl = Record.readDeclAs<ValueDecl>(); + Components.push_back(OMPClauseMappableExprCommon::MappableComponent( + AssociatedExpr, AssociatedDecl)); + } + C->setComponents(Components, ListSizes); +} + +void OMPClauseReader::VisitOMPFromClause(OMPFromClause *C) { + C->setLParenLoc(Record.readSourceLocation()); + auto NumVars = C->varlist_size(); + auto UniqueDecls = C->getUniqueDeclarationsNum(); + auto TotalLists = C->getTotalComponentListNum(); + auto TotalComponents = C->getTotalComponentsNum(); + + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + + SmallVector<ValueDecl *, 16> Decls; + Decls.reserve(UniqueDecls); + for (unsigned i = 0; i < UniqueDecls; ++i) + Decls.push_back(Record.readDeclAs<ValueDecl>()); + C->setUniqueDecls(Decls); + + SmallVector<unsigned, 16> ListsPerDecl; + ListsPerDecl.reserve(UniqueDecls); + for (unsigned i = 0; i < UniqueDecls; ++i) + ListsPerDecl.push_back(Record.readInt()); + C->setDeclNumLists(ListsPerDecl); + + SmallVector<unsigned, 32> ListSizes; + ListSizes.reserve(TotalLists); + for (unsigned i = 0; i < TotalLists; ++i) + ListSizes.push_back(Record.readInt()); + C->setComponentListSizes(ListSizes); + + SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; + Components.reserve(TotalComponents); + for (unsigned i = 0; i < TotalComponents; ++i) { + Expr *AssociatedExpr = Record.readSubExpr(); + auto *AssociatedDecl = Record.readDeclAs<ValueDecl>(); + Components.push_back(OMPClauseMappableExprCommon::MappableComponent( + AssociatedExpr, AssociatedDecl)); + } + C->setComponents(Components, ListSizes); +} + +void OMPClauseReader::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *C) { + C->setLParenLoc(Record.readSourceLocation()); + auto NumVars = C->varlist_size(); + auto UniqueDecls = C->getUniqueDeclarationsNum(); + auto TotalLists = C->getTotalComponentListNum(); + auto TotalComponents = C->getTotalComponentsNum(); + + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setPrivateCopies(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setInits(Vars); + + SmallVector<ValueDecl *, 16> Decls; + Decls.reserve(UniqueDecls); + for (unsigned i = 0; i < UniqueDecls; ++i) + Decls.push_back(Record.readDeclAs<ValueDecl>()); + C->setUniqueDecls(Decls); + + SmallVector<unsigned, 16> ListsPerDecl; + ListsPerDecl.reserve(UniqueDecls); + for (unsigned i = 0; i < UniqueDecls; ++i) + ListsPerDecl.push_back(Record.readInt()); + C->setDeclNumLists(ListsPerDecl); + + SmallVector<unsigned, 32> ListSizes; + ListSizes.reserve(TotalLists); + for (unsigned i = 0; i < TotalLists; ++i) + ListSizes.push_back(Record.readInt()); + C->setComponentListSizes(ListSizes); + + SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; + Components.reserve(TotalComponents); + for (unsigned i = 0; i < TotalComponents; ++i) { + Expr *AssociatedExpr = Record.readSubExpr(); + auto *AssociatedDecl = Record.readDeclAs<ValueDecl>(); + Components.push_back(OMPClauseMappableExprCommon::MappableComponent( + AssociatedExpr, AssociatedDecl)); + } + C->setComponents(Components, ListSizes); +} + +void OMPClauseReader::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) { + C->setLParenLoc(Record.readSourceLocation()); + auto NumVars = C->varlist_size(); + auto UniqueDecls = C->getUniqueDeclarationsNum(); + auto TotalLists = C->getTotalComponentListNum(); + auto TotalComponents = C->getTotalComponentsNum(); + + SmallVector<Expr *, 16> Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Record.readSubExpr()); + C->setVarRefs(Vars); + Vars.clear(); + + SmallVector<ValueDecl *, 16> Decls; + Decls.reserve(UniqueDecls); + for (unsigned i = 0; i < UniqueDecls; ++i) + Decls.push_back(Record.readDeclAs<ValueDecl>()); + C->setUniqueDecls(Decls); + + SmallVector<unsigned, 16> ListsPerDecl; + ListsPerDecl.reserve(UniqueDecls); + for (unsigned i = 0; i < UniqueDecls; ++i) + ListsPerDecl.push_back(Record.readInt()); + C->setDeclNumLists(ListsPerDecl); + + SmallVector<unsigned, 32> ListSizes; + ListSizes.reserve(TotalLists); + for (unsigned i = 0; i < TotalLists; ++i) + ListSizes.push_back(Record.readInt()); + C->setComponentListSizes(ListSizes); + + SmallVector<OMPClauseMappableExprCommon::MappableComponent, 32> Components; + Components.reserve(TotalComponents); + for (unsigned i = 0; i < TotalComponents; ++i) { + Expr *AssociatedExpr = Record.readSubExpr(); + auto *AssociatedDecl = Record.readDeclAs<ValueDecl>(); + Components.push_back(OMPClauseMappableExprCommon::MappableComponent( + AssociatedExpr, AssociatedDecl)); + } + C->setComponents(Components, ListSizes); +} |