case OMPC_threadprivate:
case OMPC_uniform:
case OMPC_device_type:
+ case OMPC_match:
case OMPC_unknown:
break;
}
#ifndef OPENMP_DEVICE_TYPE_KIND
#define OPENMP_DEVICE_TYPE_KIND(Name)
#endif
+#ifndef OPENMP_DECLARE_VARIANT_CLAUSE
+#define OPENMP_DECLARE_VARIANT_CLAUSE(Name)
+#endif
// OpenMP directives.
OPENMP_DIRECTIVE(threadprivate)
OPENMP_DEVICE_TYPE_KIND(nohost)
OPENMP_DEVICE_TYPE_KIND(any)
+// Clauses allowed for OpenMP directive 'declare variant'.
+OPENMP_DECLARE_VARIANT_CLAUSE(match)
+
+#undef OPENMP_DECLARE_VARIANT_CLAUSE
#undef OPENMP_DEVICE_TYPE_KIND
#undef OPENMP_ALLOCATE_CLAUSE
#undef OPENMP_DECLARE_MAPPER_CLAUSE
OMPC_threadprivate,
OMPC_uniform,
OMPC_device_type,
+ OMPC_match,
OMPC_unknown
};
case OMPC_threadprivate:
case OMPC_uniform:
case OMPC_device_type:
+ case OMPC_match:
case OMPC_unknown:
llvm_unreachable("unexpected OpenMP clause kind");
}
case OMPC_threadprivate:
case OMPC_uniform:
case OMPC_device_type:
+ case OMPC_match:
case OMPC_unknown:
break;
}
case OMPC_dynamic_allocators:
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
+ case OMPC_match:
break;
}
case OMPC_dynamic_allocators:
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
+ case OMPC_match:
break;
}
#include "clang/Basic/OpenMPKinds.def"
.Case("uniform", OMPC_uniform)
.Case("device_type", OMPC_device_type)
+ .Case("match", OMPC_match)
.Default(OMPC_unknown);
}
return "threadprivate or thread local";
case OMPC_device_type:
return "device_type";
+ case OMPC_match:
+ return "match";
}
llvm_unreachable("Invalid OpenMP clause kind");
}
case OMPC_unified_shared_memory:
case OMPC_reverse_offload:
case OMPC_dynamic_allocators:
+ case OMPC_match:
break;
}
llvm_unreachable("Invalid OpenMP simple clause kind");
case OMPC_unified_shared_memory:
case OMPC_reverse_offload:
case OMPC_dynamic_allocators:
+ case OMPC_match:
break;
}
llvm_unreachable("Invalid OpenMP simple clause kind");
#define OPENMP_ALLOCATE_CLAUSE(Name) \
case OMPC_##Name: \
return true;
+#include "clang/Basic/OpenMPKinds.def"
+ default:
+ break;
+ }
+ break;
+ case OMPD_declare_variant:
+ switch (CKind) {
+#define OPENMP_DECLARE_VARIANT_CLAUSE(Name) \
+ case OMPC_##Name: \
+ return true;
#include "clang/Basic/OpenMPKinds.def"
default:
break;
case OMPD_cancellation_point:
case OMPD_declare_reduction:
case OMPD_declare_simd:
- case OMPD_declare_variant:
break;
}
return false;
case OMPC_dynamic_allocators:
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
+ case OMPC_match:
llvm_unreachable("Clause is not allowed in 'omp atomic'.");
}
}
// Parse inner context selector set name.
if (!Tok.is(tok::identifier)) {
Diag(Tok.getLocation(), diag::err_omp_declare_variant_no_ctx_selector)
- << "match";
+ << getOpenMPClauseName(OMPC_match);
return true;
}
SmallString<16> Buffer;
Ptr, AssociatedFunction.get(), SourceRange(Loc, Tok.getLocation()));
// Parse 'match'.
- if (!Tok.is(tok::identifier) || PP.getSpelling(Tok).compare("match")) {
+ OpenMPClauseKind CKind = Tok.isAnnotation()
+ ? OMPC_unknown
+ : getOpenMPClauseKind(PP.getSpelling(Tok));
+ if (CKind != OMPC_match) {
Diag(Tok.getLocation(), diag::err_omp_declare_variant_wrong_clause)
- << "match";
+ << getOpenMPClauseName(OMPC_match);
while (!SkipUntil(tok::annot_pragma_openmp_end, Parser::StopBeforeMatch))
;
// Skip the last annot_pragma_openmp_end.
(void)ConsumeToken();
// Parse '('.
BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end);
- if (T.expectAndConsume(diag::err_expected_lparen_after, "match")) {
+ if (T.expectAndConsume(diag::err_expected_lparen_after,
+ getOpenMPClauseName(OMPC_match))) {
while (!SkipUntil(tok::annot_pragma_openmp_end, StopBeforeMatch))
;
// Skip the last annot_pragma_openmp_end.
break;
case OMPC_threadprivate:
case OMPC_uniform:
+ case OMPC_match:
if (!WrongDirective)
Diag(Tok, diag::err_omp_unexpected_clause)
<< getOpenMPClauseName(CKind) << getOpenMPDirectiveName(DKind);
case OMPC_dynamic_allocators:
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
+ case OMPC_match:
llvm_unreachable("Unexpected clause");
}
for (Stmt *CC : C->children()) {
case OMPC_dynamic_allocators:
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
+ case OMPC_match:
llvm_unreachable("Clause is not allowed.");
}
return Res;
case OMPC_dynamic_allocators:
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
+ case OMPC_match:
llvm_unreachable("Unexpected OpenMP clause.");
}
return CaptureRegion;
case OMPC_reverse_offload:
case OMPC_dynamic_allocators:
case OMPC_device_type:
+ case OMPC_match:
llvm_unreachable("Clause is not allowed.");
}
return Res;
case OMPC_dynamic_allocators:
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
+ case OMPC_match:
llvm_unreachable("Clause is not allowed.");
}
return Res;
case OMPC_is_device_ptr:
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
+ case OMPC_match:
llvm_unreachable("Clause is not allowed.");
}
return Res;
case OMPC_dynamic_allocators:
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
+ case OMPC_match:
llvm_unreachable("Clause is not allowed.");
}
return Res;