[CxxInterop] Change C++ interop header ordering

Consider the case of a toolchain that includes clang is being used to
compile Swift. With the current ordering, the header will be found
relative to that toolchain, which could be out of date as compared to
tip. This is the case today if eg. a 5.7 toolchain is used to build
main/5.9 as the shim header is missing a definition.
This commit is contained in:
Ben Barham
2023-08-16 18:08:35 -07:00
parent 4581eb7f35
commit e0b976d150
3 changed files with 24 additions and 22 deletions

View File

@@ -98,16 +98,16 @@
// CHECK-NEXT: #if defined(__cplusplus)
// CHECK-NEXT: #pragma clang diagnostic push
// CHECK-NEXT: #pragma clang diagnostic ignored "-Wnon-modular-include-in-framework-module"
// CHECK-NEXT: // Allow user to find the header using additional include paths
// CHECK-NEXT: #if __has_include(<swiftToCxx/_SwiftCxxInteroperability.h>)
// CHECK-NEXT: #include <swiftToCxx/_SwiftCxxInteroperability.h>
// CHECK-NEXT: // Look for the C++ interop support header relative to clang's resource dir:
// CHECK-NEXT: // '<toolchain>/usr/lib/clang/<version>/include/../../../swift/swiftToCxx'.
// CHECK-NEXT: #if __has_include(<../../../swift/swiftToCxx/_SwiftCxxInteroperability.h>)
// CHECK-NEXT: // '<toolchain>/usr/lib/clang/<version>/include/../../../swift/swiftToCxx'.
// CHECK-NEXT: #elif __has_include(<../../../swift/swiftToCxx/_SwiftCxxInteroperability.h>)
// CHECK-NEXT: #include <../../../swift/swiftToCxx/_SwiftCxxInteroperability.h>
// CHECK-NEXT: #elif __has_include(<../../../../../lib/swift/swiftToCxx/_SwiftCxxInteroperability.h>)
// CHECK-NEXT: // '<toolchain>/usr/local/lib/clang/<version>/include/../../../../../lib/swift/swiftToCxx'.
// CHECK-NEXT: // '<toolchain>/usr/local/lib/clang/<version>/include/../../../../../lib/swift/swiftToCxx'.
// CHECK-NEXT: #include <../../../../../lib/swift/swiftToCxx/_SwiftCxxInteroperability.h>
// CHECK-NEXT: // Alternatively, allow user to find the header using additional include path into '<toolchain>/lib/swift'.
// CHECK-NEXT: #elif __has_include(<swiftToCxx/_SwiftCxxInteroperability.h>)
// CHECK-NEXT: #include <swiftToCxx/_SwiftCxxInteroperability.h>
// CHECK-NEXT: #endif
// CHECK-NEXT: #pragma clang diagnostic pop
// CHECK-NEXT: #if __has_feature(objc_modules)