Skip to content

Commit 5a04194

Browse files
committed
[Driver][SYCL] Correcting a sanitizer fail with null pointer
applied clang-format Signed-off-by: Harini Chilamantula <[email protected]>
1 parent a0e41f5 commit 5a04194

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4791,9 +4791,20 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
47914791
if (!UnbundlerInputs.empty()) {
47924792
Action *PartialLink =
47934793
C.MakeAction<PartialLinkJobAction>(UnbundlerInputs, types::TY_Object);
4794-
if (!LastArg)
4795-
LastArg = &(dyn_cast<InputAction>(UnbundlerInputs.back())->getInputArg());
4796-
4794+
if (!LastArg) {
4795+
auto *TA = dyn_cast<Action>(UnbundlerInputs.back());
4796+
assert(TA->getKind() == Action::InputClass ||
4797+
TA->getKind() == Action::OffloadClass);
4798+
4799+
// If the Action is of OffloadAction type, use the HostAction of the
4800+
// specific Offload Action to set LastArg
4801+
if (auto *OA = dyn_cast<OffloadAction>(UnbundlerInputs.back()))
4802+
LastArg =
4803+
&(dyn_cast<InputAction>(OA->getHostDependence())->getInputArg());
4804+
else if (auto *IA = dyn_cast<InputAction>(UnbundlerInputs.back()))
4805+
// else set the LastArg based on Last InputAction
4806+
LastArg = &(IA->getInputArg());
4807+
}
47974808
Action *Current = C.MakeAction<InputAction>(*LastArg, types::TY_Object);
47984809
ActionList AL;
47994810
AL.push_back(PartialLink);

0 commit comments

Comments
 (0)