Timm =?utf-8?q?Bäder?= <tbae...@redhat.com> Message-ID: In-Reply-To: <llvm/llvm-project/pull/67095/cl...@github.com>
================ @@ -8141,6 +8141,16 @@ static void handleRequiresCapabilityAttr(Sema &S, Decl *D, if (!AL.checkAtLeastNumArgs(S, 1)) return; + // We allow this on function declaration as well as + // variable declarations of function pointer type. + if (!D->isFunctionPointerType() && !isa<FunctionDecl>(D)) { ---------------- tbaederr wrote: Yeah we attach the attribute to the declaration later in this function: ```c++ RequiresCapabilityAttr *RCA = ::new (S.Context) RequiresCapabilityAttr(S.Context, AL, Args.data(), Args.size()); D->addAttr(RCA); ``` and in `ThreadSafety.cpp` we then check the decl for the attribute in `VisitCallExpr()`: ```c++ auto *D = dyn_cast_or_null<NamedDecl>(Exp->getCalleeDecl()); if(!D || !D->hasAttrs()) return; ``` for the function pointer case, `D` will be the `VarDecl`, which now has the attribute attached. https://github.com/llvm/llvm-project/pull/67095 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits