[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-23 Thread Justin Bogner via cfe-commits
bogner wrote: I don't really understand the rationale for this, and it's kind of annoying. Most of the compiler's flags behave in the "last one wins" fashion (such as `-O2` and `-O0`) and it's always been convenient to add the flag you want at the end. Why treat action flags any differently?

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-07 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay closed https://github.com/llvm/llvm-project/pull/91140 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-07 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. https://github.com/llvm/llvm-project/pull/91140 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-06 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. This looks good to me, please give this a day or so for any conversations to die down. https://github.com/llvm/llvm-project/pull/91140 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-06 Thread Fangrui Song via cfe-commits
MaskRay wrote: > CI seems to have noticed what I feared :) This is going to hit a good amount > of our internal tests, there is no way our copy-paste cargo-cult didn't come > up with this before. This one-liner might be useful to auto fix some downstream tests... ``` xargs sed -Ei

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-06 Thread Fangrui Song via cfe-commits
MaskRay wrote: > This sounds good in principle, but some tests are failing in CI, so this > might need more refinement. There were `%clang_analyze_cc1 -analyze` (redundant `-analyze`) errors. Fixed by e4d242768aefabc0091dd01fabecaffbc2b6984b https://github.com/llvm/llvm-project/pull/91140

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-06 Thread Fangrui Song via cfe-commits
@@ -134,6 +134,8 @@ def err_fe_no_pch_in_dir : Error< "no suitable precompiled header file found in directory '%0'">; def err_fe_action_not_available : Error< "action %0 not compiled in">; +def err_fe_invalid_multiple_actions : Error< +"action %0 is specified,

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-06 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay updated https://github.com/llvm/llvm-project/pull/91140 >From c8677337fbcc6a1456466e65dd847f9317f16a4f Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 5 May 2024 13:06:36 -0700 Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-06 Thread Fangrui Song via cfe-commits
@@ -2841,6 +2841,30 @@ static bool ParseFrontendArgs(FrontendOptions , ArgList , } Opts.ProgramAction = *ProgramAction; + +// Catch common mistakes when multiple actions are specified for cc1 (e.g. +// -S -emit-llvm means -emit-llvm while -emit-llvm -S means

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-06 Thread Erich Keane via cfe-commits
@@ -134,6 +134,8 @@ def err_fe_no_pch_in_dir : Error< "no suitable precompiled header file found in directory '%0'">; def err_fe_action_not_available : Error< "action %0 not compiled in">; +def err_fe_invalid_multiple_actions : Error< +"action %0 is specified,

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-06 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: CI seems to have noticed what I feared :) This is going to hit a good amount of our internal tests, there is no way our copy-paste cargo-cult didn't come up with this before. https://github.com/llvm/llvm-project/pull/91140

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-06 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/91140 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-06 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: This sounds good in principle, but some tests are failing in CI, so this might need more refinement. https://github.com/llvm/llvm-project/pull/91140 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-05 Thread Jan Svoboda via cfe-commits
@@ -2841,6 +2841,30 @@ static bool ParseFrontendArgs(FrontendOptions , ArgList , } Opts.ProgramAction = *ProgramAction; + +// Catch common mistakes when multiple actions are specified for cc1 (e.g. +// -S -emit-llvm means -emit-llvm while -emit-llvm -S means

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

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

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-05 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Fangrui Song (MaskRay) Changes When multiple actions are specified, the last one is used and others are overridden. This might lead to confusion if the user is used to driver's `-S -emit-llvm` behavior. ``` %clang_cc1 -S -emit-llvm a.c

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-05 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/91140 When multiple actions are specified, the last one is used and others are overridden. This might lead to confusion if the user is used to driver's `-S -emit-llvm` behavior. ``` %clang_cc1 -S -emit-llvm a.c #