LGTM, but I do have a general request that you clean up iterating over clauses. 
 You can do that as a separate patch, but when you do, please go over all the 
existing uses of filtered_clause_iterator and try to take advantage of it.


================
Comment at: lib/CodeGen/CGStmtOpenMP.cpp:1227
@@ -1202,1 +1226,3 @@
+      I(S.clauses(), LastprivateFilter);
+  bool HasLastprivates = I;
   auto &&CodeGen = [Stmt, &S, &HasFirstprivates](CodeGenFunction &CGF) {
----------------
You construct iterators like this so often — and almost always with a single 
clause kind as the filter — that I think you should probably just add specific 
API for it on OMPExecutableDirective.  Something like

  template <Fn> filtered_clause_iterator<Fn> getFilteredClauses(Fn &&fn) const {
    return filtered_clause_iterator<Fn>(clauses(), std::move(fn));
  }

  struct ClauseKindFilter {
    OpenMPClauseKind Kind;
    bool operator()(const OMPClause *clause) const { return 
clause->getClauseKind() == Kind; }
  };
  filtered_clause_iterator<ClauseKindFilter> getClausesOfKind(OpenMPClauseKind 
kind) const {
    return getFilteredClauses(ClauseKindFilter{ kind });
  }

Also, the operator bool on filtered_clause_iterator should be explicit.

The upshot is that this entire block should turn into:
  bool HasLastprivates = !S.getClausesOfKind(OMPC_lastprivate).empty();

http://reviews.llvm.org/D9240

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to