================ @@ -79,7 +79,14 @@ TYPE("c++-module-cpp-output", PP_CXXModule, INVALID, "iim", phases TYPE("ada", Ada, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link) TYPE("assembler", PP_Asm, INVALID, "s", phases::Assemble, phases::Link) TYPE("assembler-with-cpp", Asm, PP_Asm, "S", phases::Preprocess, phases::Assemble, phases::Link) -TYPE("f95", PP_Fortran, INVALID, "i", phases::Compile, phases::Backend, phases::Assemble, phases::Link) + +// Note: The `phases::Preprocess` phase is added to ".i" (i.e. +// Fortran pre-processed) files. The reason is that Fortran +// pre-processed files need further pre-proecessing when they +// include modules from non-standard paths. In particular, we +// need to add the search paths for these modules when flang +// needs to emits pre-processed files. ---------------- banach-space wrote:
> (...) The reason is that Fortran // pre-processed files Could you clarify that this isn't really about "Fortran pre-processed files", but more about "Fortran files pre-processed by LLVM Flang"? > need further pre-proecessing when they // include modules from non-standard paths This is a bit misleading. IIUC, no further pre-processing happens, but the pre-processor "phase" has to be re-run to make sure that e.g. the include flags (i.e. `-I <dir>`) are preserved. That's because these include paths will contain module files (could `-I <dir>` define any other dirs?) and, unlike C header files, these module files wouldn't be included in the pre-processed file. Please also add a note that `PP_TYPE` is set to `PP_Fortran` so that the driver is fine with "pre-processing a pre-processed file". Hope this makes sense and apologies if I come across as pedantic. I just find this quite tricky and want to make sure that we throughly document these quirks for our future selves :) https://github.com/llvm/llvm-project/pull/104664 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits