Flang "line" preprocessor directive contains information about original source file. Currently this information is missed when user compiles code with -save-temps flag. In consequence we observe:
- Different location of the syntax error. If -save-temps flag is attached then Flang reports error in the preprocessed file
- Different debug info. If -save-temps flag is attached then debug info points to preprocessed code (not to the original source file)
- Mismatch of OpenMP offloading functions names when -save-temps flag is attached because OpenMP offloading function names depend on the name of the source file. For target offloading Flang generates two preprocessed files (for host and the device).
This patch aims to solve these issues by adding support of Flang "line" directive. "line" directive holds information about original source file. If we process "line" directive then we can be sure that the location of the tokens is independent from the status of -save-temps flag.
Detailed discussion about Flang preprocessor and the issues related to token location for Flang and -save-temps file can be found here: https://discourse.llvm.org/t/rfc-flang-improve-debug-information-user-error-messages-and-fix-openmp-function-mismatch-for-save-temps-flag/71417
Nit: Use braced initialization in the frontend here and elsewhere where it is applicable.