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

Jessica Clarke via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 7 12:31:21 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++"),
----------------
jrtc27 wrote:

Given how simple the base AddCXXStdlibLibArgs is, should we not just reimplement the other bits here rather than do this slightly gross replacement? That's what all the other implementations seem to do.

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


More information about the cfe-commits mailing list