[flang-commits] [llvm] [clang] [clang-tools-extra] [compiler-rt] [libc] [flang] [libcxx] Add tests for driver to propagate module map flags even without -fmod… (PR #75827)

Walter Lee via flang-commits flang-commits at lists.llvm.org
Tue Dec 19 07:29:04 PST 2023


https://github.com/googlewalt updated https://github.com/llvm/llvm-project/pull/75827

>From 308e72ed9735f739a0993062415301fea0f47b77 Mon Sep 17 00:00:00 2001
From: Walter Lee <waltl at google.com>
Date: Mon, 18 Dec 2023 11:41:43 -0500
Subject: [PATCH] Add tests for driver to propagate module map flags when
 -fno-modules

We rely on this behavior for layering check.  Xcode 14.3.1 seems to
have dropped these flags so we are creating a unit test to reproduce
the issue.
---
 clang/test/Driver/modules.m | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/clang/test/Driver/modules.m b/clang/test/Driver/modules.m
index 9eb3569805569a..7b215bb6d870d6 100644
--- a/clang/test/Driver/modules.m
+++ b/clang/test/Driver/modules.m
@@ -57,6 +57,14 @@
 // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=foo.map"
 // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=bar.map"
 
+// Verify that the driver propagates -fmodule-name and -fmodule-map-file flags even with
+// -fno-modules.  We rely on this behavior for layering check.
+// RUN: %clang -fno-modules -fmodule-name=foo -c -### %s 2>&1 | FileCheck -check-prefix=CHECK-PROPAGATE-MODULE-NAME %s
+// CHECK-PROPAGATE-MODULE-NAME: -fmodule-name=foo
+
+// RUN: %clang -fno-modules -fmodule-map-file=foo.map -c -### %s 2>&1 | FileCheck -check-prefix=CHECK-PROPAGATE-MODULE-MAPS %s
+// CHECK-PROPAGATE-MODULE-MAPS: -fmodule-map-file=foo.map
+
 // RUN: %clang -fmodules -fbuiltin-module-map -### %s 2>&1 | FileCheck -check-prefix=CHECK-BUILTIN-MODULE-MAP %s
 // CHECK-BUILTIN-MODULE-MAP: "-fmodules"
 // CHECK-BUILTIN-MODULE-MAP: "-fmodule-map-file={{.*}}include{{/|\\\\}}module.modulemap"



More information about the flang-commits mailing list