This is an archive of the discontinued LLVM Phabricator instance.

[flang][driver] Make the driver report diagnostics from the prescanner
ClosedPublic

Authored by awarzynski on Jan 15 2021, 7:40 AM.

Details

Summary

This patch makes sure that diagnostics from the prescanner are reported
when running flang-new -E (i.e. only the preprocessor phase is
requested). More specifically, the PrintPreprocessedAction action is
updated.

With this patch we make sure that the f18 and flang-new provide
identical output when running the preprocessor and the prescanner
generates diagnostics.

Depends on: D93453

Diff Detail

Event Timeline

awarzynski created this revision.Jan 15 2021, 7:40 AM
awarzynski requested review of this revision.Jan 15 2021, 7:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 15 2021, 7:40 AM
sameeranjoshi accepted this revision.Jan 20 2021, 1:11 AM
This revision is now accepted and ready to land.Jan 20 2021, 1:11 AM
kiranchandramohan added inline comments.
flang/test/Frontend/preprocessor-diag.f90
8

Is the filename missing here? Can the driver preprocess and emit multiple files.

sameeranjoshi added inline comments.Jan 20 2021, 1:58 AM
flang/test/Frontend/preprocessor-diag.f90
8

Here's how it looks for multiple files.
I tried with f18 and not flang-new, with this patch I think both should ideally show the same output(at least it is supposed to).

temp.f90:2:20: #include: extra stuff ignored after file name
  #include <empty.h> <empty.h> comment
                                     ^^^^^^^^^^^^^^
temp.f90:4:20: #include: extra stuff ignored after file name
  #include "empty.h" <empty.h> comment
                                  ^^^^^^^^^^^^^^
end
10

I discovered just now that the output isn't a error but seems like a warning.
I feel using --check-prefix=WARNING would be correct.

Address PR comments

awarzynski marked an inline comment as done.Jan 20 2021, 9:27 AM
awarzynski added inline comments.
flang/test/Frontend/preprocessor-diag.f90
8

@sameeranjoshi Thank you for checking this! I've added the file name there. Both f18 and flang-new behave consistently here.

10

Good point, thank you! I'm hesitant to use WARNING, as there is nothing that it would indicate that it's actually a warning. FWIW, it's just a diagnostic message without any severity attached to it.

Are you OK with regular CHECK ?

sameeranjoshi added inline comments.Jan 20 2021, 9:31 AM
flang/test/Frontend/preprocessor-diag.f90
10

Go ahead.

This revision was landed with ongoing or failed builds.Jan 21 2021, 7:18 AM
This revision was automatically updated to reflect the committed changes.