mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #64372 from hyp/eng/igen-cxx
[interop] SourceKit should retry generating module interface with C++…
This commit is contained in:
@@ -699,8 +699,26 @@ void SwiftLangSupport::editorOpenInterface(EditorConsumer &Consumer,
|
||||
SynthesizedExtensions,
|
||||
InterestedUSR);
|
||||
if (!IFaceGenRef) {
|
||||
Consumer.handleRequestError(ErrMsg.c_str());
|
||||
return;
|
||||
// Retry to generate a module interface with C++ interop enabled,
|
||||
// if the first attempt failed.
|
||||
bool retryWithCxxEnabled = true;
|
||||
for (const auto &arg: Args) {
|
||||
if (StringRef(arg).startswith("-cxx-interoperability-mode=") ||
|
||||
StringRef(arg).startswith("-enable-experimental-cxx-interop")) {
|
||||
retryWithCxxEnabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (retryWithCxxEnabled) {
|
||||
std::vector<const char *> AdjustedArgs(Args.begin(), Args.end());
|
||||
AdjustedArgs.push_back("-cxx-interoperability-mode=swift-5.9");
|
||||
return editorOpenInterface(Consumer, Name, ModuleName, Group, AdjustedArgs,
|
||||
SynthesizedExtensions, InterestedUSR);
|
||||
}
|
||||
else {
|
||||
Consumer.handleRequestError(ErrMsg.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
IFaceGenRef->reportEditorInfo(Consumer);
|
||||
|
||||
Reference in New Issue
Block a user