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:
@@ -11,10 +11,11 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "ModuleFileSharedCore.h"
|
||||
#include "ModuleFileCoreTableInfo.h"
|
||||
#include "BCReadingExtras.h"
|
||||
#include "DeserializationErrors.h"
|
||||
#include "ModuleFileCoreTableInfo.h"
|
||||
#include "swift/Basic/LangOptions.h"
|
||||
#include "swift/Parse/ParseVersion.h"
|
||||
#include "swift/Strings.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/OnDiskHashTable.h"
|
||||
@@ -282,9 +283,9 @@ static ValidationInfo validateControlBlock(
|
||||
}
|
||||
case 4:
|
||||
if (scratch[3] != 0) {
|
||||
result.compatibilityVersion =
|
||||
version::Version(blobData.substr(scratch[2]+1, scratch[3]),
|
||||
SourceLoc(), nullptr);
|
||||
result.compatibilityVersion = *VersionParser::parseVersionString(
|
||||
blobData.substr(scratch[2] + 1, scratch[3]), SourceLoc(),
|
||||
nullptr);
|
||||
}
|
||||
LLVM_FALLTHROUGH;
|
||||
case 3:
|
||||
|
||||
Reference in New Issue
Block a user