diff options
author | dim <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
commit | c86b984ea8ecb3e944dc3de48539f4c1f65851ea (patch) | |
tree | 3eb853da77d46cc77c4b017525a422f9ddb1385b /lib/Serialization/ASTWriterStmt.cpp | |
parent | c696171ff15f0ee60dea4abfd99a135473c95656 (diff) | |
download | FreeBSD-src-c86b984ea8ecb3e944dc3de48539f4c1f65851ea.zip FreeBSD-src-c86b984ea8ecb3e944dc3de48539f4c1f65851ea.tar.gz |
Vendor import of clang RELEASE_360/rc1 tag r226102 (effectively, 3.6.0 RC1):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/rc1@226102
Diffstat (limited to 'lib/Serialization/ASTWriterStmt.cpp')
-rw-r--r-- | lib/Serialization/ASTWriterStmt.cpp | 140 |
1 files changed, 124 insertions, 16 deletions
diff --git a/lib/Serialization/ASTWriterStmt.cpp b/lib/Serialization/ASTWriterStmt.cpp index a43b352..e980ce7 100644 --- a/lib/Serialization/ASTWriterStmt.cpp +++ b/lib/Serialization/ASTWriterStmt.cpp @@ -307,7 +307,7 @@ void ASTStmtWriter::VisitCapturedStmt(CapturedStmt *S) { // Captures for (const auto &I : S->captures()) { - if (I.capturesThis()) + if (I.capturesThis() || I.capturesVariableArrayType()) Writer.AddDeclRef(nullptr, Record); else Writer.AddDeclRef(I.getCapturedVar(), Record); @@ -333,6 +333,7 @@ void ASTStmtWriter::VisitPredefinedExpr(PredefinedExpr *E) { VisitExpr(E); Writer.AddSourceLocation(E->getLocation(), Record); Record.push_back(E->getIdentType()); // FIXME: stable encoding + Writer.AddStmt(E->getFunctionName()); Code = serialization::EXPR_PREDEFINED; } @@ -343,7 +344,7 @@ void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) { Record.push_back(E->getDecl() != E->getFoundDecl()); Record.push_back(E->hasTemplateKWAndArgsInfo()); Record.push_back(E->hadMultipleCandidates()); - Record.push_back(E->refersToEnclosingLocal()); + Record.push_back(E->refersToEnclosingVariableOrCapture()); if (E->hasTemplateKWAndArgsInfo()) { unsigned NumTemplateArgs = E->getNumTemplateArgs(); @@ -635,6 +636,10 @@ ASTStmtWriter::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) { void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) { VisitCastExpr(E); + + if (E->path_size() == 0) + AbbrevToUse = Writer.getExprImplicitCastAbbrev(); + Code = serialization::EXPR_IMPLICIT_CAST; } @@ -1574,6 +1579,17 @@ void ASTStmtWriter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) { Code = serialization::EXPR_MATERIALIZE_TEMPORARY; } +void ASTStmtWriter::VisitCXXFoldExpr(CXXFoldExpr *E) { + VisitExpr(E); + Writer.AddSourceLocation(E->LParenLoc, Record); + Writer.AddSourceLocation(E->EllipsisLoc, Record); + Writer.AddSourceLocation(E->RParenLoc, Record); + Writer.AddStmt(E->SubExprs[0]); + Writer.AddStmt(E->SubExprs[1]); + Record.push_back(E->Opcode); + Code = serialization::EXPR_CXX_FOLD; +} + void ASTStmtWriter::VisitOpaqueValueExpr(OpaqueValueExpr *E) { VisitExpr(E); Writer.AddStmt(E->getSourceExpr()); @@ -1581,6 +1597,12 @@ void ASTStmtWriter::VisitOpaqueValueExpr(OpaqueValueExpr *E) { Code = serialization::EXPR_OPAQUE_VALUE; } +void ASTStmtWriter::VisitTypoExpr(TypoExpr *E) { + VisitExpr(E); + // TODO: Figure out sane writer behavior for a TypoExpr, if necessary + assert(false && "Cannot write TypoExpr nodes"); +} + //===----------------------------------------------------------------------===// // CUDA Expressions and Statements. //===----------------------------------------------------------------------===// @@ -1735,18 +1757,39 @@ 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::VisitOMPPrivateClause(OMPPrivateClause *C) { Record.push_back(C->varlist_size()); Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record); - for (auto *VE : C->varlists()) + for (auto *VE : C->varlists()) { + Writer->Writer.AddStmt(VE); + } + for (auto *VE : C->private_copies()) { Writer->Writer.AddStmt(VE); + } } void OMPClauseWriter::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) { Record.push_back(C->varlist_size()); Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record); - for (auto *VE : C->varlists()) + for (auto *VE : C->varlists()) { + Writer->Writer.AddStmt(VE); + } + for (auto *VE : C->private_copies()) { + Writer->Writer.AddStmt(VE); + } + for (auto *VE : C->inits()) { Writer->Writer.AddStmt(VE); + } } void OMPClauseWriter::VisitOMPLastprivateClause(OMPLastprivateClause *C) { @@ -1826,29 +1869,61 @@ void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) { Writer.AddStmt(E->getAssociatedStmt()); } -void ASTStmtWriter::VisitOMPParallelDirective(OMPParallelDirective *D) { +void ASTStmtWriter::VisitOMPLoopDirective(OMPLoopDirective *D) { VisitStmt(D); Record.push_back(D->getNumClauses()); + Record.push_back(D->getCollapsedNumber()); VisitOMPExecutableDirective(D); - Code = serialization::STMT_OMP_PARALLEL_DIRECTIVE; + Writer.AddStmt(D->getIterationVariable()); + Writer.AddStmt(D->getLastIteration()); + Writer.AddStmt(D->getCalcLastIteration()); + Writer.AddStmt(D->getPreCond()); + Writer.AddStmt(D->getCond(/* SeparateIter */ false)); + Writer.AddStmt(D->getCond(/* SeparateIter */ true)); + Writer.AddStmt(D->getInit()); + Writer.AddStmt(D->getInc()); + if (isOpenMPWorksharingDirective(D->getDirectiveKind())) { + Writer.AddStmt(D->getIsLastIterVariable()); + Writer.AddStmt(D->getLowerBoundVariable()); + Writer.AddStmt(D->getUpperBoundVariable()); + Writer.AddStmt(D->getStrideVariable()); + Writer.AddStmt(D->getEnsureUpperBound()); + Writer.AddStmt(D->getNextLowerBound()); + Writer.AddStmt(D->getNextUpperBound()); + } + for (auto I : D->counters()) { + Writer.AddStmt(I); + } + for (auto I : D->updates()) { + Writer.AddStmt(I); + } + for (auto I : D->finals()) { + Writer.AddStmt(I); + } } -void ASTStmtWriter::VisitOMPSimdDirective(OMPSimdDirective *D) { +void ASTStmtWriter::VisitOMPParallelDirective(OMPParallelDirective *D) { VisitStmt(D); Record.push_back(D->getNumClauses()); - Record.push_back(D->getCollapsedNumber()); VisitOMPExecutableDirective(D); + Code = serialization::STMT_OMP_PARALLEL_DIRECTIVE; +} + +void ASTStmtWriter::VisitOMPSimdDirective(OMPSimdDirective *D) { + VisitOMPLoopDirective(D); Code = serialization::STMT_OMP_SIMD_DIRECTIVE; } void ASTStmtWriter::VisitOMPForDirective(OMPForDirective *D) { - VisitStmt(D); - Record.push_back(D->getNumClauses()); - Record.push_back(D->getCollapsedNumber()); - VisitOMPExecutableDirective(D); + VisitOMPLoopDirective(D); Code = serialization::STMT_OMP_FOR_DIRECTIVE; } +void ASTStmtWriter::VisitOMPForSimdDirective(OMPForSimdDirective *D) { + VisitOMPLoopDirective(D); + Code = serialization::STMT_OMP_FOR_SIMD_DIRECTIVE; +} + void ASTStmtWriter::VisitOMPSectionsDirective(OMPSectionsDirective *D) { VisitStmt(D); Record.push_back(D->getNumClauses()); @@ -1883,13 +1958,16 @@ void ASTStmtWriter::VisitOMPCriticalDirective(OMPCriticalDirective *D) { } void ASTStmtWriter::VisitOMPParallelForDirective(OMPParallelForDirective *D) { - VisitStmt(D); - Record.push_back(D->getNumClauses()); - Record.push_back(D->getCollapsedNumber()); - VisitOMPExecutableDirective(D); + VisitOMPLoopDirective(D); Code = serialization::STMT_OMP_PARALLEL_FOR_DIRECTIVE; } +void ASTStmtWriter::VisitOMPParallelForSimdDirective( + OMPParallelForSimdDirective *D) { + VisitOMPLoopDirective(D); + Code = serialization::STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE; +} + void ASTStmtWriter::VisitOMPParallelSectionsDirective( OMPParallelSectionsDirective *D) { VisitStmt(D); @@ -1905,6 +1983,23 @@ void ASTStmtWriter::VisitOMPTaskDirective(OMPTaskDirective *D) { Code = serialization::STMT_OMP_TASK_DIRECTIVE; } +void ASTStmtWriter::VisitOMPAtomicDirective(OMPAtomicDirective *D) { + VisitStmt(D); + Record.push_back(D->getNumClauses()); + VisitOMPExecutableDirective(D); + Writer.AddStmt(D->getX()); + Writer.AddStmt(D->getV()); + Writer.AddStmt(D->getExpr()); + Code = serialization::STMT_OMP_ATOMIC_DIRECTIVE; +} + +void ASTStmtWriter::VisitOMPTargetDirective(OMPTargetDirective *D) { + VisitStmt(D); + Record.push_back(D->getNumClauses()); + VisitOMPExecutableDirective(D); + Code = serialization::STMT_OMP_TARGET_DIRECTIVE; +} + void ASTStmtWriter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *D) { VisitStmt(D); VisitOMPExecutableDirective(D); @@ -1930,6 +2025,19 @@ void ASTStmtWriter::VisitOMPFlushDirective(OMPFlushDirective *D) { Code = serialization::STMT_OMP_FLUSH_DIRECTIVE; } +void ASTStmtWriter::VisitOMPOrderedDirective(OMPOrderedDirective *D) { + VisitStmt(D); + VisitOMPExecutableDirective(D); + Code = serialization::STMT_OMP_ORDERED_DIRECTIVE; +} + +void ASTStmtWriter::VisitOMPTeamsDirective(OMPTeamsDirective *D) { + VisitStmt(D); + Record.push_back(D->getNumClauses()); + VisitOMPExecutableDirective(D); + Code = serialization::STMT_OMP_TEAMS_DIRECTIVE; +} + //===----------------------------------------------------------------------===// // ASTWriter Implementation //===----------------------------------------------------------------------===// |