
When using `--save-temps`, flang-new emits (among other things) an `<input>.i` file. These `.i` files are pre-processed Fortran files containing information about the modules referenced by the input source (these files are emitted by: `Parsing::EmitPreprocessedSource`). This diff allows `.i` files emitted by flang-new to be treated as valid files in the pre-processing phase. This, in turn, allows flang-new to add pre-processing options (e.g. `-I`) when launching compilation jobs for these files. This solves a bug when using `--save-temps` with source files that include modules from non-standard directories, for example: ``` flang-new -c --save-temps -I/tmp/module_dir -fno-integrated-as \ /tmp/ModuleUser.f90 ``` The problem was that `.i` files were treated as "binary" files and therefore the return value for `types::getPreprocessedType(InputType)` in `Flang::ConstructJob(...)` was `types::TY_INVALID`.
27 lines
635 B
Fortran
27 lines
635 B
Fortran
! Tests that `--save-temps` works properly when a module from a non standard dir
|
|
! is included with `-I/...`.
|
|
|
|
! RUN: rm -rf %t && split-file %s %t
|
|
! RUN: mkdir %t/mod_inc_dir
|
|
! RUN: mv %t/somemodule.mod %t/mod_inc_dir
|
|
! RUN: %flang -S -emit-llvm --save-temps=obj -I%t/mod_inc_dir -fno-integrated-as \
|
|
! RUN: %t/ModuleUser.f90 -o %t/ModuleUser
|
|
! RUN: ls %t | FileCheck %s
|
|
|
|
! Verify that the temp file(s) were written to disk.
|
|
! CHECK: ModuleUser.i
|
|
|
|
!--- somemodule.mod
|
|
!mod$ v1 sum:e9e8fd2bd49e8daa
|
|
module SomeModule
|
|
|
|
end module SomeModule
|
|
!--- ModuleUser.f90
|
|
|
|
module User
|
|
use SomeModule
|
|
end module User
|
|
|
|
program dummy
|
|
end program
|