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

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 8 11:59:08 PST 2017


ABataev added inline comments.


================
Comment at: lib/Sema/SemaOpenMP.cpp:12671
+void Sema::checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D,
+                                            const DeclarationNameInfo *Id) {
   if (!D || D->isInvalidDecl())
----------------
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`


https://reviews.llvm.org/D40968





More information about the cfe-commits mailing list