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

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 1 15:09:10 PDT 2022


jhuber6 created this revision.
jhuber6 added reviewers: tra, yaxunl, jdoerfert, JonChesterfield.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1, MaskRay.
Herald added a project: clang.

The new driver currently crashses when attempting to use the
'-fsyntax-only' option. This is because the option causes all output to
be given the `TY_Nothing' type which should signal the end of the
pipeline. The new driver was not treating this correctly and attempting
to use empty input. This patch fixes the handling so we do not attempt
to continue when the input is nothing.

One concession is that we must now check when generating the arguments
for Clang if the input is of 'TY_Nothing'. This is because the new
driver will only create code if the device code is a dependency on the
host, creating the output without the dependency would require a
complete rewrite of the logic as we do not maintain any state between
calls to 'BuildOffloadingActions' so I believe this is the most
straightforward method.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133161

Files:
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/cuda-bindings.cu
  clang/test/Driver/hip-binding.hip
  clang/test/Driver/openmp-offload.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133161.457419.patch
Type: text/x-patch
Size: 5651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220901/5717c65e/attachment-0001.bin>


More information about the cfe-commits mailing list