[clang] [Clang] strengthen checks for 'main' function to meet [basic.start.main] p3 requirements (PR #101853)
Oleksandr T. via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 7 09:32:45 PDT 2024
================
@@ -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,
+};
----------------
a-tarasyuk wrote:
@Sirraide Oke, reverted.
https://github.com/llvm/llvm-project/pull/101853
More information about the cfe-commits
mailing list