Files
swift-mirror/test/SourceKit/InterfaceGen/gen_clang_cxx_module.swift
Egor Zhdan a610bcd752 [cxx-interop] Avoid trying to generate module interfaces twice
This reverts most of 72050c5385, which led to decreased performance of jump-to-definition.

Instead of re-attempting to generate a module interface with C++ interop enabled, Swift should rely on the IDE to pass the correct `-cxx-interoperability-mode=` value to SourceKit.

rdar://149061322
2025-09-22 18:48:20 +01:00

48 lines
1.5 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: split-file %s %t
// The interface should fail to generate with C++ interop disabled:
// RUN: not %sourcekitd-test -req=interface-gen -module CxxModule -- -Xfrontend -disable-implicit-concurrency-module-import -Xfrontend -disable-implicit-string-processing-module-import -I %t/Inputs -target %target-triple %clang-importer-sdk-nosource
// With C++ interop enabled, it should succeed:
// RUN: %sourcekitd-test -req=interface-gen -module CxxModule -- -Xfrontend -disable-implicit-concurrency-module-import -Xfrontend -disable-implicit-string-processing-module-import -cxx-interoperability-mode=default -I %t/Inputs -target %target-triple %clang-importer-sdk-nosource | %FileCheck %s
// RUN: not %sourcekitd-test -req=interface-gen -module CxxModule -- -Xfrontend -disable-implicit-concurrency-module-import -Xfrontend -disable-implicit-string-processing-module-import -Xcc -DERROR -I %t/Inputs -target %target-triple %clang-importer-sdk-nosource 2>&1 | %FileCheck --check-prefix=NOLOAD %s
//--- Inputs/module.modulemap
module CxxModule {
header "headerA.h"
requires cplusplus
}
//--- Inputs/headerA.h
namespace ns {
#ifdef ERROR
#error "Unluckee"
#endif
class CxxClass {
public:
int x;
CxxClass(): x(0) {}
inline void method() const {}
};
} // ns
using ClassType = ns::CxxClass;
// CHECK: public enum ns {
// CHECK: public struct CxxClass {
// CHECK: public init()
// CHECK: public func method()
// CHECK: public typealias ClassType = ns.CxxClass
// NOLOAD: Could not load module: CxxModule