aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/StmtProfile.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:44:14 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:44:14 +0000
commit2b6b257f4e5503a7a2675bdb8735693db769f75c (patch)
treee85e046ae7003fe3bcc8b5454cd0fa3f7407b470 /lib/AST/StmtProfile.cpp
parentb4348ed0b7e90c0831b925fbee00b5f179a99796 (diff)
downloadsrc-2b6b257f4e5503a7a2675bdb8735693db769f75c.tar.gz
src-2b6b257f4e5503a7a2675bdb8735693db769f75c.zip
Vendor import of clang release_39 branch r276489:vendor/clang/clang-release_39-r276489
Notes
Notes: svn path=/vendor/clang/dist/; revision=303233 svn path=/vendor/clang/clang-release_39-r276489/; revision=303234; tag=vendor/clang/clang-release_39-r276489
Diffstat (limited to 'lib/AST/StmtProfile.cpp')
-rw-r--r--lib/AST/StmtProfile.cpp216
1 files changed, 171 insertions, 45 deletions
diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp
index 175a43abbf61..0a39413853a0 100644
--- a/lib/AST/StmtProfile.cpp
+++ b/lib/AST/StmtProfile.cpp
@@ -69,6 +69,7 @@ namespace {
}
void StmtProfiler::VisitStmt(const Stmt *S) {
+ assert(S && "Requires non-null Stmt pointer");
ID.AddInteger(S->getStmtClass());
for (const Stmt *SubStmt : S->children()) {
if (SubStmt)
@@ -268,8 +269,23 @@ public:
#define OPENMP_CLAUSE(Name, Class) \
void Visit##Class(const Class *C);
#include "clang/Basic/OpenMPKinds.def"
+ void VistOMPClauseWithPreInit(const OMPClauseWithPreInit *C);
+ void VistOMPClauseWithPostUpdate(const OMPClauseWithPostUpdate *C);
};
+void OMPClauseProfiler::VistOMPClauseWithPreInit(
+ const OMPClauseWithPreInit *C) {
+ if (auto *S = C->getPreInitStmt())
+ Profiler->VisitStmt(S);
+}
+
+void OMPClauseProfiler::VistOMPClauseWithPostUpdate(
+ const OMPClauseWithPostUpdate *C) {
+ VistOMPClauseWithPreInit(C);
+ if (auto *E = C->getPostUpdateExpr())
+ Profiler->VisitStmt(E);
+}
+
void OMPClauseProfiler::VisitOMPIfClause(const OMPIfClause *C) {
if (C->getCondition())
Profiler->VisitStmt(C->getCondition());
@@ -305,12 +321,9 @@ void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { }
void OMPClauseProfiler::VisitOMPProcBindClause(const OMPProcBindClause *C) { }
void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) {
- if (C->getChunkSize()) {
- Profiler->VisitStmt(C->getChunkSize());
- if (C->getHelperChunkSize()) {
- Profiler->VisitStmt(C->getChunkSize());
- }
- }
+ VistOMPClauseWithPreInit(C);
+ if (auto *S = C->getChunkSize())
+ Profiler->VisitStmt(S);
}
void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *C) {
@@ -343,37 +356,46 @@ void OMPClauseProfiler::VisitOMPNogroupClause(const OMPNogroupClause *) {}
template<typename T>
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
for (auto *E : Node->varlists()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
}
void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
VisitOMPClauseList(C);
for (auto *E : C->private_copies()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
}
void
OMPClauseProfiler::VisitOMPFirstprivateClause(const OMPFirstprivateClause *C) {
VisitOMPClauseList(C);
+ VistOMPClauseWithPreInit(C);
for (auto *E : C->private_copies()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
for (auto *E : C->inits()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
}
void
OMPClauseProfiler::VisitOMPLastprivateClause(const OMPLastprivateClause *C) {
VisitOMPClauseList(C);
+ VistOMPClauseWithPostUpdate(C);
for (auto *E : C->source_exprs()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
for (auto *E : C->destination_exprs()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
for (auto *E : C->assignment_ops()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
}
void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) {
@@ -385,63 +407,82 @@ void OMPClauseProfiler::VisitOMPReductionClause(
C->getQualifierLoc().getNestedNameSpecifier());
Profiler->VisitName(C->getNameInfo().getName());
VisitOMPClauseList(C);
+ VistOMPClauseWithPostUpdate(C);
for (auto *E : C->privates()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
for (auto *E : C->lhs_exprs()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
for (auto *E : C->rhs_exprs()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
for (auto *E : C->reduction_ops()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
}
void OMPClauseProfiler::VisitOMPLinearClause(const OMPLinearClause *C) {
VisitOMPClauseList(C);
+ VistOMPClauseWithPostUpdate(C);
for (auto *E : C->privates()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
for (auto *E : C->inits()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
for (auto *E : C->updates()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
for (auto *E : C->finals()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
- Profiler->VisitStmt(C->getStep());
- Profiler->VisitStmt(C->getCalcStep());
+ if (C->getStep())
+ Profiler->VisitStmt(C->getStep());
+ if (C->getCalcStep())
+ Profiler->VisitStmt(C->getCalcStep());
}
void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) {
VisitOMPClauseList(C);
- Profiler->VisitStmt(C->getAlignment());
+ if (C->getAlignment())
+ Profiler->VisitStmt(C->getAlignment());
}
void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) {
VisitOMPClauseList(C);
for (auto *E : C->source_exprs()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
for (auto *E : C->destination_exprs()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
for (auto *E : C->assignment_ops()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
}
void
OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) {
VisitOMPClauseList(C);
for (auto *E : C->source_exprs()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
for (auto *E : C->destination_exprs()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
for (auto *E : C->assignment_ops()) {
- Profiler->VisitStmt(E);
+ if (E)
+ Profiler->VisitStmt(E);
}
}
void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) {
@@ -451,29 +492,50 @@ void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) {
VisitOMPClauseList(C);
}
void OMPClauseProfiler::VisitOMPDeviceClause(const OMPDeviceClause *C) {
- Profiler->VisitStmt(C->getDevice());
+ if (C->getDevice())
+ Profiler->VisitStmt(C->getDevice());
}
void OMPClauseProfiler::VisitOMPMapClause(const OMPMapClause *C) {
VisitOMPClauseList(C);
}
void OMPClauseProfiler::VisitOMPNumTeamsClause(const OMPNumTeamsClause *C) {
- Profiler->VisitStmt(C->getNumTeams());
+ if (C->getNumTeams())
+ Profiler->VisitStmt(C->getNumTeams());
}
void OMPClauseProfiler::VisitOMPThreadLimitClause(
const OMPThreadLimitClause *C) {
- Profiler->VisitStmt(C->getThreadLimit());
+ if (C->getThreadLimit())
+ Profiler->VisitStmt(C->getThreadLimit());
}
void OMPClauseProfiler::VisitOMPPriorityClause(const OMPPriorityClause *C) {
- Profiler->VisitStmt(C->getPriority());
+ if (C->getPriority())
+ Profiler->VisitStmt(C->getPriority());
}
void OMPClauseProfiler::VisitOMPGrainsizeClause(const OMPGrainsizeClause *C) {
- Profiler->VisitStmt(C->getGrainsize());
+ if (C->getGrainsize())
+ Profiler->VisitStmt(C->getGrainsize());
}
void OMPClauseProfiler::VisitOMPNumTasksClause(const OMPNumTasksClause *C) {
- Profiler->VisitStmt(C->getNumTasks());
+ if (C->getNumTasks())
+ Profiler->VisitStmt(C->getNumTasks());
}
void OMPClauseProfiler::VisitOMPHintClause(const OMPHintClause *C) {
- Profiler->VisitStmt(C->getHint());
+ if (C->getHint())
+ Profiler->VisitStmt(C->getHint());
+}
+void OMPClauseProfiler::VisitOMPToClause(const OMPToClause *C) {
+ VisitOMPClauseList(C);
+}
+void OMPClauseProfiler::VisitOMPFromClause(const OMPFromClause *C) {
+ VisitOMPClauseList(C);
+}
+void OMPClauseProfiler::VisitOMPUseDevicePtrClause(
+ const OMPUseDevicePtrClause *C) {
+ VisitOMPClauseList(C);
+}
+void OMPClauseProfiler::VisitOMPIsDevicePtrClause(
+ const OMPIsDevicePtrClause *C) {
+ VisitOMPClauseList(C);
}
}
@@ -584,6 +646,26 @@ void StmtProfiler::VisitOMPTargetDataDirective(const OMPTargetDataDirective *S)
VisitOMPExecutableDirective(S);
}
+void StmtProfiler::VisitOMPTargetEnterDataDirective(
+ const OMPTargetEnterDataDirective *S) {
+ VisitOMPExecutableDirective(S);
+}
+
+void StmtProfiler::VisitOMPTargetExitDataDirective(
+ const OMPTargetExitDataDirective *S) {
+ VisitOMPExecutableDirective(S);
+}
+
+void StmtProfiler::VisitOMPTargetParallelDirective(
+ const OMPTargetParallelDirective *S) {
+ VisitOMPExecutableDirective(S);
+}
+
+void StmtProfiler::VisitOMPTargetParallelForDirective(
+ const OMPTargetParallelForDirective *S) {
+ VisitOMPExecutableDirective(S);
+}
+
void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) {
VisitOMPExecutableDirective(S);
}
@@ -611,6 +693,40 @@ void StmtProfiler::VisitOMPDistributeDirective(
VisitOMPLoopDirective(S);
}
+void OMPClauseProfiler::VisitOMPDistScheduleClause(
+ const OMPDistScheduleClause *C) {
+ VistOMPClauseWithPreInit(C);
+ if (auto *S = C->getChunkSize())
+ Profiler->VisitStmt(S);
+}
+
+void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {}
+
+void StmtProfiler::VisitOMPTargetUpdateDirective(
+ const OMPTargetUpdateDirective *S) {
+ VisitOMPExecutableDirective(S);
+}
+
+void StmtProfiler::VisitOMPDistributeParallelForDirective(
+ const OMPDistributeParallelForDirective *S) {
+ VisitOMPLoopDirective(S);
+}
+
+void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
+ const OMPDistributeParallelForSimdDirective *S) {
+ VisitOMPLoopDirective(S);
+}
+
+void StmtProfiler::VisitOMPDistributeSimdDirective(
+ const OMPDistributeSimdDirective *S) {
+ VisitOMPLoopDirective(S);
+}
+
+void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
+ const OMPTargetParallelForSimdDirective *S) {
+ VisitOMPLoopDirective(S);
+}
+
void StmtProfiler::VisitExpr(const Expr *S) {
VisitStmt(S);
}
@@ -810,22 +926,20 @@ void StmtProfiler::VisitInitListExpr(const InitListExpr *S) {
void StmtProfiler::VisitDesignatedInitExpr(const DesignatedInitExpr *S) {
VisitExpr(S);
ID.AddBoolean(S->usesGNUSyntax());
- for (DesignatedInitExpr::const_designators_iterator D =
- S->designators_begin(), DEnd = S->designators_end();
- D != DEnd; ++D) {
- if (D->isFieldDesignator()) {
+ for (const DesignatedInitExpr::Designator &D : S->designators()) {
+ if (D.isFieldDesignator()) {
ID.AddInteger(0);
- VisitName(D->getFieldName());
+ VisitName(D.getFieldName());
continue;
}
- if (D->isArrayDesignator()) {
+ if (D.isArrayDesignator()) {
ID.AddInteger(1);
} else {
- assert(D->isArrayRangeDesignator());
+ assert(D.isArrayRangeDesignator());
ID.AddInteger(2);
}
- ID.AddInteger(D->getFirstExprIndex());
+ ID.AddInteger(D.getFirstExprIndex());
}
}
@@ -1196,6 +1310,12 @@ void StmtProfiler::VisitCXXConstructExpr(const CXXConstructExpr *S) {
ID.AddBoolean(S->isElidable());
}
+void StmtProfiler::VisitCXXInheritedCtorInitExpr(
+ const CXXInheritedCtorInitExpr *S) {
+ VisitExpr(S);
+ VisitDecl(S->getConstructor());
+}
+
void StmtProfiler::VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *S) {
VisitExplicitCastExpr(S);
}
@@ -1213,6 +1333,7 @@ StmtProfiler::VisitLambdaExpr(const LambdaExpr *S) {
C != CEnd; ++C) {
ID.AddInteger(C->getCaptureKind());
switch (C->getCaptureKind()) {
+ case LCK_StarThis:
case LCK_This:
break;
case LCK_ByRef:
@@ -1511,6 +1632,11 @@ void StmtProfiler::VisitObjCBridgedCastExpr(const ObjCBridgedCastExpr *S) {
ID.AddBoolean(S->getBridgeKind());
}
+void StmtProfiler::VisitObjCAvailabilityCheckExpr(
+ const ObjCAvailabilityCheckExpr *S) {
+ VisitExpr(S);
+}
+
void StmtProfiler::VisitDecl(const Decl *D) {
ID.AddInteger(D? D->getKind() : 0);