[PATCH] D92854: [flang][driver] Add support for `-fsyntax-only`

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 15 08:44:12 PST 2020


awarzynski added inline comments.


================
Comment at: flang/lib/Frontend/FrontendActions.cpp:87
+      defaultKinds, features, ci.allCookedSources()};
+  semanticsContext.set_moduleDirectory("."s);
+  Fortran::semantics::Semantics semantics{
----------------
CarolineConcatto wrote:
> Just a quick question:
> Why you cannot use this function:
> CompilerInvocation::SetDefaultFortranOpts
> instead of using  semanticsContext.set_moduleDirectory("."s);
> ?
Hard-coded values are bad, thanks for pointing that out!

We can't use `CompilerInvocation::SetDefaultFortranOpts` here, as that's for `Fortran::parser::Options`, and here we are dealing with the internal state of `Fortran::semantics::SemanticsContext`. 

However, `moduleDirectory_` is in fact initialised to `"."s` by default: https://github.com/llvm/llvm-project/blob/8acb5f2723ecaf0f1904a085ad79d0623cec38f6/flang/include/flang/Semantics/semantics.h#L185. 

So, it's safe to delete this line for now. A proper solution/approach will be implemented once we add support for `-module-dir`: https://docs.google.com/spreadsheets/d/1JRe39lP_KhtkYxFEIvwrCFlE5v1Ofa_krOHI-XXXWPY/edit#gid=0.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92854/new/

https://reviews.llvm.org/D92854



More information about the cfe-commits mailing list