Skip to content

Commit

Permalink
[flang] Make interactive behaviour more obvious
Browse files Browse the repository at this point in the history
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
  • Loading branch information
RichBarton-Arm committed Jul 31, 2020
1 parent 57bd64f commit dd5ea56
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions flang/test/Driver/Inputs/hello.f90
@@ -0,0 +1,3 @@
program hello
write (*,*), "hello world"
end program hello
10 changes: 10 additions & 0 deletions 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
2 changes: 2 additions & 0 deletions flang/tools/f18/f18.cpp
Expand Up @@ -686,6 +686,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;
}
Expand Down

0 comments on commit dd5ea56

Please sign in to comment.