[clang] [clang][Tooling] Fix assertion failure when processing CUDA files (PR #173762)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 12 07:11:42 PST 2026


================
@@ -108,13 +108,17 @@ static bool ignoreExtraCC1Commands(const driver::Compilation *Compilation) {
         // tooling will consider host-compilation only. For tooling on device
         // compilation, device compilation only option, such as
         // `--cuda-device-only`, needs specifying.
-        assert(Actions.size() > 1);
-        assert(
-            isa<driver::CompileJobAction>(Actions.front()) ||
-            // On MacOSX real actions may end up being wrapped in
-            // BindArchAction.
-            (isa<driver::BindArchAction>(Actions.front()) &&
-             isa<driver::CompileJobAction>(*Actions.front()->input_begin())));
+        if (Actions.size() > 1) {
+          assert(
+              isa<driver::CompileJobAction>(Actions.front()) ||
+              // On MacOSX real actions may end up being wrapped in
+              // BindArchAction.
+              (isa<driver::BindArchAction>(Actions.front()) &&
+               isa<driver::CompileJobAction>(*Actions.front()->input_begin())));
+        }
+        // FIXME: CUDA/HIP can produce a single top-level OffloadAction (e.g.
+        // -fsyntax-only, -E, -M), which contradicts the expectation of at least
+        // two top-level actions.
----------------
jhuber6 wrote:

Do we still need this `FIXME`?

https://github.com/llvm/llvm-project/pull/173762


More information about the cfe-commits mailing list