[PATCH] D40968: [OpenMP] Diagnose function name on the link clause

Kelvin Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 8 13:48:31 PST 2017


kkwli0 marked an inline comment as done.
kkwli0 added inline comments.


================
Comment at: lib/Sema/SemaOpenMP.cpp:12671
+void Sema::checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D,
+                                            const DeclarationNameInfo *Id) {
   if (!D || D->isInvalidDecl())
----------------
ABataev wrote:
> kkwli0 wrote:
> > ABataev wrote:
> > > You can get `DeclarationNameInfo` from the `FunctionDecl`:
> > > ```
> > > FD->getNameInfo()
> > > ```
> > This FD->getNameInfo() will only give the name info from the function definition.  What we need here is the name info for 'foo' that appears on the pragma in order to give us
> > 
> > ```
> > d2.c:2:33: error: function name is not allowed in 'link' clause
> > #pragma omp declare target link(foo)
> >                                 ^
> > ```
> Then just pass `SourceLocation`
Sure.


https://reviews.llvm.org/D40968





More information about the cfe-commits mailing list