mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge branch 'main' into allowable-serialization
This commit is contained in:
@@ -169,7 +169,7 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
|
||||
// so only serialize them if the module isn't going to be shipped to
|
||||
// the public.
|
||||
serializationOpts.SerializeOptionsForDebugging =
|
||||
opts.SerializeOptionsForDebugging.getValueOr(
|
||||
opts.SerializeOptionsForDebugging.value_or(
|
||||
!module->isExternallyConsumed());
|
||||
|
||||
serializationOpts.PathObfuscator = opts.serializedPathObfuscator;
|
||||
@@ -652,7 +652,7 @@ bool CompilerInstance::setUpInputs() {
|
||||
getRecordedBufferID(input, shouldRecover, failed);
|
||||
hasFailed |= failed;
|
||||
|
||||
if (!bufferID.hasValue() || !input.isPrimary())
|
||||
if (!bufferID.has_value() || !input.isPrimary())
|
||||
continue;
|
||||
|
||||
recordPrimaryInputBuffer(*bufferID);
|
||||
@@ -661,7 +661,7 @@ bool CompilerInstance::setUpInputs() {
|
||||
return true;
|
||||
|
||||
// Set the primary file to the code-completion point if one exists.
|
||||
if (codeCompletionBufferID.hasValue() &&
|
||||
if (codeCompletionBufferID.has_value() &&
|
||||
!isPrimaryInput(*codeCompletionBufferID)) {
|
||||
assert(PrimaryBufferIDs.empty() && "re-setting PrimaryBufferID");
|
||||
recordPrimaryInputBuffer(*codeCompletionBufferID);
|
||||
@@ -682,13 +682,13 @@ CompilerInstance::getRecordedBufferID(const InputFile &input,
|
||||
auto buffers = getInputBuffersIfPresent(input);
|
||||
|
||||
// Recover by dummy buffer if requested.
|
||||
if (!buffers.hasValue() && shouldRecover &&
|
||||
if (!buffers.has_value() && shouldRecover &&
|
||||
input.getType() == file_types::TY_Swift) {
|
||||
buffers = ModuleBuffers(llvm::MemoryBuffer::getMemBuffer(
|
||||
"// missing file\n", input.getFileName()));
|
||||
}
|
||||
|
||||
if (!buffers.hasValue()) {
|
||||
if (!buffers.has_value()) {
|
||||
failed = true;
|
||||
return None;
|
||||
}
|
||||
@@ -736,8 +736,8 @@ Optional<ModuleBuffers> CompilerInstance::getInputBuffersIfPresent(
|
||||
auto swiftdoc = openModuleDoc(input);
|
||||
auto sourceinfo = openModuleSourceInfo(input);
|
||||
return ModuleBuffers(std::move(*inputFileOrErr),
|
||||
swiftdoc.hasValue() ? std::move(swiftdoc.getValue()) : nullptr,
|
||||
sourceinfo.hasValue() ? std::move(sourceinfo.getValue()) : nullptr);
|
||||
swiftdoc.has_value() ? std::move(swiftdoc.value()) : nullptr,
|
||||
sourceinfo.has_value() ? std::move(sourceinfo.value()) : nullptr);
|
||||
}
|
||||
|
||||
Optional<std::unique_ptr<llvm::MemoryBuffer>>
|
||||
@@ -982,12 +982,12 @@ CompilerInstance::computeMainSourceFileForModule(ModuleDecl *mod) const {
|
||||
MainBufferID.emplace(InputSourceCodeBufferIDs.front());
|
||||
}
|
||||
|
||||
if (!MainBufferID.hasValue()) {
|
||||
if (!MainBufferID.has_value()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto SFK = tryMatchInputModeToSourceFileKind(FOpts.InputMode);
|
||||
if (!SFK.hasValue()) {
|
||||
if (!SFK.has_value()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user