diff options
author | Andrzej Warzynski <andrzej.warzynski@arm.com> | 2021-06-04 15:25:58 +0100 |
---|---|---|
committer | Andrzej Warzynski <andrzej.warzynski@arm.com> | 2021-06-25 13:28:12 +0100 |
commit | 2a7bb8494e9c58b44ad7142d8d309455cd669603 (patch) | |
tree | 14bb27bb09e1ce3f845d668fb088dccbe4ecd5fe /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | f7b1fa6f5ebec5780e626aa48d582f2519a01632 (diff) | |
download | llvm-2a7bb8494e9c58b44ad7142d8d309455cd669603.zip llvm-2a7bb8494e9c58b44ad7142d8d309455cd669603.tar.gz llvm-2a7bb8494e9c58b44ad7142d8d309455cd669603.tar.bz2 |
[flang][driver] Add `-fno-analyzed-objects-for-unparse`
This patch adds a new option for the new Flang driver:
`-fno-analyzed-objects-for-unparse`. The semantics are similar to
`-funparse-typed-exprs-to-f18-fc` from `f18`. For consistency, the
latter is replaced with `-fno-analyzed-objects-for-unparse`.
The new option controls the behaviour of the unparser (i.e. the action
corresponding to `-fdebug-unparse`). The default behaviour is to use the
analyzed objects when unparsing. The new flag can be used to turn this
off, so that the original parse-tree objects are used. The analyzed
objects are generated during the semantic checks [1].
This patch also updates the semantics of
`-fno-analyzed-objects-for-unparse`/`-funparse-typed-exprs-to-f18-fc`
in `f18`, so that this flag is always taken into account when `Unparse`
is used (this way the semantics in `f18` and `flang-new` are identical).
The added test file is based on example from Peter Steinfeld.
[1]
https://github.com/llvm/llvm-project/blob/main/flang/docs/Semantics.md
Differential Revision: https://reviews.llvm.org/D103612
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | flang/lib/Frontend/CompilerInvocation.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index dc771ec..6a2bf19 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -404,6 +404,12 @@ static bool parseSemaArgs(CompilerInvocation &res, llvm::opt::ArgList &args, res.SetModuleFileSuffix(moduleSuffix->getValue()); } + // -fno-analyzed-objects-for-unparse + if (args.hasArg( + clang::driver::options::OPT_fno_analyzed_objects_for_unparse)) { + res.SetUseAnalyzedObjectsForUnparse(false); + } + return diags.getNumErrors() == numErrorsBefore; } |