================ @@ -7353,13 +7353,26 @@ void emitReadOnlyPlacementAttrWarning(Sema &S, const VarDecl *VD) { } } -// Checks if VD is declared at global scope or with C language linkage. -static bool isMainVar(DeclarationName Name, VarDecl *VD) { - return Name.getAsIdentifierInfo() && - Name.getAsIdentifierInfo()->isStr("main") && - !VD->getDescribedVarTemplate() && - (VD->getDeclContext()->getRedeclContext()->isTranslationUnit() || - VD->isExternC()); +enum MainVarClassificationKind { + IMV_NotMain, + IMV_GlobalMain, + IMV_CLinkageMain, +}; ---------------- Sirraide wrote:
I don’t think this needs to exist: 1. We’re not even using all of these enumerators. 2. We test for them in exactly one place. 3. The test in question ends up being more complex as a result. It was fine the way it was before, so I’d suggest you just revert this commit. (Also, for future reference, we prefer scoped enumerations these days.) https://github.com/llvm/llvm-project/pull/101853 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits