Ticket #55382: 9001-macports-libstdcxx.diff
File 9001-macports-libstdcxx.diff, 4.9 KB (added by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), 7 years ago) |
---|
-
tools/clang/include/clang/Lex/HeaderSearchOptions.h
old new 157 157 /// Use libc++ instead of the default libstdc++. 158 158 unsigned UseLibcxx : 1; 159 159 160 /// Use MacPorts libstdc++ instead of default system libstdc++. 161 unsigned UseMacPortsLibstdcxx : 1; 162 160 163 /// Whether header search information should be output as for -v. 161 164 unsigned Verbose : 1; 162 165 -
tools/clang/lib/Frontend/CompilerInvocation.cpp
old new 1094 1094 Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc); 1095 1095 Opts.UseStandardSystemIncludes = !Args.hasArg(OPT_nostdsysteminc); 1096 1096 Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx); 1097 if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) 1097 if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) { 1098 1098 Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0); 1099 Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0); 1100 } 1099 1101 Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir); 1100 1102 Opts.ModuleCachePath = Args.getLastArgValue(OPT_fmodules_cache_path); 1101 1103 Opts.ModuleUserBuildPath = Args.getLastArgValue(OPT_fmodules_user_build_path); -
tools/clang/lib/Frontend/InitHeaderSearch.cpp
old new 108 108 #if defined(LLVM_ON_WIN32) 109 109 return !Path.empty() && llvm::sys::path::is_separator(Path[0]); 110 110 #else 111 return llvm::sys::path::is_absolute(Path) ;111 return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0; 112 112 #endif 113 113 } 114 114 … … 337 337 338 338 case llvm::Triple::ppc: 339 339 case llvm::Triple::ppc64: 340 if (HSOpts.UseMacPortsLibstdcxx) { 341 AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@", 342 "@@MACPORTS_HOST_NAME@@", "@@MACPORTS_GCC_SUBDIRECTORY_ppc@@", "@@MACPORTS_GCC_SUBDIRECTORY_ppc64@@", 343 triple); 344 } 340 345 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", 341 346 "powerpc-apple-darwin10", "", "ppc64", 342 347 triple); … … 347 352 348 353 case llvm::Triple::x86: 349 354 case llvm::Triple::x86_64: 355 if (HSOpts.UseMacPortsLibstdcxx) { 356 AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@", 357 "@@MACPORTS_HOST_NAME@@", "@@MACPORTS_GCC_SUBDIRECTORY_i386@@", "@@MACPORTS_GCC_SUBDIRECTORY_x86_64@@", triple); 358 } 350 359 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", 351 360 "i686-apple-darwin10", "", "x86_64", triple); 352 361 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0", -
tools/clang/include/clang/Driver/ToolChain.h
old new 46 46 47 47 enum CXXStdlibType { 48 48 CST_Libcxx, 49 CST_Libstdcxx 49 CST_Libstdcxx, 50 CST_MacPortsLibstdcxx 50 51 }; 51 52 52 53 enum RuntimeLibType { -
tools/clang/lib/Driver/ToolChains.cpp
old new 572 572 CmdArgs.push_back("-lc++"); 573 573 break; 574 574 575 case ToolChain::CST_Libstdcxx: { 575 case ToolChain::CST_Libstdcxx: 576 case ToolChain::CST_MacPortsLibstdcxx: { 577 if (Type==ToolChain::CST_MacPortsLibstdcxx && llvm::sys::fs::exists("@@MACPORTS_libstdc++@@")) { 578 CmdArgs.push_back("@@MACPORTS_libstdc++@@"); 579 return; 580 } 581 576 582 // Unfortunately, -lstdc++ doesn't always exist in the standard search path; 577 583 // it was previously found in the gcc lib dir. However, for all the Darwin 578 584 // platforms we care about it was -lstdc++.6, so we search for that … … 2243 2249 return ToolChain::CST_Libstdcxx; 2244 2250 2245 2251 StringRef Value = A->getValue(); 2252 if (Value == "macports-libstdc++") 2253 return ToolChain::CST_MacPortsLibstdcxx; 2246 2254 if (Value != "libstdc++") { 2247 2255 getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args); 2248 2256 } -
tools/clang/lib/Driver/ToolChain.cpp
old new 383 383 return ToolChain::CST_Libcxx; 384 384 if (Value == "libstdc++") 385 385 return ToolChain::CST_Libstdcxx; 386 if (Value == "macports-libstdc++") 387 return ToolChain::CST_MacPortsLibstdcxx; 386 388 getDriver().Diag(diag::err_drv_invalid_stdlib_name) 387 389 << A->getAsString(Args); 388 390 } … … 455 457 break; 456 458 457 459 case ToolChain::CST_Libstdcxx: 460 case ToolChain::CST_MacPortsLibstdcxx: 458 461 CmdArgs.push_back("-lstdc++"); 459 462 break; 460 463 }