================
@@ -7146,15 +7148,16 @@ static void checkAliasAttr(Sema &S, NamedDecl &ND) {
}
static void checkSelectAnyAttr(Sema &S, NamedDecl &ND) {
- // 'selectany' only applies to externally visible variable declarations.
- // It does not apply to functions.
- if (SelectAnyAttr *Attr = ND.getAttr<SelectAnyAttr>()) {
- if (isa<FunctionDecl>(ND) || !ND.isExternallyVisible()) {
- S.Diag(Attr->getLocation(),
- diag::err_attribute_selectany_non_extern_data);
- ND.dropAttr<SelectAnyAttr>();
- }
- }
+ SelectAnyAttr *Attr = ND.getAttr<SelectAnyAttr>();
+ if (!Attr)
+ return;
+
+ if (auto *VD = dyn_cast<VarDecl>(&ND))
+ if (!VD->isStaticDataMember() && VD->isExternallyVisible())
+ return;
----------------
AaronBallman wrote:
```suggestion
if (const auto *VD = dyn_cast<VarDecl>(&ND); VD &&!VD->isStaticDataMember()
&& VD->isExternallyVisible())
return;
```
Needs to be reformatted though.
https://github.com/llvm/llvm-project/pull/189641
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits