mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CodeCompletion] Move ImportDepth to its own file
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "swift/IDE/CodeCompletionResult.h"
|
||||
#include "swift/IDE/CodeCompletionResultSink.h"
|
||||
#include "swift/IDE/CodeCompletionString.h"
|
||||
#include "swift/IDE/ImportDepth.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
@@ -78,26 +79,6 @@ ArrayRef<T> copyArray(llvm::BumpPtrAllocator &Allocator,
|
||||
return llvm::makeArrayRef(Buffer, Arr.size());
|
||||
}
|
||||
|
||||
/// A utility for calculating the import depth of a given module. Direct imports
|
||||
/// have depth 1, imports of those modules have depth 2, etc.
|
||||
///
|
||||
/// Special modules such as Playground auxiliary sources are considered depth
|
||||
/// 0.
|
||||
class ImportDepth {
|
||||
llvm::StringMap<uint8_t> depths;
|
||||
|
||||
public:
|
||||
ImportDepth() = default;
|
||||
ImportDepth(ASTContext &context, const FrontendOptions &frontendOptions);
|
||||
|
||||
Optional<uint8_t> lookup(StringRef module) {
|
||||
auto I = depths.find(module);
|
||||
if (I == depths.end())
|
||||
return None;
|
||||
return I->getValue();
|
||||
}
|
||||
};
|
||||
|
||||
struct SwiftCompletionInfo {
|
||||
swift::ASTContext *swiftASTContext = nullptr;
|
||||
const swift::CompilerInvocation *invocation = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user