diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-09 17:50:40 +0900 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-09 17:50:40 +0900 |
commit | fea7da1b00cc97d742faede2df96c7d327950f49 (patch) | |
tree | 4de1d6b4ddc69f4f32daabb11ad5c71ab0cf895e /clang/test/Driver/darwin-embedded-search-paths.c | |
parent | 9b99dde0d47102625d93c5d1cbbc04951025a6c9 (diff) | |
parent | 0aa930a41f2d1ebf1fa90ec42da8f96d15a4dcbb (diff) | |
download | llvm-users/chapuni/cov/single/nextcount.zip llvm-users/chapuni/cov/single/nextcount.tar.gz llvm-users/chapuni/cov/single/nextcount.tar.bz2 |
Merge branch 'users/chapuni/cov/single/nextcount-base' into users/chapuni/cov/single/nextcountusers/chapuni/cov/single/nextcount
Diffstat (limited to 'clang/test/Driver/darwin-embedded-search-paths.c')
-rw-r--r-- | clang/test/Driver/darwin-embedded-search-paths.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/clang/test/Driver/darwin-embedded-search-paths.c b/clang/test/Driver/darwin-embedded-search-paths.c new file mode 100644 index 0000000..bd651b7 --- /dev/null +++ b/clang/test/Driver/darwin-embedded-search-paths.c @@ -0,0 +1,46 @@ +// REQUIRES: !(default-cxx-stdlib=libc++) +// UNSUPPORTED: system-windows +// Windows is unsupported because we use the Unix path separator `/` in the test. + +// Unlike the Darwin driver, the MachO driver doesn't add any framework search paths, +// only the normal header ones. +// RUN: %clang -x c -target arm64-apple-none-macho -isysroot %S/Inputs/MacOSX15.1.sdk -### -c %s 2>&1 \ +// RUN: | FileCheck --check-prefixes=CC1,NO-CXX,ULI,CI,UI,NO-FW -DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s + +// Unlike the Darwin driver, the MachO driver doesn't default to libc++, and unless +// CLANG_DEFAULT_CXX_STDLIB is libc++ it won't add any search paths. +// RUN: %clang -x c++ -target arm64-apple-none-macho -isysroot %S/Inputs/MacOSX15.1.sdk -### -c %s 2>&1 \ +// RUN: | FileCheck --check-prefixes=CC1,NO-CXX,ULI,CI,UI,NO-FW -DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s + +// However, if the user requests libc++, the MachO driver should find the search path. +// RUN: %clang -x c++ -stdlib=libc++ -target arm64-apple-none-macho -isysroot %S/Inputs/MacOSX15.1.sdk -### -c %s 2>&1 \ +// RUN: | FileCheck --check-prefixes=CC1,CXX,ULI,CI,UI,NO-FW -DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s + +// Verify that embedded uses can swap in alternate usr/include and usr/local/include directories. +// usr/local/include is specified in the driver as -internal-isystem, however, the driver generated +// paths come before the paths in the driver arguments. In order to keep usr/local/include in the +// same position, -isystem has to be used instead of -Xclang -internal-isystem. There isn't an +// -externc-isystem, but it's ok to use -Xclang -internal-externc-isystem since the driver doesn't +// use that if -nostdlibinc or -nostdinc is passed. +// RUN: %clang -x c++ -stdlib=libc++ -target arm64-apple-none-macho -isysroot %S/Inputs/MacOSX15.1.sdk \ +// RUN: -nostdlibinc -isystem %S/Inputs/MacOSX15.1.sdk/embedded/usr/local/include \ +// RUN: -Xclang -internal-externc-isystem -Xclang %S/Inputs/MacOSX15.1.sdk/embedded/usr/include \ +// RUN: -### -c %s 2>&1 | FileCheck --check-prefixes=CC1,NO-CXX,EULI,CI,EUI,NO-FW -DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s + + +// The ordering of these flags doesn't matter, and so this test is a little +// fragile. i.e. all of the -internal-isystem paths will be searched before the +// -internal-externc-isystem ones, and their order on the command line doesn't +// matter. The line order here is just the current order that the driver writes +// the cc1 arguments. + +// CC1: "-cc1" +// CC1: "-resource-dir" "[[RESOURCE_DIR:[^"]*]]" +// NO-CXX-NOT: "-internal-isystem" "{{.*}}/include/c++/v1" +// CXX-SAME: "-internal-isystem" "{{.*}}/include/c++/v1" +// ULI-SAME: "-internal-isystem" "[[SDKROOT]]/usr/local/include" +// EULI-SAME: "-isystem" "[[SDKROOT]]/embedded/usr/local/include" +// CI-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include" +// UI-SAME: "-internal-externc-isystem" "[[SDKROOT]]/usr/include" +// EUI-SAME: "-internal-externc-isystem" "[[SDKROOT]]/embedded/usr/include" +// NO-FW-NOT: "-internal-iframework" |