================ @@ -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(); + ---------------- AaronBallman wrote:
I think this code should live in `handleConstructorAttr()` and `handleDestructorAttr()` instead. (The above code should live there as well, I suspect). 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