@@ -2465,34 +2465,24 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
2465
2465
// Also check whether this is used for setting library search paths.
2466
2466
ToolChain::AddClangCXXStdlibIncludeArgs (DriverArgs, CC1Args);
2467
2467
2468
- if (DriverArgs.hasArg (options::OPT_nostdlibinc, options::OPT_nostdincxx))
2468
+ if (DriverArgs.hasArg (options::OPT_nostdinc, options::OPT_nostdlibinc,
2469
+ options::OPT_nostdincxx))
2469
2470
return ;
2470
2471
2471
2472
llvm::SmallString<128 > Sysroot = GetEffectiveSysroot (DriverArgs);
2472
2473
2473
2474
switch (GetCXXStdlibType (DriverArgs)) {
2474
2475
case ToolChain::CST_Libcxx: {
2475
2476
// On Darwin, libc++ can be installed in one of the following two places:
2476
- // 1. In a SDK (or a custom sysroot) in <sysroot>/usr /include/c++/v1
2477
- // 2. Alongside the compiler in <install> /include/c++/v1
2477
+ // 1. Alongside the compiler in <install> /include/c++/v1
2478
+ // 2. In a SDK (or a custom sysroot) in <sysroot>/usr /include/c++/v1
2478
2479
//
2479
2480
// The precendence of paths is as listed above, i.e. we take the first path
2480
2481
// that exists. Also note that we never include libc++ twice -- we take the
2481
2482
// first path that exists and don't send the other paths to CC1 (otherwise
2482
2483
// include_next could break).
2483
2484
2484
2485
// Check for (1)
2485
- llvm::SmallString<128 > SysrootUsr = Sysroot;
2486
- llvm::sys::path::append (SysrootUsr, " usr" , " include" , " c++" , " v1" );
2487
- if (getVFS ().exists (SysrootUsr)) {
2488
- addSystemInclude (DriverArgs, CC1Args, SysrootUsr);
2489
- return ;
2490
- } else if (DriverArgs.hasArg (options::OPT_v)) {
2491
- llvm::errs () << " ignoring nonexistent directory \" " << SysrootUsr
2492
- << " \"\n " ;
2493
- }
2494
-
2495
- // Otherwise, check for (2)
2496
2486
// Get from '<install>/bin' to '<install>/include/c++/v1'.
2497
2487
// Note that InstallBin can be relative, so we use '..' instead of
2498
2488
// parent_path.
@@ -2507,6 +2497,17 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs(
2507
2497
<< " \"\n " ;
2508
2498
}
2509
2499
2500
+ // Otherwise, check for (2)
2501
+ llvm::SmallString<128 > SysrootUsr = Sysroot;
2502
+ llvm::sys::path::append (SysrootUsr, " usr" , " include" , " c++" , " v1" );
2503
+ if (getVFS ().exists (SysrootUsr)) {
2504
+ addSystemInclude (DriverArgs, CC1Args, SysrootUsr);
2505
+ return ;
2506
+ } else if (DriverArgs.hasArg (options::OPT_v)) {
2507
+ llvm::errs () << " ignoring nonexistent directory \" " << SysrootUsr
2508
+ << " \"\n " ;
2509
+ }
2510
+
2510
2511
// Otherwise, don't add any path.
2511
2512
break ;
2512
2513
}
0 commit comments