Skip to content

Commit 01b7e65

Browse files
committed
[FreeBSD] Fix comparison in f75126e
We have to compare the string contents and not the const char* pointer. This happened to work in my testing but is not reliable.
1 parent 7817045 commit 01b7e65

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clang/lib/Driver/ToolChains/FreeBSD.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,9 @@ void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args,
456456
unsigned Major = getTriple().getOSMajorVersion();
457457
bool SuffixedLib = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
458458
if (SuffixedLib && GetCXXStdlibType(Args) == CST_Libcxx)
459-
llvm::replace(CmdArgs, static_cast<const char *>("-lc++"),
460-
static_cast<const char *>("-lc++_p"));
459+
std::replace_if(
460+
CmdArgs.begin(), CmdArgs.end(),
461+
[](const char *S) { return StringRef(S) == "-lc++"; }, "-lc++_p");
461462
}
462463

463464
void FreeBSD::AddCudaIncludeArgs(const ArgList &DriverArgs,

0 commit comments

Comments
 (0)