From 0ba904a92fb51ea7583e555c101937f739c8b0e1 Mon Sep 17 00:00:00 2001
From: Philippe Virouleau <philippe.44@gmail.com>
Date: Wed, 30 Nov 2016 16:18:03 +0100
Subject: [PATCH] Added taskname clause on tasks

---
 include/clang/AST/OpenMPClause.h           | 56 ++++++++++++++++++++++
 include/clang/AST/RecursiveASTVisitor.h    |  7 +++
 include/clang/Basic/DiagnosticSemaKinds.td |  2 +
 include/clang/Basic/OpenMPKinds.def        |  2 +
 include/clang/Sema/Sema.h                  |  5 ++
 lib/AST/OpenMPClause.cpp                   |  2 +
 lib/AST/StmtPrinter.cpp                    |  6 +++
 lib/AST/StmtProfile.cpp                    |  3 ++
 lib/Basic/OpenMPKinds.cpp                  |  2 +
 lib/CodeGen/CGOpenMPRuntime.cpp            | 24 ++++++++++
 lib/CodeGen/CGOpenMPRuntime.h              |  4 ++
 lib/CodeGen/CGStmtOpenMP.cpp               |  4 ++
 lib/Parse/ParseOpenMP.cpp                  |  4 ++
 lib/Sema/SemaOpenMP.cpp                    | 18 +++++++
 lib/Sema/TreeTransform.h                   | 23 +++++++++
 lib/Serialization/ASTReaderStmt.cpp        |  8 ++++
 lib/Serialization/ASTWriterStmt.cpp        |  5 ++
 tools/libclang/CIndex.cpp                  |  4 ++
 18 files changed, 179 insertions(+)

diff --git a/include/clang/AST/OpenMPClause.h b/include/clang/AST/OpenMPClause.h
index 068a5a83518..6e3f396648e 100644
--- a/include/clang/AST/OpenMPClause.h
+++ b/include/clang/AST/OpenMPClause.h
@@ -3685,6 +3685,62 @@ public:
   child_range children() { return child_range(&Priority, &Priority + 1); }
 };
 
+/// \brief This represents 'taskname' (taskname) clause in the '#pragma omp task ...'
+/// directive.
+///
+/// \code
+/// #pragma omp task taskname("task")
+/// \endcode
+/// In this example directive '#pragma omp task' has clause 'taskname' with
+/// single expression 'task'.
+///
+class OMPTasknameClause : public OMPClause {
+  friend class OMPClauseReader;
+  /// \brief Location of '('.
+  SourceLocation LParenLoc;
+  /// \brief Task name.
+  Stmt *Taskname;
+  /// \brief Set the task name.
+  ///
+  /// \param E task name.
+  ///
+  void setTaskname(Expr *E) { Taskname = E; }
+
+public:
+  /// \brief Build 'taskname' clause.
+  ///
+  /// \param E Expression associated with this clause.
+  /// \param StartLoc Starting location of the clause.
+  /// \param LParenLoc Location of '('.
+  /// \param EndLoc Ending location of the clause.
+  ///
+  OMPTasknameClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc,
+                    SourceLocation EndLoc)
+      : OMPClause(OMPC_taskname, StartLoc, EndLoc), LParenLoc(LParenLoc),
+        Taskname(E) {}
+
+  /// \brief Build an empty clause.
+  ///
+  OMPTasknameClause()
+      : OMPClause(OMPC_taskname, SourceLocation(), SourceLocation()),
+        LParenLoc(SourceLocation()), Taskname(nullptr) {}
+  /// \brief Sets the location of '('.
+  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
+  /// \brief Returns the location of '('.
+  SourceLocation getLParenLoc() const { return LParenLoc; }
+  /// \brief Return task name.
+  Expr *getTaskname() { return cast<Expr>(Taskname); }
+  /// \brief Return task name
+  Expr *getTaskname() const { return cast<Expr>(Taskname); }
+
+  static bool classof(const OMPClause *T) {
+    return T->getClauseKind() == OMPC_taskname;
+  }
+
+  child_range children() { return child_range(&Taskname,
+                                              &Taskname + 1); }
+};
+
 /// \brief This represents 'oi' (Operational Intensity) clause in the '#pragma omp ...'
 /// directive.
 ///
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h
index 3f2a9f698f3..43c9521358f 100644
--- a/include/clang/AST/RecursiveASTVisitor.h
+++ b/include/clang/AST/RecursiveASTVisitor.h
@@ -2929,6 +2929,13 @@ bool RecursiveASTVisitor<Derived>::VisitOMPOperationalIntensityClause(
   return true;
 }
 
