[PATCH] D133161: [Clang] Fix the new driver crashing when using '-fsyntax-only'

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 6 14:53:05 PDT 2022


tra accepted this revision.
tra added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/Driver/Driver.cpp:4396-4398
+  bool SingleDeviceOutput = !llvm::any_of(OffloadActions, [](Action *A) {
+    return A->getType() == types::TY_Nothing;
+  }) && isa<CompileJobAction>(HostAction);
----------------
jhuber6 wrote:
> tra wrote:
> > `any_of(A->getType() == types::TY_Nothing)` looks like a rather indirect way to infer that we have `-fsyntax-only`. Would there be any other legitimate case when we'd have `Ty_Nothing` actions?
> > 
> > 
> > 
> This is more or less how the existing pipeline handles it. We shouldn't propagate `TY_Nothing` attributes regardless, `-fsyntax-only` just happens to create them. So this is more correct I believe.
OK. Would it make sense to add a helper method with descriptive name? E.g. `hasValidOutput` so future readers do not have to guess what we're doing and why.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133161



More information about the cfe-commits mailing list