180 lines · cpp
1// UNSUPPORTED: system-windows2 3// General tests that the system header search paths detected by the driver4// and passed to CC1 are correct on Darwin platforms.5 6// Check system headers (everything below <sysroot> and <resource-dir>). Ensure7// that both sysroot and isysroot are checked, and that isysroot has precedence.8//9// RUN: %clang -### %s -fsyntax-only 2>&1 \10// RUN: --target=x86_64-apple-darwin \11// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \12// RUN: -resource-dir=%S/Inputs/resource_dir \13// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \14// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \15// RUN: -DRESOURCE=%S/Inputs/resource_dir \16// RUN: --check-prefix=CHECK-SYSTEM %s17//18// RUN: %clang -### %s -fsyntax-only 2>&1 \19// RUN: --target=x86_64-apple-darwin \20// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \21// RUN: -resource-dir=%S/Inputs/resource_dir \22// RUN: --sysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \23// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \24// RUN: -DRESOURCE=%S/Inputs/resource_dir \25// RUN: --check-prefix=CHECK-SYSTEM %s26//27// RUN: %clang -### %s -fsyntax-only 2>&1 \28// RUN: --target=x86_64-apple-darwin \29// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \30// RUN: -resource-dir=%S/Inputs/resource_dir \31// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \32// RUN: --sysroot / \33// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \34// RUN: -DRESOURCE=%S/Inputs/resource_dir \35// RUN: --check-prefix=CHECK-SYSTEM %s36//37// CHECK-SYSTEM: "-cc1"38// CHECK-SYSTEM: "-internal-isystem" "[[SYSROOT]]/usr/local/include"39// CHECK-SYSTEM: "-internal-isystem" "[[RESOURCE]]/include"40// CHECK-SYSTEM: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"41 42// Make sure that using -nobuiltininc will drop resource headers43//44// RUN: %clang -### %s -fsyntax-only 2>&1 \45// RUN: --target=x86_64-apple-darwin \46// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \47// RUN: -resource-dir=%S/Inputs/resource_dir \48// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \49// RUN: -nobuiltininc \50// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \51// RUN: -DRESOURCE=%S/Inputs/resource_dir \52// RUN: --check-prefix=CHECK-NOBUILTININC %s53// CHECK-NOBUILTININC: "-cc1"54// CHECK-NOBUILTININC: "-internal-isystem" "[[SYSROOT]]/usr/local/include"55// CHECK-NOBUILTININC-NOT: "-internal-isystem" "[[RESOURCE]]/include"56// CHECK-NOBUILTININC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"57 58// Make sure that using -nostdlibinc will drop <sysroot>/usr/local/include and59// <sysroot>/usr/include.60//61// RUN: %clang -### %s -fsyntax-only 2>&1 \62// RUN: --target=x86_64-apple-darwin \63// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \64// RUN: -resource-dir=%S/Inputs/resource_dir \65// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \66// RUN: -nostdlibinc \67// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \68// RUN: -DRESOURCE=%S/Inputs/resource_dir \69// RUN: --check-prefix=CHECK-NOSTDLIBINC %s70// CHECK-NOSTDLIBINC: "-cc1"71// CHECK-NOSTDLIBINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include"72// CHECK-NOSTDLIBINC: "-internal-isystem" "[[RESOURCE]]/include"73// CHECK-NOSTDLIBINC-NOT: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"74 75// Make sure that -nostdinc drops all the system include paths, including76// <resource>/include.77//78// RUN: %clang -### %s -fsyntax-only 2>&1 \79// RUN: --target=x86_64-apple-darwin \80// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \81// RUN: -resource-dir=%S/Inputs/resource_dir \82// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \83// RUN: -nostdinc \84// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \85// RUN: -DRESOURCE=%S/Inputs/resource_dir \86// RUN: --check-prefix=CHECK-NOSTDINC %s87// CHECK-NOSTDINC: "-cc1"88// CHECK-NOSTDINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include"89// CHECK-NOSTDINC-NOT: "-internal-isystem" "[[RESOURCE]]/include"90// CHECK-NOSTDINC-NOT: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"91 92// Check search paths without -isysroot93//94// RUN: %clang -### %s -fsyntax-only 2>&1 \95// RUN: --target=x86_64-apple-darwin \96// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \97// RUN: -resource-dir=%S/Inputs/resource_dir \98// RUN: --sysroot="" \99// RUN: | FileCheck -DRESOURCE=%S/Inputs/resource_dir \100// RUN: --check-prefix=CHECK-NOSYSROOT %s101// CHECK-NOSYSROOT: "-cc1"102// CHECK-NOSYSROOT: "-internal-isystem" "/usr/local/include"103// CHECK-NOSYSROOT: "-internal-isystem" "[[RESOURCE]]/include"104// CHECK-NOSYSROOT: "-internal-externc-isystem" "/usr/include"105 106// RUN: %clang -### %s -fsyntax-only 2>&1 \107// RUN: --target=x86_64-apple-darwin \108// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \109// RUN: -resource-dir=%S/Inputs/resource_dir \110// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \111// RUN: -nostdinc -ibuiltininc \112// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \113// RUN: -DRESOURCE=%S/Inputs/resource_dir \114// RUN: --check-prefix=CHECK-NOSTDINC-BUILTINC %s115// RUN: %clang -### %s -fsyntax-only 2>&1 \116// RUN: --target=x86_64-apple-darwin \117// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \118// RUN: -resource-dir=%S/Inputs/resource_dir \119// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \120// RUN: -ibuiltininc -nostdinc \121// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \122// RUN: -DRESOURCE=%S/Inputs/resource_dir \123// RUN: --check-prefix=CHECK-NOSTDINC-BUILTINC %s124// RUN: %clang -### %s -fsyntax-only 2>&1 \125// RUN: --target=x86_64-apple-darwin \126// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \127// RUN: -resource-dir=%S/Inputs/resource_dir \128// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \129// RUN: -nostdinc -nobuiltininc -ibuiltininc \130// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \131// RUN: -DRESOURCE=%S/Inputs/resource_dir \132// RUN: --check-prefix=CHECK-NOSTDINC-BUILTINC %s133// CHECK-NOSTDINC-BUILTINC: "-cc1"134// CHECK-NOSTDINC-BUILTINC-NOT: "-ibuiltininc"135// CHECK-NOSTDINC-BUILTINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include"136// CHECK-NOSTDINC-BUILTINC: "-internal-isystem" "[[RESOURCE]]/include"137// CHECK-NOSTDINC-BUILTINC-NOT: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"138 139// RUN: %clang -### %s -fsyntax-only 2>&1 \140// RUN: --target=x86_64-apple-darwin \141// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \142// RUN: -resource-dir=%S/Inputs/resource_dir \143// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \144// RUN: -nobuiltininc -ibuiltininc \145// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \146// RUN: -DRESOURCE=%S/Inputs/resource_dir \147// RUN: --check-prefix=CHECK-NOBUILTININC-BUILTINC %s148// CHECK-NOBUILTININC-BUILTINC: "-cc1"149// CHECK-NOBUILTININC-BUILTINC: "-internal-isystem" "[[SYSROOT]]/usr/local/include"150// CHECK-NOBUILTININC-BUILTINC: "-internal-isystem" "[[RESOURCE]]/include"151// CHECK-NOBUILTININC-BUILTINC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"152 153// RUN: %clang -### %s -fsyntax-only 2>&1 \154// RUN: --target=x86_64-apple-darwin \155// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \156// RUN: -resource-dir=%S/Inputs/resource_dir \157// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \158// RUN: -nostdinc -ibuiltininc -nobuiltininc \159// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \160// RUN: -DRESOURCE=%S/Inputs/resource_dir \161// RUN: --check-prefix=CHECK-NOSTDINC-NO-BUILTINC %s162// CHECK-NOSTDINC-NO-BUILTINC: "-cc1"163// CHECK-NOSTDINC-NO-BUILTINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include"164// CHECK-NOSTDINC-NO-BUILTINC-NOT: "-internal-isystem" "[[RESOURCE]]/include"165// CHECK-NOSTDINC-NO-BUILTINC-NOT: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"166 167// RUN: %clang -### %s -fsyntax-only 2>&1 \168// RUN: --target=x86_64-apple-darwin \169// RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \170// RUN: -resource-dir=%S/Inputs/resource_dir \171// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \172// RUN: -ibuiltininc -nobuiltininc \173// RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \174// RUN: -DRESOURCE=%S/Inputs/resource_dir \175// RUN: --check-prefix=CHECK-BUILTINC-NOBUILTININC %s176// CHECK-BUILTINC-NOBUILTININC: "-cc1"177// CHECK-BUILTINC-NOBUILTININC: "-internal-isystem" "[[SYSROOT]]/usr/local/include"178// CHECK-BUILTINC-NOBUILTININC-NOT: "-internal-isystem" "[[RESOURCE]]/include"179// CHECK-BUILTINC-NOBUILTININC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"180