+template <typename Derived>
+bool RecursiveASTVisitor<Derived>::VisitOMPTasknameClause(
+    OMPTasknameClause *C) {
+  TRY_TO(TraverseStmt(C->getTaskname()));
+  return true;
+}
+
 template <typename Derived>
 bool RecursiveASTVisitor<Derived>::VisitOMPGrainsizeClause(
     OMPGrainsizeClause *C) {
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index 55a43489d92..702fc04b2ad 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -8310,6 +8310,8 @@ def err_omp_firstprivate_distribute_in_teams_reduction : Error<
   "reduction variable in '#pragma omp teams' cannot be firstprivate in '#pragma omp distribute'">;
 def err_omp_affinity_clause_wrong_number_var : Error<
   "'affinity' clause must have one expression and optionally a 'strict' argument">;
+def err_omp_taskname_clause_not_a_string : Error<
+  "'taskname' clause must have a StringLiteral as argument">;
 def err_omp_depend_clause_thread_simd : Error<
   "'depend' clauses cannot be mixed with '%0' clause">;
 def err_omp_depend_sink_expected_loop_iteration : Error<
diff --git a/include/clang/Basic/OpenMPKinds.def b/include/clang/Basic/OpenMPKinds.def
index b93aee0e6d5..d56210d4ae4 100644
--- a/include/clang/Basic/OpenMPKinds.def
+++ b/include/clang/Basic/OpenMPKinds.def
@@ -227,6 +227,7 @@ OPENMP_CLAUSE(num_teams, OMPNumTeamsClause)
 OPENMP_CLAUSE(thread_limit, OMPThreadLimitClause)
 OPENMP_CLAUSE(priority, OMPPriorityClause)
 OPENMP_CLAUSE(oi, OMPOperationalIntensityClause)
+OPENMP_CLAUSE(taskname, OMPTasknameClause)
 OPENMP_CLAUSE(grainsize, OMPGrainsizeClause)
 OPENMP_CLAUSE(nogroup, OMPNogroupClause)
 OPENMP_CLAUSE(num_tasks, OMPNumTasksClause)
@@ -415,6 +416,7 @@ OPENMP_TASK_CLAUSE(depend)
 OPENMP_TASK_CLAUSE(priority)
 OPENMP_TASK_CLAUSE(oi)
 OPENMP_TASK_CLAUSE(affinity)
+OPENMP_TASK_CLAUSE(taskname)
 
 // Clauses allowed for OpenMP directive 'atomic'.
 OPENMP_ATOMIC_CLAUSE(read)
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 824e56a24e6..c53b5d0ffa6 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -8518,6 +8518,11 @@ public:
                                                    SourceLocation StartLoc,
                                                    SourceLocation LParenLoc,
                                                    SourceLocation EndLoc);
