================ @@ -23352,6 +23352,15 @@ void Sema::ActOnOpenMPDeclareTargetName(NamedDecl *ND, SourceLocation Loc, isa<FunctionTemplateDecl>(ND)) && "Expected variable, function or function template."); + if (auto *VD = dyn_cast<VarDecl>(ND)) { ---------------- sandeepkosuri wrote:
previously `ActOnOpenMPDeclareTargetName` was called for variables of file scope, I guess that's why there was no check to guard against local variables at this point. `checkDeclIsAllowedInOpenMPTarget` is called after giving the `OMPDeclareTargetDeclAttr` to the variable, so it does not filter out local vars from getting that attribute. https://github.com/llvm/llvm-project/pull/83223 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits