aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorAndrzej Warzynski <andrzej.warzynski@arm.com>2022-06-06 17:57:33 +0000
committerAndrzej Warzynski <andrzej.warzynski@arm.com>2022-06-10 10:36:25 +0000
commit3e782ba21be4b88c761d3b0854df130d7ca08a56 (patch)
treef3430775a084e09c5cf669a3f066964c08eea7b5 /flang/lib/Frontend/CompilerInvocation.cpp
parentceb21fa4e49ddc8478371b41250f206082c5c67e (diff)
downloadllvm-3e782ba21be4b88c761d3b0854df130d7ca08a56.zip
llvm-3e782ba21be4b88c761d3b0854df130d7ca08a56.tar.gz
llvm-3e782ba21be4b88c761d3b0854df130d7ca08a56.tar.bz2
[flang][driver] Fix support for `-x`
Until now, `-x` wasn't really taken into account in Flang's compiler and frontend drivers. `flang-new` and `flang-new -fc1` only recently gained powers to consume inputs other than Fortran files and that's probably why this hasn't been noticed yet. This patch makes sure that `-x` is supported correctly and consistently with Clang. To this end, verification is added when reading LLVM IR files (i.e. IR modules are verified with `llvm::verifyModule`). This way, LLVM IR parsing errors are correctly reported to Flang users. This also aids testing. With the new functionality, we can verify that `-x ir` breaks compilation for e.g. Fortran files and vice-versa. Tests are updated accordingly. Differential Revision: https://reviews.llvm.org/D127207
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 9ea4810..cc376f3 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -263,7 +263,10 @@ static bool parseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
llvm::StringRef xValue = a->getValue();
// Principal languages.
dashX = llvm::StringSwitch<InputKind>(xValue)
- .Case("f90", Language::Fortran)
+ // Flang does not differentiate between pre-processed and not
+ // pre-processed inputs.
+ .Case("f95", Language::Fortran)
+ .Case("f95-cpp-input", Language::Fortran)
.Default(Language::Unknown);
// Some special cases cannot be combined with suffixes.