[PATCH] D97164: [flang] Add -J and -module-dir to f18 driver
Tim Keith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 21 20:47:47 PST 2021
tskeith updated this revision to Diff 325368.
tskeith added a comment.
Remove f18 test from test/Flang-Driver/write-module.f90.
Clean up the rest of that test.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97164/new/
https://reviews.llvm.org/D97164
Files:
flang/test/Driver/write-module.f90
flang/test/Flang-Driver/write-module.f90
flang/tools/f18/f18.cpp
Index: flang/tools/f18/f18.cpp
===================================================================
--- flang/tools/f18/f18.cpp
+++ flang/tools/f18/f18.cpp
@@ -583,6 +583,10 @@
} else if (arg == "-module") {
driver.moduleDirectory = args.front();
args.pop_front();
+ } else if (arg == "-module-dir") {
+ driver.moduleDirectory = args.front();
+ driver.searchDirectories.push_back(driver.moduleDirectory);
+ args.pop_front();
} else if (arg == "-module-suffix") {
driver.moduleFileSuffix = args.front();
args.pop_front();
@@ -654,7 +658,8 @@
<< " -module dir module output directory (default .)\n"
<< " -flatin interpret source as Latin-1 (ISO 8859-1) "
"rather than UTF-8\n"
- << " -fsyntax-only parsing and semantics only, no output except messages\n"
+ << " -fsyntax-only parsing and semantics only, no output "
+ "except messages\n"
<< " -funparse parse & reformat only, no code "
"generation\n"
<< " -funparse-with-symbols parse, resolve symbols, and unparse\n"
@@ -691,6 +696,14 @@
args.pop_front();
} else if (arg.substr(0, 2) == "-I") {
driver.searchDirectories.push_back(arg.substr(2));
+ } else if (arg == "-J") {
+ driver.F18_FCArgs.push_back(args.front());
+ driver.moduleDirectory = args.front();
+ driver.searchDirectories.push_back(driver.moduleDirectory);
+ args.pop_front();
+ } else if (arg.substr(0, 2) == "-J") {
+ driver.moduleDirectory = arg.substr(2);
+ driver.searchDirectories.push_back(driver.moduleDirectory);
}
}
}
Index: flang/test/Flang-Driver/write-module.f90
===================================================================
--- flang/test/Flang-Driver/write-module.f90
+++ flang/test/Flang-Driver/write-module.f90
@@ -1,8 +1,6 @@
-! RUN: mkdir -p %t/dir-f18 && %f18 -fparse-only -I tools/flang/include/flang -module %t/dir-f18 %s 2>&1
-! RUN: ls %t/dir-f18/testmodule.mod && not ls %t/testmodule.mod
-
-! RUN: mkdir -p %t/dir-flang-new && %flang-new -fsyntax-only -module-dir %t/dir-flang-new %s 2>&1
-! RUN: ls %t/dir-flang-new/testmodule.mod && not ls %t/testmodule.mod
+! RUN: rm -rf %t && mkdir -p %t/dir-flang
+! RUN: cd %t && %flang -fsyntax-only -module-dir %t/dir-flang %s
+! RUN: ls %t/dir-flang/testmodule.mod && not ls %t/testmodule.mod
module testmodule
type::t2
Index: flang/test/Driver/write-module.f90
===================================================================
--- /dev/null
+++ flang/test/Driver/write-module.f90
@@ -0,0 +1,19 @@
+! RUN: rm -rf %t && mkdir -p %t/mod-dir && cd %t && %f18 -fparse-only %s
+! RUN: ls %t/testmodule.mod && not ls %t/mod-dir/testmodule.mod
+
+! RUN: rm -rf %t && mkdir -p %t/mod-dir && cd %t && %f18 -fparse-only -module mod-dir %s
+! RUN: ls %t/mod-dir/testmodule.mod && not ls %t/testmodule.mod
+
+! RUN: rm -rf %t && mkdir -p %t/mod-dir && cd %t && %f18 -fparse-only -module-dir mod-dir %s
+! RUN: ls %t/mod-dir/testmodule.mod && not ls %t/testmodule.mod
+
+! RUN: rm -rf %t && mkdir -p %t/mod-dir && cd %t && %f18 -fparse-only -J mod-dir %s
+! RUN: ls %t/mod-dir/testmodule.mod && not ls %t/testmodule.mod
+
+! RUN: rm -rf %t && mkdir -p %t/mod-dir && cd %t && %f18 -fparse-only -Jmod-dir %s
+! RUN: ls %t/mod-dir/testmodule.mod && not ls %t/testmodule.mod
+
+module testmodule
+ type::t2
+ end type
+end
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97164.325368.patch
Type: text/x-patch
Size: 3510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210222/1d847403/attachment.bin>
More information about the llvm-commits
mailing list