[PATCH] D84855: [flang] Make interactive behaviour more obvious

Richard Barton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 08:36:36 PDT 2020


richard.barton.arm created this revision.
Herald added a reviewer: DavidTruby.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
richard.barton.arm requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84855

Files:
  flang/test/Driver/Inputs/hello.f90
  flang/test/Driver/no_files.f90
  flang/tools/f18/f18.cpp


Index: flang/tools/f18/f18.cpp
===================================================================
--- flang/tools/f18/f18.cpp
+++ flang/tools/f18/f18.cpp
@@ -686,6 +686,8 @@
   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;
   }
Index: flang/test/Driver/no_files.f90
===================================================================
--- /dev/null
+++ 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
Index: flang/test/Driver/Inputs/hello.f90
===================================================================
--- /dev/null
+++ flang/test/Driver/Inputs/hello.f90
@@ -0,0 +1,3 @@
+program hello
+  write (*,*), "hello world" 
+end program hello


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84855.281615.patch
Type: text/x-patch
Size: 1157 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200729/92854f4d/attachment.bin>


More information about the llvm-commits mailing list