Index: include/clang/AST/OpenMPClause.h =================================================================== --- include/clang/AST/OpenMPClause.h +++ include/clang/AST/OpenMPClause.h @@ -4217,6 +4217,103 @@ reinterpret_cast(varlist_end())); } }; + +/// \brief This represents clause 'use_device_ptr' in the '#pragma omp ...' +/// directives. +/// +/// \code +/// #pragma omp target data use_device_ptr(a,b) +/// \endcode +/// In this example directive '#pragma omp target data' has clause +/// 'use_device_ptr' with the variables 'a' and 'b'. +/// + +class OMPUseDevicePtrClause final + : public OMPVarListClause, + private llvm::TrailingObjects { + friend TrailingObjects; + friend OMPVarListClause; + friend class OMPClauseReader; + /// \brief Build clause with number of variables \a N. + /// + /// \param StartLoc Starting location of the clause. + /// \param LParenLoc Location of '('. + /// \param EndLoc Ending location of the clause. + /// \param N Number of the variables in the clause. + /// + OMPUseDevicePtrClause(SourceLocation StartLoc, SourceLocation LParenLoc, + SourceLocation EndLoc, unsigned N) + : OMPVarListClause(OMPC_use_device_ptr, StartLoc, + LParenLoc, EndLoc, N) {} + + /// \brief Build an empty clause. + /// + /// \param N Number of variables. + /// + explicit OMPUseDevicePtrClause(unsigned N) + : OMPVarListClause( + OMPC_use_device_ptr, SourceLocation(), SourceLocation(), + SourceLocation(), N) {} + + /// \brief Sets the list of references to private copies with initializers for + /// new private variables. + /// \param VL List of references. + void setPrivateCopies(ArrayRef VL); + + /// \brief Gets the list of references to private copies with initializers for + /// new private variables. + MutableArrayRef getPrivateCopies() { + return MutableArrayRef(varlist_end(), varlist_size()); + } + ArrayRef getPrivateCopies() const { + return llvm::makeArrayRef(varlist_end(), varlist_size()); + } + +public: + /// \brief Creates clause with a list of variables \a VL. + /// + /// \param C AST context. + /// \param StartLoc Starting location of the clause. + /// \param LParenLoc Location of '('. + /// \param EndLoc Ending location of the clause. + /// \param VL List of references to the variables. + /// \param PrivateVL List of references to private copies with initializers. + /// + static OMPUseDevicePtrClause * + Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, + SourceLocation EndLoc, ArrayRef VL, + ArrayRef PrivateVL); + /// \brief Creates an empty clause with the place for \a N variables. + /// + /// \param C AST context. + /// \param N The number of variables. + /// + static OMPUseDevicePtrClause *CreateEmpty(const ASTContext &C, unsigned N); + + typedef MutableArrayRef::iterator private_copies_iterator; + typedef ArrayRef::iterator private_copies_const_iterator; + typedef llvm::iterator_range private_copies_range; + typedef llvm::iterator_range + private_copies_const_range; + + private_copies_range private_copies() { + return private_copies_range(getPrivateCopies().begin(), + getPrivateCopies().end()); + } + private_copies_const_range private_copies() const { + return private_copies_const_range(getPrivateCopies().begin(), + getPrivateCopies().end()); + } + + child_range children() { + return child_range(reinterpret_cast(varlist_begin()), + reinterpret_cast(varlist_end())); + } + + static bool classof(const OMPClause *T) { + return T->getClauseKind() == OMPC_use_device_ptr; + } +}; } // end namespace clang #endif // LLVM_CLANG_AST_OPENMPCLAUSE_H Index: include/clang/AST/RecursiveASTVisitor.h =================================================================== --- include/clang/AST/RecursiveASTVisitor.h +++ include/clang/AST/RecursiveASTVisitor.h @@ -2900,6 +2900,13 @@ return true; } +template +bool RecursiveASTVisitor::VisitOMPUseDevicePtrClause( + OMPUseDevicePtrClause *C) { + TRY_TO(VisitOMPClauseList(C)); + return true; +} + // FIXME: look at the following tricky-seeming exprs to see if we // need to recurse on anything. These are ones that have methods // returning decls or qualtypes or nestednamespecifier -- though I'm Index: include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -8314,6 +8314,8 @@ "expected a reference to an integer-typed parameter">; def err_omp_at_least_one_motion_clause_required : Error< "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">; +def err_omp_usedeviceptr_not_a_pointer : Error< + "item used in 'use_device_pointer' clause is not a pointer">; } // end of OpenMP category let CategoryName = "Related Result Type Issue" in { Index: include/clang/Basic/OpenMPKinds.def =================================================================== --- include/clang/Basic/OpenMPKinds.def +++ include/clang/Basic/OpenMPKinds.def @@ -216,6 +216,7 @@ OPENMP_CLAUSE(defaultmap, OMPDefaultmapClause) OPENMP_CLAUSE(to, OMPToClause) OPENMP_CLAUSE(from, OMPFromClause) +OPENMP_CLAUSE(use_device_ptr, OMPUseDevicePtrClause) // Clauses allowed for OpenMP directive 'parallel'. OPENMP_PARALLEL_CLAUSE(if) @@ -400,6 +401,7 @@ OPENMP_TARGET_DATA_CLAUSE(if) OPENMP_TARGET_DATA_CLAUSE(device) OPENMP_TARGET_DATA_CLAUSE(map) +OPENMP_TARGET_DATA_CLAUSE(use_device_ptr) // Clauses allowed for OpenMP directive 'target enter data'. OPENMP_TARGET_ENTER_DATA_CLAUSE(if) Index: include/clang/Sema/Sema.h =================================================================== --- include/clang/Sema/Sema.h +++ include/clang/Sema/Sema.h @@ -8457,6 +8457,11 @@ SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc); + /// \brief Called on well-formed 'use_device_ptr' clause. + OMPClause *ActOnOpenMPUseDevicePtrClause(ArrayRef VarList, + SourceLocation StartLoc, + SourceLocation LParenLoc, + SourceLocation EndLoc); /// \brief The kind of conversion being performed. enum CheckedConversionKind { Index: lib/AST/OpenMPClause.cpp =================================================================== --- lib/AST/OpenMPClause.cpp +++ lib/AST/OpenMPClause.cpp @@ -89,6 +89,7 @@ case OMPC_uniform: case OMPC_to: case OMPC_from: + case OMPC_use_device_ptr: break; } @@ -152,6 +153,7 @@ case OMPC_uniform: case OMPC_to: case OMPC_from: + case OMPC_use_device_ptr: break; } @@ -727,3 +729,27 @@ return new (Mem) OMPFromClause(NumVars, NumUniqueDeclarations, NumComponentLists, NumComponents); } + +void OMPUseDevicePtrClause::setPrivateCopies(ArrayRef VL) { + assert(VL.size() == varlist_size() && + "Number of private copies is not the same as the preallocated buffer"); + std::copy(VL.begin(), VL.end(), varlist_end()); +} + +OMPUseDevicePtrClause * +OMPUseDevicePtrClause::Create(const ASTContext &C, SourceLocation StartLoc, + SourceLocation LParenLoc, SourceLocation EndLoc, + ArrayRef VL, ArrayRef PrivateVL) { + void *Mem = C.Allocate(totalSizeToAlloc(2 * VL.size())); + OMPUseDevicePtrClause *Clause = + new (Mem) OMPUseDevicePtrClause(StartLoc, LParenLoc, EndLoc, VL.size()); + Clause->setVarRefs(VL); + Clause->setPrivateCopies(PrivateVL); + return Clause; +} + +OMPUseDevicePtrClause *OMPUseDevicePtrClause::CreateEmpty(const ASTContext &C, + unsigned N) { + void *Mem = C.Allocate(totalSizeToAlloc(2 * N)); + return new (Mem) OMPUseDevicePtrClause(N); +} Index: lib/AST/StmtPrinter.cpp =================================================================== --- lib/AST/StmtPrinter.cpp +++ lib/AST/StmtPrinter.cpp @@ -947,6 +947,14 @@ Node->getDefaultmapKind()); OS << ")"; } + +void OMPClausePrinter::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *Node) { + if (!Node->varlist_empty()) { + OS << "use_device_ptr"; + VisitOMPClauseList(Node, '('); + OS << ")"; + } +} } //===----------------------------------------------------------------------===// Index: lib/AST/StmtProfile.cpp =================================================================== --- lib/AST/StmtProfile.cpp +++ lib/AST/StmtProfile.cpp @@ -529,6 +529,14 @@ void OMPClauseProfiler::VisitOMPFromClause(const OMPFromClause *C) { VisitOMPClauseList(C); } +void OMPClauseProfiler::VisitOMPUseDevicePtrClause( + const OMPUseDevicePtrClause *C) { + VisitOMPClauseList(C); + for (auto *E : C->private_copies()) { + if (E) + Profiler->VisitStmt(E); + } +} } void Index: lib/Basic/OpenMPKinds.cpp =================================================================== --- lib/Basic/OpenMPKinds.cpp +++ lib/Basic/OpenMPKinds.cpp @@ -164,6 +164,7 @@ case OMPC_uniform: case OMPC_to: case OMPC_from: + case OMPC_use_device_ptr: break; } llvm_unreachable("Invalid OpenMP simple clause kind"); @@ -301,6 +302,7 @@ case OMPC_uniform: case OMPC_to: case OMPC_from: + case OMPC_use_device_ptr: break; } llvm_unreachable("Invalid OpenMP simple clause kind"); Index: lib/CodeGen/CGStmtOpenMP.cpp =================================================================== --- lib/CodeGen/CGStmtOpenMP.cpp +++ lib/CodeGen/CGStmtOpenMP.cpp @@ -3162,6 +3162,7 @@ case OMPC_uniform: case OMPC_to: case OMPC_from: + case OMPC_use_device_ptr: llvm_unreachable("Clause is not allowed in 'omp atomic'."); } } Index: lib/Parse/ParseOpenMP.cpp =================================================================== --- lib/Parse/ParseOpenMP.cpp +++ lib/Parse/ParseOpenMP.cpp @@ -1175,6 +1175,7 @@ case OMPC_map: case OMPC_to: case OMPC_from: + case OMPC_use_device_ptr: Clause = ParseOpenMPVarListClause(DKind, CKind); break; case OMPC_unknown: @@ -1739,6 +1740,8 @@ /// 'to' '(' list ')' /// from-clause: /// 'from' '(' list ')' +/// use_device_ptr-clause: +/// 'use_device_ptr' '(' list ')' /// /// For 'linear' clause linear-list may have the following forms: /// list Index: lib/Sema/SemaOpenMP.cpp =================================================================== --- lib/Sema/SemaOpenMP.cpp +++ lib/Sema/SemaOpenMP.cpp @@ -7004,6 +7004,7 @@ case OMPC_uniform: case OMPC_to: case OMPC_from: + case OMPC_use_device_ptr: llvm_unreachable("Clause is not allowed."); } return Res; @@ -7290,6 +7291,7 @@ case OMPC_uniform: case OMPC_to: case OMPC_from: + case OMPC_use_device_ptr: llvm_unreachable("Clause is not allowed."); } return Res; @@ -7443,6 +7445,7 @@ case OMPC_uniform: case OMPC_to: case OMPC_from: + case OMPC_use_device_ptr: llvm_unreachable("Clause is not allowed."); } return Res; @@ -7630,6 +7633,7 @@ case OMPC_uniform: case OMPC_to: case OMPC_from: + case OMPC_use_device_ptr: llvm_unreachable("Clause is not allowed."); } return Res; @@ -7749,6 +7753,9 @@ case OMPC_from: Res = ActOnOpenMPFromClause(VarList, StartLoc, LParenLoc, EndLoc); break; + case OMPC_use_device_ptr: + Res = ActOnOpenMPUseDevicePtrClause(VarList, StartLoc, LParenLoc, EndLoc); + break; case OMPC_if: case OMPC_final: case OMPC_num_threads: @@ -11341,3 +11348,55 @@ MVLI.ProcessedVarList, MVLI.VarBaseDeclarations, MVLI.VarComponents); } + +OMPClause *Sema::ActOnOpenMPUseDevicePtrClause(ArrayRef VarList, + SourceLocation StartLoc, + SourceLocation LParenLoc, + SourceLocation EndLoc) { + SmallVector Vars; + SmallVector PrivateCopies; + for (auto &RefExpr : VarList) { + assert(RefExpr && "NULL expr in OpenMP use_device_ptr clause."); + SourceLocation ELoc; + SourceRange ERange; + Expr *SimpleRefExpr = RefExpr; + auto Res = getPrivateItem(*this, SimpleRefExpr, ELoc, ERange); + if (Res.second) { + // It will be analyzed later. + Vars.push_back(RefExpr); + PrivateCopies.push_back(nullptr); + } + ValueDecl *D = Res.first; + if (!D) + continue; + + QualType Type = D->getType(); + auto *VD = dyn_cast(D); + + // item should be a pointer or array + if (!Type.getNonReferenceType()->isPointerType()) { + Diag(ELoc, diag::err_omp_usedeviceptr_not_a_pointer) + << 0 << RefExpr->getSourceRange(); + continue; + } + Type = Type.getUnqualifiedType(); + auto VDPrivate = buildVarDecl(*this, ELoc, Type, D->getName(), + D->hasAttrs() ? &D->getAttrs() : nullptr); + if (VDPrivate->isInvalidDecl()) + continue; + auto VDPrivateRefExpr = buildDeclRefExpr( + *this, VDPrivate, RefExpr->getType().getUnqualifiedType(), ELoc); + + DeclRefExpr *Ref = nullptr; + if (!VD) + Ref = buildCapture(*this, D, SimpleRefExpr, /*WithInit=*/false); + Vars.push_back(VD ? RefExpr->IgnoreParens() : Ref); + PrivateCopies.push_back(VDPrivateRefExpr); + } + + if (Vars.empty()) + return nullptr; + + return OMPUseDevicePtrClause::Create(Context, StartLoc, LParenLoc, EndLoc, + Vars, PrivateCopies); +} Index: lib/Sema/TreeTransform.h =================================================================== --- lib/Sema/TreeTransform.h +++ lib/Sema/TreeTransform.h @@ -1781,6 +1781,18 @@ EndLoc); } + /// \brief Build a new OpenMP 'use_device_ptr' clause. + /// + /// By default, performs semantic analysis to build the new OpenMP clause. + /// Subclasses may override this routine to provide different behavior. + OMPClause *RebuildOMPUseDevicePtrClause(ArrayRef VarList, + SourceLocation StartLoc, + SourceLocation LParenLoc, + SourceLocation EndLoc) { + return getSema().ActOnOpenMPUseDevicePtrClause(VarList, StartLoc, LParenLoc, + EndLoc); + } + /// \brief Rebuild the operand to an Objective-C \@synchronized statement. /// /// By default, performs semantic analysis to build the new statement. @@ -8061,6 +8073,21 @@ C->getLParenLoc(), C->getLocEnd()); } +template +OMPClause *TreeTransform::TransformOMPUseDevicePtrClause( + OMPUseDevicePtrClause *C) { + llvm::SmallVector Vars; + Vars.reserve(C->varlist_size()); + for (auto *VE : C->varlists()) { + ExprResult EVar = getDerived().TransformExpr(cast(VE)); + if (EVar.isInvalid()) + return nullptr; + Vars.push_back(EVar.get()); + } + return getDerived().RebuildOMPUseDevicePtrClause( + Vars, C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); +} + //===----------------------------------------------------------------------===// // Expression transformation //===----------------------------------------------------------------------===// Index: lib/Serialization/ASTReaderStmt.cpp =================================================================== --- lib/Serialization/ASTReaderStmt.cpp +++ lib/Serialization/ASTReaderStmt.cpp @@ -1922,6 +1922,9 @@ NumComponents); break; } + case OMPC_use_device_ptr: + C = OMPUseDevicePtrClause::CreateEmpty(Context, Record[Idx++]); + break; } Visit(C); C->setLocStart(Reader->ReadSourceLocation(Record, Idx)); @@ -2439,6 +2442,20 @@ C->setComponents(Components, ListSizes); } +void OMPClauseReader::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *C) { + C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx)); + unsigned NumVars = C->varlist_size(); + SmallVector Vars; + Vars.reserve(NumVars); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Reader->Reader.ReadSubExpr()); + C->setVarRefs(Vars); + Vars.clear(); + for (unsigned i = 0; i != NumVars; ++i) + Vars.push_back(Reader->Reader.ReadSubExpr()); + C->setPrivateCopies(Vars); +} + //===----------------------------------------------------------------------===// // OpenMP Directives. //===----------------------------------------------------------------------===// Index: lib/Serialization/ASTWriterStmt.cpp =================================================================== --- lib/Serialization/ASTWriterStmt.cpp +++ lib/Serialization/ASTWriterStmt.cpp @@ -2140,6 +2140,17 @@ } } +void OMPClauseWriter::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *C) { + Record.push_back(C->varlist_size()); + Record.AddSourceLocation(C->getLParenLoc()); + for (auto *VE : C->varlists()) { + Record.AddStmt(VE); + } + for (auto *VE : C->private_copies()) { + Record.AddStmt(VE); + } +} + //===----------------------------------------------------------------------===// // OpenMP Directives. //===----------------------------------------------------------------------===// Index: test/OpenMP/target_data_use_device_ptr_messages.cpp =================================================================== --- /dev/null +++ test/OpenMP/target_data_use_device_ptr_messages.cpp @@ -0,0 +1,207 @@ +// RUN: %clang_cc1 -std=c++11 -verify -fopenmp -ferror-limit 200 %s +struct ST { + int *a; +}; +struct SA { + const int d = 5; + const int da[5] = { 0 }; + ST e; + ST g[10]; + int i; + int &j = i; + int *k = &j; + int *&z = k; + int aa[10]; + void func(int arg) { +#pragma omp target data map(i) use_device_ptr // expected-error {{expected '(' after 'use_device_ptr'}} + {} +#pragma omp target data map(i) use_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} + {} +#pragma omp target data map(i) use_device_ptr() // expected-error {{expected expression}} + {} +#pragma omp target data map(i) use_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}} + {} +#pragma omp target data map(i) use_device_ptr(arg // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{item used in 'use_device_pointer' clause is not a pointer}} + {} +#pragma omp target data map(i) use_device_ptr(i) // expected-error {{item used in 'use_device_pointer' clause is not a pointer}} + {} +#pragma omp target data map(i) use_device_ptr(j) // expected-error {{}} + {} +#pragma omp target data map(i) use_device_ptr(k) // OK + {} +#pragma omp target data map(i) use_device_ptr(z) // OK + {} +#pragma omp target data map(i) use_device_ptr(aa) // expected-error{{}} + {} +#pragma omp target data map(i) use_device_ptr(e) // expected-error{{}} + {} +#pragma omp target data map(i) use_device_ptr(g) // expected-error{{}} + {} +#pragma omp target data map(i) use_device_ptr(k,i,j) // expected-error2 {{item used in 'use_device_pointer' clause is not a pointer}} + {} +#pragma omp target data map(i) use_device_ptr(d) // expected-error{{}} + {} +#pragma omp target data map(i) use_device_ptr(da) // expected-error{{}} + {} + return; + } +}; +struct SB { + unsigned A; + unsigned B; + float Arr[100]; + float *Ptr; + float *foo() { + return &Arr[0]; + } +}; + +struct SC { + unsigned A : 2; + unsigned B : 3; + unsigned C; + unsigned D; + float Arr[100]; + SB S; + SB ArrS[100]; + SB *PtrS; + SB *&RPtrS; + float *Ptr; + + SC(SB *&_RPtrS) : RPtrS(_RPtrS) {} +}; + +union SD { + unsigned A; + float B; +}; + +struct S1; +extern S1 a; +class S2 { + mutable int a; +public: + S2():a(0) { } + S2(S2 &s2):a(s2.a) { } + static float S2s; + static const float S2sc; +}; +const float S2::S2sc = 0; +const S2 b; +const S2 ba[5]; +class S3 { + int a; +public: + S3():a(0) { } + S3(S3 &s3):a(s3.a) { } +}; +const S3 c; +const S3 ca[5]; +extern const int f; +class S4 { + int a; + S4(); + S4(const S4 &s4); +public: + S4(int v):a(v) { } +}; +class S5 { + int a; + S5():a(0) {} + S5(const S5 &s5):a(s5.a) { } +public: + S5(int v):a(v) { } +}; + +S3 h; +#pragma omp threadprivate(h) + +typedef int from; + +template +T tmain(T argc) { + const T d = 5; + const T da[5] = { 0 }; + S4 e(4); + S5 g(5); + T i; + T &j = i; + T *k = &j; + T *&z = k; + T aa[10]; +#pragma omp target data map(i) use_device_ptr // expected-error {{expected '(' after 'use_device_ptr'}} + {} +#pragma omp target data map(i) use_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} + {} +#pragma omp target data map(i) use_device_ptr() // expected-error {{expected expression}} + {} +#pragma omp target data map(i) use_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}} + {} +#pragma omp target data map(i) use_device_ptr(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error{{item used in 'use_device_pointer' clause is not a pointer}} + {} +#pragma omp target data map(i) use_device_ptr(i) // expected-error {{}} + {} +#pragma omp target data map(i) use_device_ptr(j) // expected-error {{}} + {} +#pragma omp target data map(i) use_device_ptr(k) // OK + {} +#pragma omp target data map(i) use_device_ptr(z) // OK + {} +#pragma omp target data map(i) use_device_ptr(aa) // expected-error{{}} + {} +#pragma omp target data map(i) use_device_ptr(e) // expected-error{{}} + {} +#pragma omp target data map(i) use_device_ptr(g) // expected-error{{}} + {} +#pragma omp target data map(i) use_device_ptr(k,i,j) // expected-error2 {{item used in 'use_device_pointer' clause is not a pointer}} + {} +#pragma omp target data map(i) use_device_ptr(d) // expected-error{{}} + {} +#pragma omp target data map(i) use_device_ptr(da) // expected-error{{}} + {} + return 0; +} + +int main(int argc, char **argv) { + const int d = 5; + const int da[5] = { 0 }; + S4 e(4); + S5 g(5); + int i; + int &j = i; + int *k = &j; + int *&z = k; + int aa[10]; +#pragma omp target data map(i) use_device_ptr // expected-error {{expected '(' after 'use_device_ptr'}} + {} +#pragma omp target data map(i) use_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} + {} +#pragma omp target data map(i) use_device_ptr() // expected-error {{expected expression}} + {} +#pragma omp target data map(i) use_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}} + {} +#pragma omp target data map(i) use_device_ptr(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{item used in 'use_device_pointer' clause is not a pointer}} + {} +#pragma omp target data map(i) use_device_ptr(i) // expected-error {{}} + {} +#pragma omp target data map(i) use_device_ptr(j) // expected-error {{}} + {} +#pragma omp target data map(i) use_device_ptr(k) // OK + {} +#pragma omp target data map(i) use_device_ptr(z) // OK + {} +#pragma omp target data map(i) use_device_ptr(aa) // expected-error{{}} + {} +#pragma omp target data map(i) use_device_ptr(e) // expected-error{{}} + {} +#pragma omp target data map(i) use_device_ptr(g) // expected-error{{}} + {} +#pragma omp target data map(i) use_device_ptr(k,i,j) // expected-error2 {{item used in 'use_device_pointer' clause is not a pointer}} + {} +#pragma omp target data map(i) use_device_ptr(d) // expected-error{{}} + {} +#pragma omp target data map(i) use_device_ptr(da) // expected-error{{}} + {} + return tmain(argc); // expected-note {{in instantiation of function template specialization 'tmain' requested here}} +} + Index: tools/libclang/CIndex.cpp =================================================================== --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -2262,6 +2262,12 @@ void OMPClauseEnqueue::VisitOMPFromClause(const OMPFromClause *C) { VisitOMPClauseList(C); } +void OMPClauseEnqueue::VisitOMPUseDevicePtrClause(const OMPUseDevicePtrClause *C) { + VisitOMPClauseList(C); + for (const auto *E : C->private_copies()) { + Visitor->AddStmt(E); + } +} } void EnqueueVisitor::EnqueueChildren(const OMPClause *S) {