Skip to content

Commit da6fbed

Browse files
committed
Address @jhuber6 comments.
1 parent d0b644e commit da6fbed

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

clang/lib/Driver/ToolChains/AMDGPU.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,9 +1025,8 @@ RocmInstallationDetector::getCommonBitcodeLibs(
10251025
BCLibs.emplace_back(BCLib);
10261026
};
10271027
auto AddSanBCLibs = [&]() {
1028-
if (GPUSanEnabled) {
1028+
if (GPUSanEnabled)
10291029
AddBCLib(getAsanRTLPath(), false);
1030-
}
10311030
};
10321031

10331032
AddSanBCLibs();
@@ -1097,6 +1096,7 @@ bool AMDGPUToolChain::shouldSkipSanitizeOption(
10971096
if (TargetID.empty())
10981097
return false;
10991098
Option O = A->getOption();
1099+
11001100
if (!O.matches(options::OPT_fsanitize_EQ))
11011101
return false;
11021102

clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,18 @@ llvm::opt::DerivedArgList *AMDGPUOpenMPToolChain::TranslateArgs(
6868
Action::OffloadKind DeviceOffloadKind) const {
6969
DerivedArgList *DAL =
7070
HostTC.TranslateArgs(Args, BoundArch, DeviceOffloadKind);
71-
if (!DAL || Args.hasArg(options::OPT_fsanitize_EQ))
71+
72+
if (!DAL)
7273
DAL = new DerivedArgList(Args.getBaseArgs());
7374

7475
const OptTable &Opts = getDriver().getOpts();
7576

77+
// Skip sanitize options passed from the HostTC. Claim them early.
78+
// The decision to sanitize device code is computed only by
79+
// 'shouldSkipSanitizeOption'.
80+
if (DAL->hasArg(options::OPT_fsanitize_EQ))
81+
DAL->claimAllArgs(options::OPT_fsanitize_EQ);
82+
7683
for (Arg *A : Args)
7784
if (!shouldSkipSanitizeOption(*this, Args, BoundArch, A) &&
7885
!llvm::is_contained(*DAL, A))

0 commit comments

Comments
 (0)