[llvm-branch-commits] [flang] dfc8459 - [flang] Make interactive behaviour more obvious
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Aug 18 03:06:28 PDT 2020
Author: Richard Barton
Date: 2020-08-18T11:58:20+02:00
New Revision: dfc845904b27d5da3b6ae7a389ade01590454331
URL: https://github.com/llvm/llvm-project/commit/dfc845904b27d5da3b6ae7a389ade01590454331
DIFF: https://github.com/llvm/llvm-project/commit/dfc845904b27d5da3b6ae7a389ade01590454331.diff
LOG: [flang] Make interactive behaviour more obvious
When flang is invoked with no files it waits for input on stdin. Make it
print a message saying this to prevent the user being surprised.
Differential Revision: https://reviews.llvm.org/D84855
(cherry picked from commit dd5ea5674b86bade4904fab4c66a1156b3df033e)
Added:
flang/test/Driver/Inputs/hello.f90
flang/test/Driver/no_files.f90
Modified:
flang/tools/f18/f18.cpp
Removed:
################################################################################
diff --git a/flang/test/Driver/Inputs/hello.f90 b/flang/test/Driver/Inputs/hello.f90
new file mode 100644
index 000000000000..d0c7eb94f53c
--- /dev/null
+++ b/flang/test/Driver/Inputs/hello.f90
@@ -0,0 +1,3 @@
+program hello
+ write (*,*), "hello world"
+end program hello
diff --git a/flang/test/Driver/no_files.f90 b/flang/test/Driver/no_files.f90
new file mode 100644
index 000000000000..718985dce4ca
--- /dev/null
+++ b/flang/test/Driver/no_files.f90
@@ -0,0 +1,10 @@
+! RUN: %f18 < %S/Inputs/hello.f90 | FileCheck %s
+
+
+! CHECK: Enter Fortran source
+! CHECK: Use EOF character (^D) to end file
+
+! CHECK: Parse tree comprises {{.*}} objects and occupies {{.*}} total bytes
+! CHECK: PROGRAM hello
+! CHECK: WRITE (*, *) "hello world"
+! CHECK: END PROGRAM hello
diff --git a/flang/tools/f18/f18.cpp b/flang/tools/f18/f18.cpp
index 77af3964bba8..83db520d8ff9 100644
--- a/flang/tools/f18/f18.cpp
+++ b/flang/tools/f18/f18.cpp
@@ -683,6 +683,8 @@ int main(int argc, char *const argv[]) {
if (!anyFiles) {
driver.measureTree = true;
driver.dumpUnparse = true;
+ llvm::outs() << "Enter Fortran source\n"
+ << "Use EOF character (^D) to end file\n";
CompileFortran("-", options, driver, defaultKinds);
return exitStatus;
}
More information about the llvm-branch-commits
mailing list