[clang] [clang] [modules] Add err_main_in_named_module (PR #146635)

2025-07-02 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: Please make sure the libc++ tests won't get affected. I am not sure if the modules related tests in libc++ run by default. https://github.com/llvm/llvm-project/pull/146635 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

[clang] [clang] [modules] Add err_main_in_named_module (PR #146635)

2025-07-02 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 edited https://github.com/llvm/llvm-project/pull/146635 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] [modules] Add err_main_in_named_module (PR #146635)

2025-07-02 Thread Chuanqi Xu via cfe-commits
@@ -12486,6 +12486,14 @@ void Sema::CheckMain(FunctionDecl *FD, const DeclSpec &DS) { : FixItHint()); FD->setInvalidDecl(true); } + +// In C++ [basic.start.main]p3, it is said a program attaching main to a +// named module is i

[clang] [clang] [modules] Add err_main_in_named_module (PR #146635)

2025-07-02 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/146635 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] [modules] Add err_main_in_named_module (PR #146635)

2025-07-02 Thread Corentin Jabot via cfe-commits
@@ -1062,6 +1062,10 @@ def err_constexpr_main : Error< "'main' is not allowed to be declared %select{constexpr|consteval}0">; def err_deleted_main : Error<"'main' is not allowed to be deleted">; def err_mainlike_template_decl : Error<"%0 cannot be a template">; +def warn_main

[clang] [clang] [modules] Add err_main_in_named_module (PR #146635)

2025-07-01 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-driver Author: Ashwin Banwari (ashwinbanwari) Changes Revival of https://github.com/llvm/llvm-project/pull/146247 which got reverted for broken test. Now that https://github.com/llvm/llvm-project/pull/146461 is merged to allow `extern "C++"` for

[clang] [clang] [modules] Add err_main_in_named_module (PR #146635)

2025-07-01 Thread Ashwin Banwari via cfe-commits
https://github.com/ashwinbanwari edited https://github.com/llvm/llvm-project/pull/146635 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] [modules] Add err_main_in_named_module (PR #146635)

2025-07-01 Thread Ashwin Banwari via cfe-commits
https://github.com/ashwinbanwari created https://github.com/llvm/llvm-project/pull/146635 Revival of https://github.com/llvm/llvm-project/pull/146247. Now that https://github.com/llvm/llvm-project/pull/146461 is merged to allow `extern "C++"` for main, we can merge this change. >From 76bd9279