[PATCH] D118985: [flang][driver] Add support for `-emit-mlir`
Kiran Chandramohan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 8 03:45:42 PST 2022
kiranchandramohan accepted this revision.
kiranchandramohan added a comment.
LGTM.
================
Comment at: flang/lib/Frontend/FrontendActions.cpp:419
+
+ // ... otherwise, print to a file.
+ auto os{ci.CreateDefaultOutputFile(
----------------
awarzynski wrote:
> kiranchandramohan wrote:
> > Nit: Should we test the existence of such a file?
> We do :) Sort of!
>
> To me, "existence" is a low level concept. Files are handled through e.g. `llvm::raw_fd_ostream` (and occasionally other streams) and IMO all low level details should be dealt with there (and indeed are). `flang-new` should only verify that `os` is not a `nullptr`. If the file does not exist, `os` will be a `nullptr` and that's checked further down. If the file does exist, then everything is fine and we can move to the next step.
OK, that was sounds fine. I was also meaning to ask whether we should have a test that a *.mlir file is generated in a test.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118985/new/
https://reviews.llvm.org/D118985
More information about the cfe-commits
mailing list