1 // UNSUPPORTED: system-windows 2 3 // General tests that the system header search paths detected by the driver 4 // and passed to CC1 are correct on Darwin platforms. 5 6 // Check system headers (everything below <sysroot> and <resource-dir>). Ensure 7 // that both sysroot and isysroot are checked, and that isysroot has precedence. 8 // 9 // RUN: %clang -no-canonical-prefixes %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 %s 17 // 18 // RUN: %clang -no-canonical-prefixes %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 %s 26 // 27 // RUN: %clang -no-canonical-prefixes %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 %s 36 // 37 // CHECK-SYSTEM: "{{[^"]*}}clang{{[^"]*}}" "-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 headers 43 // 44 // RUN: %clang -no-canonical-prefixes %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 %s 53 // CHECK-NOBUILTININC: "{{[^"]*}}clang{{[^"]*}}" "-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 and 59 // <sysroot>/usr/include. 60 // 61 // RUN: %clang -no-canonical-prefixes %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 %s 70 // CHECK-NOSTDLIBINC: "{{[^"]*}}clang{{[^"]*}}" "-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, including 76 // <resource>/include. 77 // 78 // RUN: %clang -no-canonical-prefixes %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 %s 87 // CHECK-NOSTDINC: "{{[^"]*}}clang{{[^"]*}}" "-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 -isysroot 93 // 94 // RUN: %clang -no-canonical-prefixes %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 %s 101 // CHECK-NOSYSROOT: "{{[^"]*}}clang{{[^"]*}}" "-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 -no-canonical-prefixes %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 %s 115 // RUN: %clang -no-canonical-prefixes %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 %s 124 // RUN: %clang -no-canonical-prefixes %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 %s 133 // CHECK-NOSTDINC-BUILTINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1" 134 // CHECK-NOSTDINC-BUILTINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include" 135 // CHECK-NOSTDINC-BUILTINC: "-internal-isystem" "[[RESOURCE]]/include" 136 // CHECK-NOSTDINC-BUILTINC-NOT: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" 137 138 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ 139 // RUN: -target x86_64-apple-darwin \ 140 // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \ 141 // RUN: -resource-dir=%S/Inputs/resource_dir \ 142 // RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \ 143 // RUN: -nobuiltininc -ibuiltininc \ 144 // RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \ 145 // RUN: -DRESOURCE=%S/Inputs/resource_dir \ 146 // RUN: --check-prefix=CHECK-NOBUILTININC-BUILTINC %s 147 // CHECK-NOBUILTININC-BUILTINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1" 148 // CHECK-NOBUILTININC-BUILTINC: "-internal-isystem" "[[SYSROOT]]/usr/local/include" 149 // CHECK-NOBUILTININC-BUILTINC: "-internal-isystem" "[[RESOURCE]]/include" 150 // CHECK-NOBUILTININC-BUILTINC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" 151 152 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ 153 // RUN: -target x86_64-apple-darwin \ 154 // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \ 155 // RUN: -resource-dir=%S/Inputs/resource_dir \ 156 // RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \ 157 // RUN: -nostdinc -ibuiltininc -nobuiltininc \ 158 // RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \ 159 // RUN: -DRESOURCE=%S/Inputs/resource_dir \ 160 // RUN: --check-prefix=CHECK-NOSTDINC-NO-BUILTINC %s 161 // CHECK-NOSTDINC-NO-BUILTINC: "{{[^"]*}}clang{{[^"]*}}" "-cc1" 162 // CHECK-NOSTDINC-NO-BUILTINC-NOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include" 163 // CHECK-NOSTDINC-NO-BUILTINC-NOT: "-internal-isystem" "[[RESOURCE]]/include" 164 // CHECK-NOSTDINC-NO-BUILTINC-NOT: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" 165 166 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ 167 // RUN: -target x86_64-apple-darwin \ 168 // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \ 169 // RUN: -resource-dir=%S/Inputs/resource_dir \ 170 // RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_and_usr_local \ 171 // RUN: -ibuiltininc -nobuiltininc \ 172 // RUN: | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_and_usr_local \ 173 // RUN: -DRESOURCE=%S/Inputs/resource_dir \ 174 // RUN: --check-prefix=CHECK-BUILTINC-NOBUILTININC %s 175 // CHECK-BUILTINC-NOBUILTININC: "{{[^"]*}}clang{{[^"]*}}" "-cc1" 176 // CHECK-BUILTINC-NOBUILTININC: "-internal-isystem" "[[SYSROOT]]/usr/local/include" 177 // CHECK-BUILTINC-NOBUILTININC-NOT: "-internal-isystem" "[[RESOURCE]]/include" 178 // CHECK-BUILTINC-NOBUILTININC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" 179