Skip to content

Commit dd5ea56

Browse files
[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
1 parent 57bd64f commit dd5ea56

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

flang/test/Driver/Inputs/hello.f90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
program hello
2+
write (*,*), "hello world"
3+
end program hello

flang/test/Driver/no_files.f90

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
! RUN: %f18 < %S/Inputs/hello.f90 | FileCheck %s
2+
3+
4+
! CHECK: Enter Fortran source
5+
! CHECK: Use EOF character (^D) to end file
6+
7+
! CHECK: Parse tree comprises {{.*}} objects and occupies {{.*}} total bytes
8+
! CHECK: PROGRAM hello
9+
! CHECK: WRITE (*, *) "hello world"
10+
! CHECK: END PROGRAM hello

flang/tools/f18/f18.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,8 @@ int main(int argc, char *const argv[]) {
686686
if (!anyFiles) {
687687
driver.measureTree = true;
688688
driver.dumpUnparse = true;
689+
llvm::outs() << "Enter Fortran source\n"
690+
<< "Use EOF character (^D) to end file\n";
689691
CompileFortran("-", options, driver, defaultKinds);
690692
return exitStatus;
691693
}

0 commit comments

Comments
 (0)