[clang] [NFC][clang][Driver] Add tests for --driver-mode=flang (PR #207658)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 5 23:06:35 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Yusuke MINATO (yus3710-fj)
<details>
<summary>Changes</summary>
This patch intends to clarify the current behaviors, not to state the expected/desirable behaviors.
---
Full diff: https://github.com/llvm/llvm-project/pull/207658.diff
2 Files Affected:
- (modified) clang/test/Driver/flang/multiple-inputs-mixed.f90 (+7)
- (added) clang/test/Driver/flang/runtimes.f90 (+8)
``````````diff
diff --git a/clang/test/Driver/flang/multiple-inputs-mixed.f90 b/clang/test/Driver/flang/multiple-inputs-mixed.f90
index 98d8cab00bdfd..25321cd1fcf02 100644
--- a/clang/test/Driver/flang/multiple-inputs-mixed.f90
+++ b/clang/test/Driver/flang/multiple-inputs-mixed.f90
@@ -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"
diff --git a/clang/test/Driver/flang/runtimes.f90 b/clang/test/Driver/flang/runtimes.f90
new file mode 100644
index 0000000000000..7300bba75e2da
--- /dev/null
+++ b/clang/test/Driver/flang/runtimes.f90
@@ -0,0 +1,8 @@
+! Check that Flang runtimes are passed to the linker in --driver-mode=flang.
+
+! RUN: %clang --driver-mode=flang --rtlib=compiler-rt -### %s 2>&1 | FileCheck %s
+! CHECK-DAG: clang_rt.{{[^ "]}}
+! CHECK-DAG: flang_rt.{{[^ "]}}
+
+! RUN: not %clang --driver-mode=flang -stdlib=libc++ -### %s 2>&1 | FileCheck --check-prefix=LIBCXX %s
+! LIBCXX: clang: error: unknown argument: '-stdlib=libc++'
``````````
</details>
https://github.com/llvm/llvm-project/pull/207658
More information about the cfe-commits
mailing list