================ @@ -7596,6 +7596,17 @@ void Sema::ProcessDeclAttributeList( D->setInvalidDecl(); } + // Warn on global constructors and destructors created by attributes. + if (D->hasAttr<ConstructorAttr>() && + !getDiagnostics().isIgnored(diag::warn_global_constructor, + D->getLocation())) + Diag(D->getLocation(), diag::warn_global_constructor) + << D->getSourceRange(); + if (D->hasAttr<DestructorAttr>() && + !getDiagnostics().isIgnored(diag::warn_global_destructor, + D->getLocation())) + Diag(D->getLocation(), diag::warn_global_destructor) << D->getSourceRange(); + ---------------- erichkeane wrote:
Also, why bother checking if it is ignored? We should just emit it, and count on the diagnostics engine to suppress it if it is ignored. We typically only check `isIgnored` if we are going to do 'a lot' of work. https://github.com/llvm/llvm-project/pull/129917 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits