diff options
author | Andrzej Warzynski <andrzej.warzynski@arm.com> | 2020-12-08 16:27:46 +0000 |
---|---|---|
committer | Andrzej Warzynski <andrzej.warzynski@arm.com> | 2020-12-18 09:35:02 +0000 |
commit | 7d246cb19db9fce65946fb4bac6e570787dbe78a (patch) | |
tree | e8da8be1693c31eb9d97634cdb1861ef541b33a5 /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | 95d3cc67caac04668ef808f65c30ced60ed14f5d (diff) | |
download | llvm-7d246cb19db9fce65946fb4bac6e570787dbe78a.zip llvm-7d246cb19db9fce65946fb4bac6e570787dbe78a.tar.gz llvm-7d246cb19db9fce65946fb4bac6e570787dbe78a.tar.bz2 |
[flang][driver] Add support for `-fsyntax-only`
The behaviour triggered with this flag is consistent with `-fparse-only`
in `flang` (i.e. the throwaway driver). This new spelling is consistent
with Clang and gfortran, and was proposed and agreed on for the new
driver in [1].
This patch also adds some minimal logic to communicate whether the
semantic checks have failed or not. When semantic checks fail, a
frontend driver error is generated. The return code from the frontend
driver is then determined by checking the driver diagnostics - the
presence of driver errors means that the compilation has failed. This
logic is consistent with `clang -cc1`.
[1] http://lists.llvm.org/pipermail/flang-dev/2020-November/000588.html
Differential Revision: https://reviews.llvm.org/D92854
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | flang/lib/Frontend/CompilerInvocation.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index 8a6f661..db3ae741 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -93,6 +93,9 @@ static InputKind ParseFrontendArgs(FrontendOptions &opts, case clang::driver::options::OPT_E: opts.programAction_ = PrintPreprocessedInput; break; + case clang::driver::options::OPT_fsyntax_only: + opts.programAction_ = ParseSyntaxOnly; + break; // TODO: // case clang::driver::options::OPT_emit_obj: |