[clang] [NFC][clang][Driver] Add tests for --driver-mode=flang (PR #207658)

Yusuke MINATO via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 6 18:14:11 PDT 2026


================
@@ -5,3 +5,10 @@
 ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90"
 ! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}clang{{[^"/]*}}" "-cc1"
 ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/other.c"
+
+! RUN: not %clang --driver-mode=flang -### -Xflang -std=f2018 %S/Inputs/one.f90 -Xclang -std=c17 %S/Inputs/other.c 2>&1 | FileCheck --check-prefixes=MIXED-OPT %s
+! MIXED-OPT: clang: error: unknown argument '-Xclang'
+! MIXED-OPT-NOT: "{{[^"]*}}flang{{[^"/]*}}" "-fc1"
+! MIXED-OPT-NOT: "-std=f2018"
+! MIXED-OPT-NOT: "{{[^"]*}}clang{{[^"/]*}}" "-cc1"
+! MIXED-OPT-NOT: "-std=c17"
----------------
yus3710-fj wrote:

I am considering verifying that the driver invokes the appropriate frontends for each file and does not distribute flags intended for them.
As you mentioned, checking both the error message and the absence of the invocations is redundant. However, I would prefer to remove the check for the error message. What are your thoughts on this?

https://github.com/llvm/llvm-project/pull/207658


More information about the cfe-commits mailing list