This is an archive of the discontinued LLVM Phabricator instance.

[flang][driver] Add -fdebug-module-writer option
ClosedPublic

Authored by arnamoy10 on Feb 17 2021, 9:28 AM.

Details

Summary

Add support for the following f18 options:

  • -fdebug-module-writer

We also add a new Setter for the -J/module-dir option.

Diff Detail

Event Timeline

arnamoy10 created this revision.Feb 17 2021, 9:28 AM
arnamoy10 requested review of this revision.Feb 17 2021, 9:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2021, 9:28 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tskeith added inline comments.Feb 17 2021, 9:58 AM
flang/lib/Frontend/CompilerInvocation.cpp
299

In my opinion, using mutable references like this make the code hard to understand. Setters on CompilerInvocation would be clearer.

flang/test/Semantics/mod-file-rewriter.f90
6

Why do you need to duplicate these lines? Doesn't it work to use %flang?

arnamoy10 updated this revision to Diff 324606.Feb 18 2021, 5:38 AM

Added some setters to work with.

Modified the test case to include flang-new -fc1 as well.

flang/test/Semantics/mod-file-rewriter.f90
6

%flang will unfortunately invoke f18 currently.

Thank you for submitting this @arnamoy10 ! Comments inline.

clang/include/clang/Driver/Options.td
4247–4248

IMO this should be a frontend-only option. Compiler end-users are unlikely to need this in their regular workflows, right? I recommend moving it here.

flang/test/Semantics/mod-file-rewriter.f90
6

That depends on the value of FLANG_BUILD_NEW_DRIVER, which is translated into include_flang_new_driver_test here. I also think that this should work fine with %flang.

Also, I suggest that we only have tests with flang_fc1 and keep this as a frontend-only option.

arnamoy10 added inline comments.Feb 18 2021, 6:11 AM
clang/include/clang/Driver/Options.td
4247–4248

Yes, it makes sense to keep it as frontend-only option, let me submit an updated patch.

flang/test/Semantics/mod-file-rewriter.f90
6

Sounds good.

arnamoy10 updated this revision to Diff 324949.Feb 19 2021, 4:46 AM

Set the option as a frontend-only option, also modified the test case accordingly.

arnamoy10 edited the summary of this revision. (Show Details)Feb 19 2021, 12:27 PM
awarzynski added inline comments.Mar 1 2021, 11:10 AM
clang/include/clang/Driver/Options.td
4280–4281

[nit] The convention here seems to be: no . at the end
[nit] Perhaps a bit shorter: Enable debug messages while writhing module files?

flang/include/flang/Frontend/CompilerInvocation.h
73–74

[nit] One empty line instead of 2

flang/lib/Frontend/CompilerInvocation.cpp
297–298

Unrelated change

arnamoy10 edited the summary of this revision. (Show Details)Mar 1 2021, 11:19 AM
arnamoy10 updated this revision to Diff 327230.Mar 1 2021, 11:59 AM

Minor changes as per comments, also updated commit message to include description of changes related to Setters.

awarzynski accepted this revision.EditedMar 5 2021, 9:58 AM

LGTM, thank you!

(I believe that you've addressed all of Tim's comments too, but please wait a bit before merging in case I missed something)

This revision is now accepted and ready to land.Mar 5 2021, 9:58 AM

OK, I will merge it on Monday unless @tskeith has any other comments.

clang/include/clang/Driver/Options.td
4247–4248

IMO this should be a frontend-only option. Compiler end-users are unlikely to need this in their regular workflows, right? I recommend moving it here.

tskeith accepted this revision.Mar 5 2021, 2:18 PM

LGTM

arnamoy10 updated this revision to Diff 329100.Mar 8 2021, 12:23 PM

Rebasing on main

This has been merged, closing it.

arnamoy10 closed this revision.Mar 19 2021, 6:15 AM