+  /// \brief Called on well-formed 'taskname' clause.
+  OMPClause *ActOnOpenMPTasknameClause(Expr *Taskname,
+                                       SourceLocation StartLoc,
+                                       SourceLocation LParenLoc,
+                                       SourceLocation EndLoc);
   /// \brief Called on well-formed 'affinity' clause.
   OMPClause *ActOnOpenMPAffinityClause(OpenMPAffinityClauseKind AffKind,
                                        SourceLocation AffLoc,
diff --git a/lib/AST/OpenMPClause.cpp b/lib/AST/OpenMPClause.cpp
index 111169896cd..d0295511f3d 100644
--- a/lib/AST/OpenMPClause.cpp
+++ b/lib/AST/OpenMPClause.cpp
@@ -82,6 +82,7 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
   case OMPC_priority:
   case OMPC_affinity:
   case OMPC_oi:
+  case OMPC_taskname:
   case OMPC_init:
   case OMPC_grainsize:
   case OMPC_nogroup:
@@ -150,6 +151,7 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C)
   case OMPC_priority:
   case OMPC_affinity:
   case OMPC_oi:
+  case OMPC_taskname:
   case OMPC_init:
   case OMPC_grainsize:
   case OMPC_nogroup:
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index 764595bcaa3..fa19f4060d1 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -759,6 +759,12 @@ void OMPClausePrinter::VisitOMPOperationalIntensityClause(OMPOperationalIntensit
   OS << ")";
 }
 
