[clang] [FreeBSD] Support -stdlib=libstdc++ (PR #126302)

Alexander Richardson via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 7 12:17:06 PST 2025


================
@@ -452,12 +452,12 @@ void FreeBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
 
 void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args,
                                   ArgStringList &CmdArgs) const {
+  Generic_ELF::AddCXXStdlibLibArgs(Args, CmdArgs);
   unsigned Major = getTriple().getOSMajorVersion();
-  bool Profiling = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
-
-  CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++");
-  if (Args.hasArg(options::OPT_fexperimental_library))
-    CmdArgs.push_back("-lc++experimental");
+  bool SuffixedLib = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
+  if (SuffixedLib && GetCXXStdlibType(Args) == CST_Libcxx)
+    llvm::replace(CmdArgs, static_cast<const char *>("-lc++"),
----------------
arichardson wrote:

The cast here is needed since it doesn't decay and complains about `char[5]` vs `char[7]`

https://github.com/llvm/llvm-project/pull/126302


More information about the cfe-commits mailing list