Skip to content

Commit 5e05e2e

Browse files
authored
[SYCL] Fix some uninitialized pointer usage in Driver (#1683)
Signed-off-by: gejin <[email protected]>
1 parent 7df381a commit 5e05e2e

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
@@ -4741,7 +4741,7 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
47414741
}
47424742
UnbundlerInputs.push_back(LI);
47434743
}
4744-
const Arg *LastArg;
4744+
const Arg *LastArg = nullptr;
47454745
auto addUnbundlerInput = [&](types::ID T, const StringRef &A) {
47464746
const llvm::opt::OptTable &Opts = getOpts();
47474747
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
@@ -7726,7 +7726,8 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
77267726
addArgs(CmdArgs, TCArgs, {"-symbols"});
77277727
}
77287728
// specialization constants processing is mandatory
7729-
if (llvm::dyn_cast<SYCLPostLinkJobAction>(&JA)->getRTSetsSpecConstants())
7729+
auto *SYCLPostLink = llvm::dyn_cast<SYCLPostLinkJobAction>(&JA);
7730+
if (SYCLPostLink && SYCLPostLink->getRTSetsSpecConstants())
77307731
addArgs(CmdArgs, TCArgs, {"-spec-const=rt"});
77317732
else
77327733
addArgs(CmdArgs, TCArgs, {"-spec-const=default"});

0 commit comments

Comments
 (0)