mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SourceKit] For the swift header interface request, accept the swift version as a string
This is so we can pass the version as "4.2". rdar://38673625
This commit is contained in:
@@ -805,7 +805,7 @@ void SwiftLangSupport::editorOpenHeaderInterface(EditorConsumer &Consumer,
|
||||
ArrayRef<const char *> Args,
|
||||
bool UsingSwiftArgs,
|
||||
bool SynthesizedExtensions,
|
||||
Optional<unsigned> swiftVersion) {
|
||||
StringRef swiftVersion) {
|
||||
CompilerInstance CI;
|
||||
// Display diagnostics to stderr.
|
||||
PrintingDiagnosticConsumer PrintDiags;
|
||||
@@ -838,9 +838,12 @@ void SwiftLangSupport::editorOpenHeaderInterface(EditorConsumer &Consumer,
|
||||
}
|
||||
|
||||
Invocation.getClangImporterOptions().ImportForwardDeclarations = true;
|
||||
if (swiftVersion.hasValue()) {
|
||||
auto swiftVer = version::Version({swiftVersion.getValue()});
|
||||
Invocation.getLangOptions().EffectiveLanguageVersion = swiftVer;
|
||||
if (!swiftVersion.empty()) {
|
||||
auto swiftVer = version::Version::parseVersionString(swiftVersion,
|
||||
SourceLoc(), nullptr);
|
||||
if (swiftVer.hasValue())
|
||||
Invocation.getLangOptions().EffectiveLanguageVersion =
|
||||
swiftVer.getValue();
|
||||
}
|
||||
auto IFaceGenRef = SwiftInterfaceGenContext::create(Name,
|
||||
/*IsModule=*/false,
|
||||
|
||||
Reference in New Issue
Block a user