mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Resolve a Layering Violation in libBasic
Basic should not be allowed to link Parse, yet it was doing so to allow Version to provide a constructor that would conveniently parse a StringRef. This entrypoint also emitted diagnostics, so it pulled in libAST. Sink the version parser entrypoint down into Parse where it belongs and point all the clients to the right place.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "swift/Frontend/Frontend.h"
|
||||
#include "swift/Frontend/PrintingDiagnosticConsumer.h"
|
||||
#include "swift/Option/Options.h"
|
||||
#include "swift/Parse/ParseVersion.h"
|
||||
#include "swift/SymbolGraphGen/SymbolGraphGen.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
@@ -147,8 +148,8 @@ int swift_symbolgraph_extract_main(ArrayRef<const char *> Args,
|
||||
using version::Version;
|
||||
auto SwiftVersion = A->getValue();
|
||||
bool isValid = false;
|
||||
if (auto Version =
|
||||
Version::parseVersionString(SwiftVersion, SourceLoc(), nullptr)) {
|
||||
if (auto Version = VersionParser::parseVersionString(
|
||||
SwiftVersion, SourceLoc(), nullptr)) {
|
||||
if (auto Effective = Version.getValue().getEffectiveLanguageVersion()) {
|
||||
Invocation.getLangOptions().EffectiveLanguageVersion = *Effective;
|
||||
isValid = true;
|
||||
|
||||
Reference in New Issue
Block a user