Skip to content

Commit 872ae70

Browse files
committed
[SYCL]Fix some uninitialized pointer usage in Driver
Signed-off-by: gejin <[email protected]>
1 parent ffdee5d commit 872ae70

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4744,7 +4744,7 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
47444744
}
47454745
UnbundlerInputs.push_back(LI);
47464746
}
4747-
const Arg *LastArg;
4747+
const Arg *LastArg = nullptr;
47484748
auto addUnbundlerInput = [&](types::ID T, const StringRef &A) {
47494749
const llvm::opt::OptTable &Opts = getOpts();
47504750
Arg *InputArg = MakeInputArg(Args, Opts, C.getArgs().MakeArgString(A));

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7708,7 +7708,8 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
77087708
addArgs(CmdArgs, TCArgs, {"-symbols"});
77097709
}
77107710
// specialization constants processing is mandatory
7711-
if (llvm::dyn_cast<SYCLPostLinkJobAction>(&JA)->getRTSetsSpecConstants())
7711+
auto *SYCLPostLink = llvm::dyn_cast<SYCLPostLinkJobAction>(&JA);
7712+
if (SYCLPostLink && SYCLPostLink->getRTSetsSpecConstants())
77127713
addArgs(CmdArgs, TCArgs, {"-spec-const=rt"});
77137714
else
77147715
addArgs(CmdArgs, TCArgs, {"-spec-const=default"});

0 commit comments

Comments
 (0)