[PATCH] D102849: [flang][driver] Add support for the "-init-only" option

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 1 06:03:45 PDT 2021


awarzynski added a comment.

Hi @stuartellis ,

Thank you for preparing this! This looks good to me, but I would appreciate a comment somewhere (e.g. in the commit message) comparing `-init-only` and `-test-io`. Essentially, both options are for testing purposes only. IMHO, we should only require one of them (I would be in favor of `-init-only`), but it's a bit tricky with input files being managed by the prescanner rather than the driver. So for the time being I would keep both, but just make it clear that:

- `-init-only` ignores the input (because it never calls the prescanner)
- `-test-io` is similar to `-init-only`, but does read and print the input without calling the prescanner.

Please let me know if any of this is unclear!



================
Comment at: clang/include/clang/Driver/Options.td:5692
   HelpText<"Emit native object files">;
 
+def init_only : Flag<["-"], "init-only">,
----------------
[nit] Remove empty line


================
Comment at: flang/include/flang/Frontend/FrontendOptions.h:77
+  /// Only execute frontend initialization
+  InitializationOnly
 
----------------
[Nit] Whenever possible, we've been adopting names from Clang (hopefully, this way it will  be easier for developers to switch between the drivers). So, in this case, it would be `InitOnly` rather than `InitializationOnly`: https://github.com/llvm/llvm-project/blob/main/clang/lib/Frontend/CompilerInvocation.cpp#L2385.


================
Comment at: flang/test/Driver/init-only.f90:2
+! Verify that -init-only flag generates a diagnostic as expected
+
+! RUN: %flang_fc1 -init-only 2>&1 | FileCheck %s
----------------
Missing `! REQUIRES: new-flang-driver`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102849



More information about the cfe-commits mailing list