[clang] [OpenACC] Implement Default clause for Compute Constructs (PR #88135)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 10 06:32:10 PDT 2024
================
@@ -11074,13 +11079,44 @@ OMPClause *TreeTransform<Derived>::TransformOMPXBareClause(OMPXBareClause *C) {
//===----------------------------------------------------------------------===//
// OpenACC transformation
//===----------------------------------------------------------------------===//
+template <typename Derived>
+OpenACCClause *TreeTransform<Derived>::TransformOpenACCClause(
+ ArrayRef<const OpenACCClause *> ExistingClauses,
+ OpenACCDirectiveKind DirKind, const OpenACCClause *OldClause) {
+
+ SemaOpenACC::OpenACCParsedClause ParsedClause(
+ DirKind, OldClause->getClauseKind(), OldClause->getBeginLoc());
+ ParsedClause.setEndLoc(OldClause->getEndLoc());
+
+ if (const auto *WithParms = dyn_cast<OpenACCClauseWithParams>(OldClause))
+ ParsedClause.setLParenLoc(WithParms->getLParenLoc());
+
+ switch (OldClause->getClauseKind()) {
+ case OpenACCClauseKind::Default:
+ // There is nothing to do here as nothing dependent can appear in this
+ // clause. So just set the values so Sema can set the right value.
+ ParsedClause.setDefaultDetails(
+ cast<OpenACCDefaultClause>(OldClause)->getDefaultClauseKind());
+ break;
+ default:
+ assert(false && "Unhandled OpenACC clause in TreeTransform");
----------------
erichkeane wrote:
According to Aaron Ballman, this isn't really what 'unreachable' is for.
There is a pretty extensive discussion somewhere between 'assert(false...) ' and 'llvm_unreachable', as the latter performs optimizations on release builds that can result in an unstable compiler.
In this case, I'm using it somewhat for potential flow-control during development, but once I'm sure I have all the cases covered, this will either go away or switch to an unreachable.
https://github.com/llvm/llvm-project/pull/88135
More information about the cfe-commits
mailing list