+void OMPClausePrinter::VisitOMPTasknameClause(OMPTasknameClause *Node) {
+  OS << "taskname(";
+  Node->getTaskname()->printPretty(OS, nullptr, Policy, 0);
+  OS << ")";
+}
+
 void OMPClausePrinter::VisitOMPAffinityClause(OMPAffinityClause *Node) {
   //TODO fix this 
   OS << "affinity(";
diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp
index d80469de1b4..5ae22e9089f 100644
--- a/lib/AST/StmtProfile.cpp
+++ b/lib/AST/StmtProfile.cpp
@@ -516,6 +516,9 @@ void OMPClauseProfiler::VisitOMPPriorityClause(const OMPPriorityClause *C) {
 void OMPClauseProfiler::VisitOMPOperationalIntensityClause(const OMPOperationalIntensityClause *C) {
   Profiler->VisitStmt(C->getOperationalIntensity());
 }
+void OMPClauseProfiler::VisitOMPTasknameClause(const OMPTasknameClause *C) {
+  Profiler->VisitStmt(C->getTaskname());
+}
 void OMPClauseProfiler::VisitOMPAffinityClause(const OMPAffinityClause *C) {
   Profiler->VisitStmt(C->getAffinity());
 }
diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp
index 62643ae9594..e7dcca3a8f8 100644
--- a/lib/Basic/OpenMPKinds.cpp
+++ b/lib/Basic/OpenMPKinds.cpp
@@ -168,6 +168,7 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
   case OMPC_thread_limit:
   case OMPC_priority:
   case OMPC_oi:
+  case OMPC_taskname:
   case OMPC_grainsize:
   case OMPC_nogroup:
   case OMPC_num_tasks:
@@ -318,6 +319,7 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
   case OMPC_thread_limit:
   case OMPC_priority:
   case OMPC_oi:
+  case OMPC_taskname:
   case OMPC_affinity:
   case OMPC_grainsize:
   case OMPC_nogroup:
diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp
index 805faf425b3..88b9f30ebc5 100644
--- a/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -558,6 +558,8 @@ enum OpenMPRTLFunction {
   // Call to void __kmpc_omp_set_task_affinity(int kind, kmp_int32 affinity,
   // int strict);
   OMPRTL__kmpc_omp_set_task_affinity,
+  // Call to void __kmpc_omp_set_task_name(char *name);
+  OMPRTL__kmpc_omp_set_task_name,
   // Call to void __kmpc_begin_push_init(int kind);
   OMPRTL__kmpc_begin_push_init,
   // Call to void __kmpc_end_push_init();
@@ -1243,6 +1245,14 @@ CGOpenMPRuntime::createRuntimeFunction(unsigned Function) {
     RTLFn = CGM.CreateRuntimeFunction(FnTy, /*Name=*/"__kmpc_omp_set_task_affinity");
     break;
   }
+  case OMPRTL__kmpc_omp_set_task_name: {
+    // Build void __kmpc_omp_set_task_name(char *name);
+    llvm::Type *TypeParams[] = {CGM.Int8PtrTy};
+    llvm::FunctionType *FnTy =
+        llvm::FunctionType::get(CGM.VoidTy, TypeParams, /*isVarArg*/ false);
+    RTLFn = CGM.CreateRuntimeFunction(FnTy, /*Name=*/"__kmpc_omp_set_task_name");
+    break;
+  }
   case OMPRTL__kmpc_single: {
     // Build kmp_int32 __kmpc_single(ident_t *loc, kmp_int32 global_tid);
     llvm::Type *TypeParams[] = {getIdentTyPointerTy(), CGM.Int32Ty};
@@ -2726,6 +2736,20 @@ void CGOpenMPRuntime::emitTaskAffinityClause(CodeGenFunction &CGF,
       Args);
 }
 
+void CGOpenMPRuntime::emitTasknameClause(CodeGenFunction &CGF,
+                                         const Expr *Taskname) {
+  if (!CGF.HaveInsertPoint() || !isa<StringLiteral>(Taskname))
+    return;
+
+  auto Name = CGF.EmitStringLiteralLValue(cast<StringLiteral>(Taskname));
+
+  // Build call __kmpc_omp_set_task_name(name)
+  llvm::Value *Args[] = {
+    CGF.Builder.CreateIntCast(Name.getPointer(), CGF.Int8PtrTy, /*isSigned*/ false),
+  };
+  CGF.EmitRuntimeCall(createRuntimeFunction(OMPRTL__kmpc_omp_set_task_name), Args);
+}
+
 void CGOpenMPRuntime::emitBeginInitClause(CodeGenFunction &CGF,
                                           OpenMPInitClauseKind Init) {
   if (!CGF.HaveInsertPoint())
diff --git a/lib/CodeGen/CGOpenMPRuntime.h b/lib/CodeGen/CGOpenMPRuntime.h
index 149920b5550..917d04ebf22 100644
--- a/lib/CodeGen/CGOpenMPRuntime.h
+++ b/lib/CodeGen/CGOpenMPRuntime.h
@@ -757,6 +757,10 @@ public:
                                       const Expr *Aff,
                                       llvm::Value *Strict);
 
+  /// \brief Emit call to void __kmpc_omp_set_task_name(char *name);
+  virtual void emitTasknameClause(CodeGenFunction &CGF,
+                                  const Expr *Name);
+
   /// \brief Emit call to void __kmpc_begin_push_init(int init)
   /// to generate code for begin 'init' clause.
   virtual void emitBeginInitClause(CodeGenFunction &CGF,
diff --git a/lib/CodeGen/CGStmtOpenMP.cpp b/lib/CodeGen/CGStmtOpenMP.cpp
index 83336df911a..21760105d2f 100644
--- a/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/lib/CodeGen/CGStmtOpenMP.cpp
@@ -2488,6 +2488,10 @@ void CodeGenFunction::EmitOMPTaskBasedDirective(const OMPExecutableDirective &S,
                            AffinityClause->getAffinity(),
                            StrictValue);
   }
+  if (const auto *TasknameClause = S.getSingleClause<OMPTasknameClause>()) {
+    CGM.getOpenMPRuntime().emitTasknameClause(*this,
+                                              TasknameClause->getTaskname());
+  }
   // Check if the task has 'priority' clause.
   if (const auto *Clause = S.getSingleClause<OMPPriorityClause>()) {
     // Runtime currently does not support codegen for priority clause argument.
diff --git a/lib/Parse/ParseOpenMP.cpp b/lib/Parse/ParseOpenMP.cpp
index 68cbc398e6d..1e8b2b35ac5 100644
--- a/lib/Parse/ParseOpenMP.cpp
+++ b/lib/Parse/ParseOpenMP.cpp
@@ -1086,6 +1086,7 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
   case OMPC_thread_limit:
   case OMPC_priority:
   case OMPC_oi:
+  case OMPC_taskname:
   case OMPC_grainsize:
   case OMPC_num_tasks:
   case OMPC_hint:
@@ -1272,6 +1273,9 @@ ExprResult Parser::ParseOpenMPParensExpr(StringRef ClauseName,
 ///    hint-clause:
 ///      'hint' '(' expression ')'
 ///
+///    taskname-clause:
+///      'taskname' '(' expression ')'
+///
 OMPClause *Parser::ParseOpenMPSingleExprClause(OpenMPClauseKind Kind) {
   SourceLocation Loc = ConsumeToken();
   SourceLocation LLoc = Tok.getLocation();
diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp
index 2346c56bd32..7b1630a2c9e 100644
--- a/lib/Sema/SemaOpenMP.cpp
+++ b/lib/Sema/SemaOpenMP.cpp
@@ -7248,6 +7248,9 @@ OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr,
   case OMPC_oi:
     Res = ActOnOpenMPOperationalIntensityClause(Expr, StartLoc, LParenLoc, EndLoc);
     break;
+  case OMPC_taskname:
+    Res = ActOnOpenMPTasknameClause(Expr, StartLoc, LParenLoc, EndLoc);
+    break;
   case OMPC_grainsize:
     Res = ActOnOpenMPGrainsizeClause(Expr, StartLoc, LParenLoc, EndLoc);
     break;
@@ -7577,6 +7580,7 @@ OMPClause *Sema::ActOnOpenMPSimpleClause(
   case OMPC_thread_limit:
   case OMPC_priority:
   case OMPC_oi:
+  case OMPC_taskname:
   case OMPC_affinity:
   case OMPC_grainsize:
   case OMPC_nogroup:
@@ -7753,6 +7757,7 @@ OMPClause *Sema::ActOnOpenMPSingleExprWithArgClause(
   case OMPC_thread_limit:
   case OMPC_priority:
   case OMPC_oi:
+  case OMPC_taskname:
   case OMPC_affinity:
   case OMPC_grainsize:
   case OMPC_nogroup:
@@ -7944,6 +7949,7 @@ OMPClause *Sema::ActOnOpenMPClause(OpenMPClauseKind Kind,
   case OMPC_thread_limit:
   case OMPC_priority:
   case OMPC_oi:
+  case OMPC_taskname:
   case OMPC_affinity:
   case OMPC_grainsize:
   case OMPC_num_tasks:
@@ -8113,6 +8119,7 @@ OMPClause *Sema::ActOnOpenMPVarListClause(
   case OMPC_thread_limit:
   case OMPC_priority:
   case OMPC_oi:
+  case OMPC_taskname:
   case OMPC_grainsize:
   case OMPC_nogroup:
   case OMPC_num_tasks:
@@ -11344,6 +11351,17 @@ OMPClause *Sema::ActOnOpenMPPriorityClause(Expr *Priority,
   return new (Context) OMPPriorityClause(ValExpr, StartLoc, LParenLoc, EndLoc);
 }
 
+OMPClause *Sema::ActOnOpenMPTasknameClause(Expr *Taskname,
+                                           SourceLocation StartLoc,
+                                           SourceLocation LParenLoc,
+                                           SourceLocation EndLoc) {
+
+  if (!isa<StringLiteral>(Taskname))
+    Diag(LParenLoc, diag::err_omp_taskname_clause_not_a_string);
+
+  return new (Context) OMPTasknameClause(Taskname, StartLoc, LParenLoc, EndLoc);
+}
+
 OMPClause *Sema::ActOnOpenMPOperationalIntensityClause(Expr *OperationalIntensity,
                                                        SourceLocation StartLoc,
                                                        SourceLocation LParenLoc,
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index f14c3d3643e..5c60cf50846 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -1739,6 +1739,19 @@ public:
                                                            EndLoc);
   }
 
+  /// \brief Build a new OpenMP 'taskname' clause.
+  ///
+  /// By default, performs semantic analysis to build the new statement.
+  /// Subclasses may override this routine to provide different behavior.
+  OMPClause *RebuildOMPTasknameClause(Expr *Taskname,
+                                      SourceLocation StartLoc,
+                                      SourceLocation LParenLoc,
+                                      SourceLocation EndLoc) {
+    return getSema().ActOnOpenMPTasknameClause(Taskname,
+                                               StartLoc, LParenLoc,
+                                               EndLoc);
+  }
+
   /// \brief Build a new OpenMP 'affinity' clause.
   ///
   /// By default, performs semantic analysis to build the new statement.
@@ -8115,6 +8128,16 @@ TreeTransform<Derived>::TransformOMPPriorityClause(OMPPriorityClause *C) {
       E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
 }
 
+template <typename Derived>
+OMPClause *
+TreeTransform<Derived>::TransformOMPTasknameClause(OMPTasknameClause *C) {
+  ExprResult E = getDerived().TransformExpr(C->getTaskname());
+  if (E.isInvalid())
+    return nullptr;
+  return getDerived().RebuildOMPTasknameClause(
+      E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+}
+
 template <typename Derived>
 OMPClause *
 TreeTransform<Derived>::TransformOMPOperationalIntensityClause(OMPOperationalIntensityClause *C) {
diff --git a/lib/Serialization/ASTReaderStmt.cpp b/lib/Serialization/ASTReaderStmt.cpp
index 63af2390f97..b783f7fdc50 100644
--- a/lib/Serialization/ASTReaderStmt.cpp
+++ b/lib/Serialization/ASTReaderStmt.cpp
@@ -1905,6 +1905,9 @@ OMPClause *OMPClauseReader::readClause() {
   case OMPC_oi:
     C = new (Context) OMPOperationalIntensityClause();
     break;
+  case OMPC_taskname:
+    C = new (Context) OMPTasknameClause();
+    break;
   case OMPC_affinity:
     C = OMPAffinityClause::CreateEmpty(Context, Record[Idx++]);
     break;
@@ -2348,6 +2351,11 @@ void OMPClauseReader::VisitOMPPriorityClause(OMPPriorityClause *C) {
   C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
 }
 
+void OMPClauseReader::VisitOMPTasknameClause(OMPTasknameClause *C) {
+  C->setTaskname(Reader->Reader.ReadSubExpr());
+  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
+}
+
 void OMPClauseReader::VisitOMPOperationalIntensityClause(OMPOperationalIntensityClause *C) {
   C->setOperationalIntensity(Reader->Reader.ReadSubExpr());
   C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
diff --git a/lib/Serialization/ASTWriterStmt.cpp b/lib/Serialization/ASTWriterStmt.cpp
index cab911cc5b4..d6b79a1d971 100644
--- a/lib/Serialization/ASTWriterStmt.cpp
+++ b/lib/Serialization/ASTWriterStmt.cpp
@@ -2083,6 +2083,11 @@ void OMPClauseWriter::VisitOMPPriorityClause(OMPPriorityClause *C) {
   Record.AddSourceLocation(C->getLParenLoc());
 }
 
+void OMPClauseWriter::VisitOMPTasknameClause(OMPTasknameClause *C) {
+  Record.AddStmt(C->getTaskname());
+  Record.AddSourceLocation(C->getLParenLoc());
+}
+
 void OMPClauseWriter::VisitOMPOperationalIntensityClause(OMPOperationalIntensityClause *C) {
   Record.AddStmt(C->getOperationalIntensity());
   Record.AddSourceLocation(C->getLParenLoc());
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 86072b96a6a..afc09ea9ad9 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -2143,6 +2143,10 @@ void OMPClauseEnqueue::VisitOMPOperationalIntensityClause(const OMPOperationalIn
   Visitor->AddStmt(C->getOperationalIntensity());
 }
 
+void OMPClauseEnqueue::VisitOMPTasknameClause(const OMPTasknameClause *C) {
+  Visitor->AddStmt(C->getTaskname());
+}
+
 void OMPClauseEnqueue::VisitOMPAffinityClause(const OMPAffinityClause *C) {
   VisitOMPClauseList(C);
 }
-- 
GitLab