Skip to content

Commit 7ad300d

Browse files
authored
[Driver][NFC] Fix string problem used for tracking duplicate triples (#1424)
There is a test in sycl-offload.c that checks for duplicate triples and emits a diagnostic when one is seen. It has been witnessed that the second triple when emitted can be corrupted causing the test to fail. Signed-off-by: Michael D Toguchi <[email protected]>
1 parent a61ac0f commit 7ad300d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
803803
Arg *SYCLTargetsValues = SYCLTargets ? SYCLTargets : SYCLLinkTargets;
804804
if (SYCLTargetsValues) {
805805
if (SYCLTargetsValues->getNumValues()) {
806-
for (const char *Val : SYCLTargetsValues->getValues()) {
806+
for (StringRef Val : SYCLTargetsValues->getValues()) {
807807
llvm::Triple TT(Val);
808808
if (!isValidSYCLTriple(TT)) {
809809
Diag(clang::diag::err_drv_invalid_sycl_target) << Val;
@@ -821,7 +821,7 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
821821

822822
// Store the current triple so that we can check for duplicates in
823823
// the following iterations.
824-
FoundNormalizedTriples[NormalizedName] = NormalizedName;
824+
FoundNormalizedTriples[NormalizedName] = Val;
825825
UniqueSYCLTriplesVec.push_back(TT);
826826
}
827827
} else
@@ -857,7 +857,7 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
857857

858858
// Store the current triple so that we can check for duplicates in
859859
// the following iterations.
860-
FoundNormalizedTriples[NormalizedName] = NormalizedName;
860+
FoundNormalizedTriples[NormalizedName] = Val;
861861
UniqueSYCLTriplesVec.push_back(TT);
862862
} else {
863863
// No colon found, do not use the input

0 commit comments

Comments
 (0)