[PATCH] OpenMP threadprivate directive

Alexey Bataev a.bataev at hotmail.com
Sun Mar 10 22:19:38 PDT 2013



================
Comment at: include/clang/Basic/DiagnosticParseKinds.td:775
@@ +774,3 @@
+def warn_omp_extra_tokens_at_eol : Warning <
+  "extra tokens at end of '#pragma omp %0' - ignored">,
+  InGroup<ExtraTokens>;
----------------
Doug Gregor wrote:
> Instead of "- ignored", I suggest "are ignored", which is more in line with other "ignored" diagnostics in Clang.
Fixed.

================
Comment at: lib/AST/DeclOpenMP.cpp:56
@@ +55,3 @@
+void OMPThreadPrivateDecl::setVars(ArrayRef<DeclRefExpr *> VL) {
+  assert((NumVars == 0 || VL.size() == NumVars) &&
+         "Number of variables is not the same as the preallocated buffer");
----------------
Doug Gregor wrote:
> Why the "NumVars == 0" case here? This would mean that VL could have some variable references in it, but when NumVars==0, those variable references would be silently dropped. 
Fixed.

================
Comment at: lib/AST/DeclOpenMP.cpp:58
@@ +57,3 @@
+         "Number of variables is not the same as the preallocated buffer");
+  if (NumVars > 0) {
+    DeclRefExpr **Vars = reinterpret_cast<DeclRefExpr **>(this + 1);
----------------
Doug Gregor wrote:
> We don't really need the "if" here. std::copy() can handle the 0 case fine.
Fixed.

================
Comment at: lib/Sema/SemaOpenMP.cpp:72
@@ +71,3 @@
+         << FixItHint::CreateReplacement(I->getLoc(), CorrectedStr);
+      continue;
+    }
----------------
Doug Gregor wrote:
> We shouldn't unconditionally continue here. If we've found a correction, we should set VD to that correction at proceed as if the user had written the name of VD.
Agree, fixed.

================
Comment at: lib/Sema/SemaOpenMP.cpp:148
@@ +147,3 @@
+    // OpenMP [2.9.2, Restrictions, C/C++, p.9]
+    //   The address of a threadprivate variable is not an address constant.
+    // OpenMP [2.9.2, Restrictions, C/C++, p.10]
----------------
Doug Gregor wrote:
> This citation shouldn't be here, because we're not checking this.
Removed.

================
Comment at: lib/Sema/SemaOpenMP.cpp:152
@@ +151,3 @@
+    if (VD->getType()->isReferenceType()) {
+      Diag(ILoc, diag::err_omp_ref_type_arg)
+        << getOpenMPDirectiveName(OMPD_threadprivate);
----------------
Doug Gregor wrote:
> Should this diagnostic include the type? It might not be obvious what the type is if it we're inside a template instantiation.
Added type to the error message


http://llvm-reviews.chandlerc.com/D356



More information about the cfe-commits mailing list