Files
swift-mirror/include/swift/IDE/CodeCompletionResultSink.h

59 lines
1.9 KiB
C++

//===--- CodeCompletionResultSink.h ---------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2022 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_IDE_CODECOMPLETIONRESULTSINK
#define SWIFT_IDE_CODECOMPLETIONRESULTSINK
namespace swift {
namespace ide {
struct CodeCompletionResultSink {
using AllocatorPtr = std::shared_ptr<llvm::BumpPtrAllocator>;
/// The allocator used to allocate results "native" to this sink.
AllocatorPtr Allocator;
/// Allocators that keep alive "foreign" results imported into this sink from
/// other sinks.
std::vector<AllocatorPtr> ForeignAllocators;
/// Whether to annotate the results with XML.
bool annotateResult = false;
/// Whether to emit object literals if desired.
bool includeObjectLiterals = true;
/// Whether to emit type initializers in addition to type names in expression
/// position.
bool addInitsToTopLevel = false;
/// Whether to perform "call pettern heuristics".
bool enableCallPatternHeuristics = false;
/// Whether to include an item without any default arguments.
bool addCallWithNoDefaultArgs = true;
std::vector<CodeCompletionResult *> Results;
/// A single-element cache for module names stored in Allocator, keyed by a
/// clang::Module * or swift::ModuleDecl *.
std::pair<void *, NullTerminatedStringRef> LastModule;
CodeCompletionResultSink()
: Allocator(std::make_shared<llvm::BumpPtrAllocator>()) {}
};
} // end namespace ide
} // end namespace swift
#endif // SWIFT_IDE_CODECOMPLETIONRESULTSINK